[Webkit-unassigned] [Bug 167643] New: Consider enabling -Wno-expansion-to-defined for gcc 7
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Jan 31 07:48:29 PST 2017
https://bugs.webkit.org/show_bug.cgi?id=167643
Bug ID: 167643
Summary: Consider enabling -Wno-expansion-to-defined for gcc 7
Classification: Unclassified
Product: WebKit
Version: WebKit Nightly Build
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: Web Template Framework
Assignee: webkit-unassigned at lists.webkit.org
Reporter: tpopela at redhat.com
CC: mcatanzaro at igalia.com
In gcc 7 and (and in clang as well https://reviews.llvm.org/D15866 ) there was a new warning added -Wexpansion-to-defined (pasting the description from the clang patch):
//[cpp.cond]p4:
// Prior to evaluation, macro invocations in the list of preprocessing
// tokens that will become the controlling constant expression are replaced
// (except for those macro names modified by the 'defined' unary operator),
// just as in normal text. If the token 'defined' is generated as a result
// of this replacement process or use of the 'defined' unary operator does
// not match one of the two specified forms prior to macro replacement, the
// behavior is undefined.
// This isn't an idle threat, consider this program:
// #define FOO
// #define BAR defined(FOO)
// #if BAR
// ...
// #else
// ...
// #endif
// clang and gcc will pick the #if branch while Visual Studio will take the
// #else branch. Emit a warning about this undefined behavior.
This applies for all of our USE, PLATFORM, CPU, ENABLE, ... macros. I would suggest to add -Wno-expansion-to-defined to our CFLAGS in OptionsCommon.cmake to get rid off the warning as it's more easier than rewriting the macro definitions. Also I'm not sure if the warning will be triggered on newer clang as per:
"there is no easy way to rewrite a function-like macro like #define FOO(x) (defined __foo_##x && __foo_##x). Function-like macros like this are used in practice, and compilers seem to not have differing behavior in that case. So make this a default-on warning only for object-like macros and an extension warning that only shows up with pedantic for function-like macros. (But it's undefined behavior in both cases.)"
that we are using in the USE, PLATFORM, CPU, ENABLE, ... macros. So I'm curious if it's actually not a gcc bug.
--
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/20170131/eaebee57/attachment.html>
More information about the webkit-unassigned
mailing list