Bug 165987 - warning: the compiler can assume that the address of ‘thisObject’ will always evaluate to ‘true’ [-Waddress] in WebCore::JSHTMLDocument::getOwnPropertySlot
Summary: warning: the compiler can assume that the address of ‘thisObject’ will always...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: WebKit Nightly Build
Hardware: PC Linux
: P2 Trivial
Assignee: Michael Catanzaro
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-16 20:17 PST by Michael Catanzaro
Modified: 2016-12-17 10:14 PST (History)
3 users (show)

See Also:


Attachments
Patch (1.87 KB, patch)
2016-12-17 07:00 PST, Michael Catanzaro
mark.lam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Catanzaro 2016-12-16 20:17:19 PST
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());
     ^
Comment 1 Michael Catanzaro 2016-12-17 07:00:01 PST
Created attachment 297404 [details]
Patch
Comment 2 Mark Lam 2016-12-17 08:45:53 PST
Comment on attachment 297404 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=297404&action=review

r=me

> Source/WebCore/ChangeLog:3
> +        warning: the compiler can assume that the address of âthisObjectâ will always evaluate to âtrueâ [-Waddress] in WebCore::JSHTMLDocument::getOwnPropertySlot

please fix non-ascii chars.
Comment 3 Michael Catanzaro 2016-12-17 10:14:12 PST
Committed r209965: <http://trac.webkit.org/changeset/209965>