WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED WONTFIX
97251
GlobalObjectMethodTable initialization should use designated initializers
https://bugs.webkit.org/show_bug.cgi?id=97251
Summary
GlobalObjectMethodTable initialization should use designated initializers
Pratik Solanki
Reported
2012-09-20 12:44:46 PDT
Instead of doing const GlobalObjectMethodTable JSDOMWindowBase::s_globalObjectMethodTable = { &shouldAllowAccessFrom, &supportsProfiling, &supportsRichSourceInfo, &shouldInterruptScript, &javaScriptExperimentsEnabled }; and relying on the order in which the fields are written, we can use designated initializers.
Attachments
Patch
(4.15 KB, patch)
2012-09-20 12:53 PDT
,
Pratik Solanki
no flags
Details
Formatted Diff
Diff
Patch
(4.95 KB, text/plain)
2012-12-12 16:50 PST
,
Pratik Solanki
no flags
Details
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Pratik Solanki
Comment 1
2012-09-20 12:45:34 PDT
I'm not sure if we have precedent for using designated initializers in webkit. I'll upload patch for review and see what EWS says.
Pratik Solanki
Comment 2
2012-09-20 12:53:37 PDT
Created
attachment 164967
[details]
Patch
Geoffrey Garen
Comment 3
2012-09-20 12:55:28 PDT
I like this, but I think older versions of GCC object. I guess we'll see...
Gyuyoung Kim
Comment 4
2012-09-20 13:00:54 PDT
Comment on
attachment 164967
[details]
Patch
Attachment 164967
[details]
did not pass efl-ews (efl): Output:
http://queues.webkit.org/results/13949292
Build Bot
Comment 5
2012-09-20 13:05:19 PDT
Comment on
attachment 164967
[details]
Patch
Attachment 164967
[details]
did not pass win-ews (win): Output:
http://queues.webkit.org/results/13948313
Early Warning System Bot
Comment 6
2012-09-20 14:09:05 PDT
Comment on
attachment 164967
[details]
Patch
Attachment 164967
[details]
did not pass qt-ews (qt): Output:
http://queues.webkit.org/results/13958294
Pratik Solanki
Comment 7
2012-09-20 14:30:31 PDT
Ok. This isn't going to work due to failures in other ports. What if I added a HAVE(DESIGNATED_INITIALIZERS) macro and move the code there? And then we can turn it on for platforms that support it. Is it worth doing that?
Early Warning System Bot
Comment 8
2012-09-20 15:08:54 PDT
Comment on
attachment 164967
[details]
Patch
Attachment 164967
[details]
did not pass qt-wk2-ews (qt): Output:
http://queues.webkit.org/results/13949329
Geoffrey Garen
Comment 9
2012-09-20 21:05:50 PDT
Is there a way to do that without having to write all the initializers twice?
Sam Weinig
Comment 10
2012-09-23 00:04:18 PDT
(In reply to
comment #7
)
> Ok. This isn't going to work due to failures in other ports. What if I added a HAVE(DESIGNATED_INITIALIZERS) macro and move the code there? And then we can turn it on for platforms that support it. Is it worth doing that?
If you do end up doing it with a #if check, please use a COMPILER_SUPPORTS() macro instead of HAVE().
Sam Weinig
Comment 11
2012-09-23 00:05:09 PDT
(In reply to
comment #9
)
> Is there a way to do that without having to write all the initializers twice?
Macros of course!
Sam Weinig
Comment 12
2012-09-25 00:55:20 PDT
Comment on
attachment 164967
[details]
Patch r-ing given how much this breaks.
Pratik Solanki
Comment 13
2012-12-12 16:50:40 PST
Created
attachment 179151
[details]
Patch
Pratik Solanki
Comment 14
2012-12-12 16:52:15 PST
Couldn't figure out a way to avoid the code duplication. I'm enabling the code for clang only. I'm sure newer versions of gcc support designated initializers but I didn't test. Anyone who compiles with gcc can test and enable the code path on that compiler.
Darin Adler
Comment 15
2012-12-12 20:03:32 PST
Comment on
attachment 179151
[details]
Patch Given that we can use this only in certain compilers, and still have to keep the #else branch working, this doesn’t seem worth doing to me. Does this solve a concrete problem?
Pratik Solanki
Comment 16
2012-12-12 23:32:13 PST
(In reply to
comment #15
)
> (From update of
attachment 179151
[details]
) > Given that we can use this only in certain compilers, and still have to keep the #else branch working, this doesn’t seem worth doing to me. Does this solve a concrete problem?
This was motivated by <
rdar://12329156
>. Having designated initializers would have prevented that. But I do I agree this does add more complexity. Is there anything better we can do?
Pratik Solanki
Comment 17
2013-05-03 12:28:56 PDT
This is probably not worth doing. Closing.
Zan Dobersek
Comment 18
2013-09-05 08:35:09 PDT
Comment on
attachment 179151
[details]
Patch The work on this bug has ceased, removing the r? flag on the patch.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug