Changeset 38457 in webkit for trunk/JavaScriptCore/wtf


Ignore:
Timestamp:
Nov 16, 2008, 3:07:46 PM (17 years ago)
Author:
[email protected]
Message:

Reviewed by Darin Adler.

https://bugs.webkit.org/show_bug.cgi?id=21810
Remove use of static C++ objects that are destroyed at exit time (destructors)

Conditionally have the DEFINE_STATIC_LOCAL workaround <rdar://problem/6354696>
(Codegen issue with C++ static reference in gcc build 5465) based upon the compiler
build versions. It will use the:
static T& = *new T;
style for all other compilers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/wtf/StdLibExtras.h

    r38411 r38457  
    2424 */
    2525
     26#include <wtf/Platform.h>
     27
    2628// Use these to declare and define a static local variable (static T;) so that
    2729//  it is leaked so that its destructors are not called at exit. Using this
    2830//  macro also allows workarounds for various compiler bugs.
     31#if COMPILER(GCC) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 0) && (__GNUC_PATCHLEVEL__ == 1) && (__APPLE_CC__ == 5465)
    2932#define DEFINE_STATIC_LOCAL(type, name, arguments) \
    3033    static type* name##Ptr = new type arguments; \
    3134    type& name = *name##Ptr
     35#else
     36#define DEFINE_STATIC_LOCAL(type, name, arguments) \
     37    static type& name = *new type arguments
     38#endif
Note: See TracChangeset for help on using the changeset viewer.