Closed Bug 1316978 Opened 4 years ago Closed 4 years ago
Tons of warning spam from passing nullptr to NSCAP
58 bytes, text/x-review-board-request
The changes in bug 1316432 started passing nullptr to NSCAP_LOG_ASSIGNMENT. Now I get tons of compiler warnings like this when building: 0:15.28 Warning: -Wnull-conversion in /Users/bzbarsky/mozilla/inbound/obj-firefox/dist/include/nsCOMPtr.h: implicit conversion of nullptr constant to 'bool' 0:15.28 ../../dist/include/nsCOMPtr.h:518:32: warning: implicit conversion of nullptr constant to 'bool' [-Wnull-conversion] 0:15.28 NSCAP_LOG_ASSIGNMENT(this, nullptr); 0:15.31 ^~~~~~~ 0:15.31 false 0:15.31 ../../dist/include/nsISupportsImpl.h:135:7: note: expanded from macro 'NSCAP_LOG_ASSIGNMENT' 0:15.31 if (_p) etc (listing the template expansion, the include chain, and so forth). Adds up to thousands of lines per unified cpp file....
Thank you for letting me know.
Assignee: nobody → gsquelart
Comment on attachment 8809972 [details] Bug 1316978 - Suppress nullptr-to-bool cast warning - https://reviewboard.mozilla.org/r/92452/#review92510 r=me with the below fixed. ::: xpcom/glue/nsISupportsImpl.h:137 (Diff revision 1) > * These logging functions require dynamic_cast<void*>, so they don't > - * do anything useful if we don't have dynamic_cast<void*>. */ > + * do anything useful if we don't have dynamic_cast<void*>. > + * Note: The explicit comparison to nullptr is needed to avoid warnings > + * when _p is a nullptr itself. */ > #define NSCAP_LOG_ASSIGNMENT(_c, _p) \ > - if (_p) \ > + if (_p == nullptr) \ Surely this is supposed to be `_p != nullptr`?
Attachment #8809972 - Flags: review?(nfroyd) → review+
Pushed by firstname.lastname@example.org: https://hg.mozilla.org/integration/autoland/rev/99603b2447b8 Suppress nullptr-to-bool cast warning - r=froydnj
You need to log in before you can comment on or make changes to this bug.