Changeset 85725 in webkit


Ignore:
Timestamp:
May 4, 2011 1:33:12 AM (13 years ago)
Author:
alexis.menard@openbossa.org
Message:

2011-05-04 Alexis Menard <alexis.menard@openbossa.org>

Reviewed by Geoffrey Garen.

JITPropertyAccess produces a unused but set variable warning in gcc 4.6.0.
https://bugs.webkit.org/show_bug.cgi?id=60050

This patch fix a compilation warning. The new warning scenario -Wunused-but-set-variable
in gcc 4.6.0 is included in -Wall and therefore stops the compilation when warnings are treated
as errors. The patch introduces a new macro ASSERT_JIT_OFFSET_UNUSED and ASSERT_WITH_MESSAGE_UNUSED
which copy the idea of ASSERT_UNUSED.

  • jit/JIT.h:
  • jit/JITPropertyAccess.cpp: (JSC::JIT::emit_op_method_check): (JSC::JIT::compileGetByIdHotPath): (JSC::JIT::emit_op_put_by_id):
  • wtf/Assertions.h: (assertWithMessageUnused):
Location:
trunk/Source/JavaScriptCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r85719 r85725  
     12011-05-04  Alexis Menard  <alexis.menard@openbossa.org>
     2
     3        Reviewed by Geoffrey Garen.
     4
     5        JITPropertyAccess produces a unused but set variable warning in gcc 4.6.0.
     6        https://bugs.webkit.org/show_bug.cgi?id=60050
     7
     8        This patch fix a compilation warning. The new warning scenario -Wunused-but-set-variable
     9        in gcc 4.6.0 is included in -Wall and therefore stops the compilation when warnings are treated
     10        as errors. The patch introduces a new macro ASSERT_JIT_OFFSET_UNUSED and ASSERT_WITH_MESSAGE_UNUSED
     11        which copy the idea of ASSERT_UNUSED.
     12
     13        * jit/JIT.h:
     14        * jit/JITPropertyAccess.cpp:
     15        (JSC::JIT::emit_op_method_check):
     16        (JSC::JIT::compileGetByIdHotPath):
     17        (JSC::JIT::emit_op_put_by_id):
     18        * wtf/Assertions.h:
     19        (assertWithMessageUnused):
     20
    1212011-04-29  Jer Noble  <jer.noble@apple.com>
    222
  • trunk/Source/JavaScriptCore/jit/JIT.h

    r85432 r85725  
    3737#endif
    3838
     39#define ASSERT_JIT_OFFSET_UNUSED(variable, actual, expected) ASSERT_WITH_MESSAGE_UNUSED(variable, actual == expected, "JIT Offset \"%s\" should be %d, not %d.\n", #expected, static_cast<int>(expected), static_cast<int>(actual));
    3940#define ASSERT_JIT_OFFSET(actual, expected) ASSERT_WITH_MESSAGE(actual == expected, "JIT Offset \"%s\" should be %d, not %d.\n", #expected, static_cast<int>(expected), static_cast<int>(actual));
    4041
  • trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp

    r85372 r85725  
    348348    Jump match = jump();
    349349
    350     ASSERT_JIT_OFFSET(differenceBetween(info.structureToCompare, protoObj), patchOffsetMethodCheckProtoObj);
     350    ASSERT_JIT_OFFSET_UNUSED(protoObj, differenceBetween(info.structureToCompare, protoObj), patchOffsetMethodCheckProtoObj);
    351351    ASSERT_JIT_OFFSET(differenceBetween(info.structureToCompare, protoStructureToCompare), patchOffsetMethodCheckProtoStruct);
    352     ASSERT_JIT_OFFSET(differenceBetween(info.structureToCompare, putFunction), patchOffsetMethodCheckPutFunction);
     352    ASSERT_JIT_OFFSET_UNUSED(putFunction, differenceBetween(info.structureToCompare, putFunction), patchOffsetMethodCheckPutFunction);
    353353
    354354    // Link the failure cases here.
     
    422422    loadPtr(Address(regT0, OBJECT_OFFSETOF(JSObject, m_propertyStorage)), regT0);
    423423    DataLabel32 displacementLabel = loadPtrWithAddressOffsetPatch(Address(regT0, patchGetByIdDefaultOffset), regT0);
    424     ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, displacementLabel), patchOffsetGetByIdPropertyMapOffset);
     424    ASSERT_JIT_OFFSET_UNUSED(displacementLabel, differenceBetween(hotPathBegin, displacementLabel), patchOffsetGetByIdPropertyMapOffset);
    425425
    426426    Label putResult(this);
     
    501501    END_UNINTERRUPTED_SEQUENCE(sequencePutById);
    502502
    503     ASSERT_JIT_OFFSET(differenceBetween(hotPathBegin, displacementLabel), patchOffsetPutByIdPropertyMapOffset);
     503    ASSERT_JIT_OFFSET_UNUSED(displacementLabel, differenceBetween(hotPathBegin, displacementLabel), patchOffsetPutByIdPropertyMapOffset);
    504504}
    505505
  • trunk/Source/JavaScriptCore/wtf/Assertions.h

    r83709 r85725  
    280280while (0)
    281281#endif
     282
     283/* ASSERT_WITH_MESSAGE_UNUSED */
     284
     285#if COMPILER(MSVC7_OR_LOWER)
     286#define ASSERT_WITH_MESSAGE_UNUSED(variable, assertion) ((void)0)
     287#elif COMPILER(WINSCW)
     288#define ASSERT_WITH_MESSAGE_UNUSED(variable, assertion, arg...) ((void)0)
     289#elif ASSERT_MSG_DISABLED
     290#if COMPILER(INTEL) && !OS(WINDOWS) || COMPILER(RVCT)
     291template<typename T>
     292inline void assertWithMessageUnused(T& x) { (void)x; }
     293#define ASSERT_WITH_MESSAGE_UNUSED(variable, assertion, ...) (assertWithMessageUnused(variable))
     294#else
     295#define ASSERT_WITH_MESSAGE_UNUSED(variable, assertion, ...) ((void)variable)
     296#endif
     297#else
     298#define ASSERT_WITH_MESSAGE_UNUSED(variable, assertion, ...) do \
     299    if (!(assertion)) { \
     300        WTFReportAssertionFailureWithMessage(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, #assertion, __VA_ARGS__); \
     301        CRASH(); \
     302    } \
     303while (0)
     304#endif
    282305                       
    283306                       
Note: See TracChangeset for help on using the changeset viewer.