[Webkit-unassigned] [Bug 20511] Remove static initializers on Windows (StaticConstructors.h)

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Aug 27 13:37:41 PDT 2008


https://bugs.webkit.org/show_bug.cgi?id=20511





------- Comment #4 from danceoffwithyourpantsoff at gmail.com  2008-08-27 13:37 PDT -------
(In reply to comment #3)
> (From update of attachment 23029 [edit])
>  92 #if COMPILER(MSVC)
>  93 #define HIDE_STATIC_CONSTRUCTORS_FROM_MSVC 1
>  94 #else
>  95 #define HIDE_STATIC_CONSTRUCTORS_FROM_GCC 1
>  96 #endif
> 
> If the GCC technique is really GCC-specific, then I think we should guard it
> with #if COMPILER too. That might prevent use from having to mention these
> STATIC_CONSTRUCTORS macros at all in the config.h file, which would be a good
> thing, and might remove the need for the #undef. But that can be done in a
> separate patch.

This is at least somewhat GCC specific.  Whether it would work on other
compiler chains (what else really is used outside of gcc and msvc?) I'm not
sure.  Even if you used a compiler like ICC, I imagine you're still going to
use the GNU linker tools.

I think someone who understands the system better might want to do the config.h
changes, or compiler guards.  I noticed it's removed on Symbian, but I have no
idea how webkit is build there.

> 
> But is the name good? Does this hide static constructors or eliminate them
> entirely? We might want to tweak the terminology to be as precise as possible.
> I'm not sure what the best terminology is for these global objects that need
> load time initialization. And for what exactly we're doing -- eliminating the
> load time initialization and replacing it with explicit initialization.

Hide is the best term I could come up with.  Avoid isn't much better.  The idea
is more or less this are static objects with static constructors, but we're
somehow tricking the compiler into ignoring them, and we'll do it ourself. 
MAKE_GCC_IGNORE_SOME_STATIC_CONSTRUCTORS ? :\

I would like the name to be as clear as possible, but I didn't come up with
anything great.  I think you will need to read the documentation in the header
to really understand what's going on anyway.  I don't think a single guard name
is going to convey everything we need to convey.

> 
>  23 // For WebCore we need to avoid having static constructors.  We use two
> hacks
> 
> I don't think the term "hacks" is really good here. There's just too much
> subjective opinion about what is and is not a "hack". The sentence about
> portability is clear and specific enough without using the term "hack". We
> should try to use specific language that's more precise

It is a hack.  I will avoid using the term though.

> 
> We normally don't use two spaces after periods in comments.

All those high school typing classes gone to waste.

> 
>  28 // initializers.  The constructors will never be called and the object will
> 
> Should be "objects", not "object".
> 
>  31 // We both of these tricks, we then must defined and explicitly call an
> init
> 
> Missing verb here in "Web both". Typo "defined".
> 
> I'll say r=me, since these nitpicks are small things.
> 

I will fix this all up and send another patch tomorrow.  Thanks for the quick
review.


-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list