Changeset 138957 in webkit


Ignore:
Timestamp:
Jan 7, 2013 10:31:20 AM (11 years ago)
Author:
mhahnenberg@apple.com
Message:

testapi is failing with a block-related error in the Objc API
https://bugs.webkit.org/show_bug.cgi?id=106055

Reviewed by Geoffrey Garen.

Casting a block to a bool will always return true, which isn't the behavior that is intended here.
Instead we need to call the block, but C semantics don't allow this, so we need to change
testapi.m to be Objective-C++ and therefore testapi.mm.

  • API/tests/testapi.m: Removed.
  • API/tests/testapi.mm: Copied from Source/JavaScriptCore/API/tests/testapi.m.

(blockSignatureContainsClass):

Location:
trunk/Source/JavaScriptCore
Files:
2 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/API/tests/testapi.mm

    r138956 r138957  
    2626#import "JavaScriptCore.h"
    2727
    28 bool _Block_has_signature(void *);
    29 const char * _Block_signature(void *);
     28extern "C" bool _Block_has_signature(void *);
     29extern "C" const char * _Block_signature(void *);
    3030
    3131extern int failed;
    32 void testObjectiveCAPI(void);
     32extern "C" void testObjectiveCAPI(void);
    3333
    3434#if JS_OBJC_API_ENABLED
     
    125125static bool blockSignatureContainsClass()
    126126{
    127     static bool containsClass = (bool)^{
     127    static bool containsClass = ^{
    128128        id block = ^(NSString *string){ return string; };
    129129        return _Block_has_signature(block) && strstr(_Block_signature(block), "NSString");
    130     };
     130    }();
    131131    return containsClass;
    132132}
  • trunk/Source/JavaScriptCore/ChangeLog

    r138924 r138957  
     12013-01-07  Mark Hahnenberg  <mhahnenberg@apple.com>
     2
     3        testapi is failing with a block-related error in the Objc API
     4        https://bugs.webkit.org/show_bug.cgi?id=106055
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Casting a block to a bool will always return true, which isn't the behavior that is intended here.
     9        Instead we need to call the block, but C semantics don't allow this, so we need to change
     10        testapi.m to be Objective-C++ and therefore testapi.mm.
     11
     12        * API/tests/testapi.m: Removed.
     13        * API/tests/testapi.mm: Copied from Source/JavaScriptCore/API/tests/testapi.m.
     14        (blockSignatureContainsClass):
     15        * JavaScriptCore.xcodeproj/project.pbxproj:
     16
    1172013-01-06  Filip Pizlo  <fpizlo@apple.com>
    218
  • trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r138763 r138957  
    540540                86CC85C40EE7A89400288682 /* JITPropertyAccess.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86CC85C30EE7A89400288682 /* JITPropertyAccess.cpp */; };
    541541                86CCEFDE0F413F8900FD7F9E /* JITCode.h in Headers */ = {isa = PBXBuildFile; fileRef = 86CCEFDD0F413F8900FD7F9E /* JITCode.h */; settings = {ATTRIBUTES = (Private, ); }; };
    542                 86D2221A167EF9440024C804 /* testapi.m in Sources */ = {isa = PBXBuildFile; fileRef = 86D22219167EF9440024C804 /* testapi.m */; };
     542                86D2221A167EF9440024C804 /* testapi.mm in Sources */ = {isa = PBXBuildFile; fileRef = 86D22219167EF9440024C804 /* testapi.mm */; };
    543543                86D3B2C310156BDE002865E7 /* ARMAssembler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86D3B2BF10156BDE002865E7 /* ARMAssembler.cpp */; };
    544544                86D3B2C410156BDE002865E7 /* ARMAssembler.h in Headers */ = {isa = PBXBuildFile; fileRef = 86D3B2C010156BDE002865E7 /* ARMAssembler.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    13951395                86CC85C30EE7A89400288682 /* JITPropertyAccess.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITPropertyAccess.cpp; sourceTree = "<group>"; };
    13961396                86CCEFDD0F413F8900FD7F9E /* JITCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITCode.h; sourceTree = "<group>"; };
    1397                 86D22219167EF9440024C804 /* testapi.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = testapi.m; path = API/tests/testapi.m; sourceTree = "<group>"; };
     1397                86D22219167EF9440024C804 /* testapi.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = testapi.mm; path = API/tests/testapi.mm; sourceTree = "<group>"; };
    13981398                86D3B2BF10156BDE002865E7 /* ARMAssembler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ARMAssembler.cpp; sourceTree = "<group>"; };
    13991399                86D3B2C010156BDE002865E7 /* ARMAssembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARMAssembler.h; sourceTree = "<group>"; };
     
    19131913                                14BD5A2D0A3E91F600BAF59C /* testapi.c */,
    19141914                                14D857740A4696C80032146C /* testapi.js */,
    1915                                 86D22219167EF9440024C804 /* testapi.m */,
     1915                                86D22219167EF9440024C804 /* testapi.mm */,
    19161916                                651122E5140469BA002B101D /* testRegExp.cpp */,
    19171917                        );
     
    35903590                        files = (
    35913591                                1440F6100A4F85670005F061 /* testapi.c in Sources */,
    3592                                 86D2221A167EF9440024C804 /* testapi.m in Sources */,
     3592                                86D2221A167EF9440024C804 /* testapi.mm in Sources */,
    35933593                        );
    35943594                        runOnlyForDeploymentPostprocessing = 0;
Note: See TracChangeset for help on using the changeset viewer.