[Webkit-unassigned] [Bug 165987] New: warning:=?UTF-8?Q?=20the=20compiler=20can=20assume=20that=20the=20address=20of=20=E2=80=98thisObject=E2=80=99=20will=20always=20evaluate=20to=20=E2=80=98true=E2=80=99=20?=[-Waddress] in WebCore::JSHTMLDocument::getOwnPropertySlot

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Dec 16 20:17:19 PST 2016


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

            Bug ID: 165987
           Summary: warning: the compiler can assume that the address of
                    ‘thisObject’ will always evaluate to ‘true’
                    [-Waddress] in
                    WebCore::JSHTMLDocument::getOwnPropertySlot
    Classification: Unclassified
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: Trivial
          Priority: P2
         Component: WebCore JavaScript
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: mcatanzaro at igalia.com

Seems ASSERT_GC_OBJECT_LOOKS_VALID is causing a warning again (like in r194303). Ways to fix this:

 * Use ASSERT_THIS_GC_OBJECT_INHERITS instead of ASSERT_GC_OBJECT_INHERITS. The only difference is ASSERT_THIS_GC_OBJECT_INHERITS doesn't have the null check that triggers the warning, so the behavior is what we want, but it'd be evil because here we are checking |thisObject| which is a normal parameter, not |this|.
 * Add more macros that do the same thing, with different names.
 * Just pass the original pointer rather than taking the address of a reference.

If this starts happening in more cases we should probably go with the second option, but the last option seems cleanest for now.


[1244/4409] Building CXX object Source...bindings/js/JSHTMLDocumentCustom.cpp.o
In file included from ../../Source/WTF/wtf/StdLibExtras.h:33:0,
                 from ../../Source/WTF/wtf/FastMalloc.h:26,
                 from ../../Source/WebCore/config.h:75,
                 from ../../Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp:26:
../../Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp: In static member function ‘static bool WebCore::JSHTMLDocument::getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&)’:
../../Source/WTF/wtf/Assertions.h:283:20: warning: the compiler can assume that the address of ‘thisObject’ will always evaluate to ‘true’ [-Waddress]
     if (!(assertion)) { \
                    ^
../../Source/WTF/wtf/Assertions.h:437:35: note: in expansion of macro ‘ASSERT’
 #define RELEASE_ASSERT(assertion) ASSERT(assertion)
                                   ^~~~~~
../../Source/JavaScriptCore/heap/GCAssertions.h:34:5: note: in expansion of macro ‘RELEASE_ASSERT’
     RELEASE_ASSERT(cell);\
     ^~~~~~~~~~~~~~
../../Source/JavaScriptCore/heap/GCAssertions.h:39:5: note: in expansion of macro ‘ASSERT_GC_OBJECT_LOOKS_VALID’
     ASSERT_GC_OBJECT_LOOKS_VALID(object); \
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp:58:5: note: in expansion of macro ‘ASSERT_GC_OBJECT_INHERITS’
     ASSERT_GC_OBJECT_INHERITS((&thisObject), info());
     ^
../../Source/WTF/wtf/Assertions.h:283:20: warning: the compiler can assume that the address of ‘thisObject’ will always evaluate to ‘true’ [-Waddress]
     if (!(assertion)) { \
                    ^
../../Source/WTF/wtf/Assertions.h:437:35: note: in expansion of macro ‘ASSERT’
 #define RELEASE_ASSERT(assertion) ASSERT(assertion)
                                   ^~~~~~
../../Source/JavaScriptCore/heap/GCAssertions.h:34:5: note: in expansion of macro ‘RELEASE_ASSERT’
     RELEASE_ASSERT(cell);\
     ^~~~~~~~~~~~~~
../../Source/JavaScriptCore/heap/GCAssertions.h:39:5: note: in expansion of macro ‘ASSERT_GC_OBJECT_LOOKS_VALID’
     ASSERT_GC_OBJECT_LOOKS_VALID(object); \
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp:58:5: note: in expansion of macro ‘ASSERT_GC_OBJECT_INHERITS’
     ASSERT_GC_OBJECT_INHERITS((&thisObject), info());
     ^

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20161217/cba80f02/attachment.html>


More information about the webkit-unassigned mailing list