RESOLVED DUPLICATE of bug 167643 Bug 172618
Building with GCC 7.1.x spews lots of “warning: this use of "defined" may not be portable [-Wexpansion-to-defined]“
https://bugs.webkit.org/show_bug.cgi?id=172618
Summary Building with GCC 7.1.x spews lots of “warning: this use of "defined" may not...
Adrian Perez
Reported 2017-05-25 16:06:49 PDT
This happens for all the expansions of: - #if ENABLE(FOO) - #if PLATFORM(FOO) - #if CPU(FOO) - #if USE(FOO) - #if HAVE(FOO) - ... For example: ../../Source/WTF/wtf/Platform.h:807:1: warning: this use of "defined" may not be portable [-Wexpansion-to-defined] #if (CPU(X86_64) || CPU(ARM64)) && HAVE(FAST_TLS) ^~~~~~~~~~~~~ It seems that the -Wexpansion-to-defined existed before in GCC, but the warning is now enabled by default in version 7.1.x of the compiler. WebKit source code makes extensive use of this kind of expansions, so probably it'd be better to silence these warnings.
Attachments
Patch (1.88 KB, patch)
2017-05-25 16:10 PDT, Adrian Perez
no flags
Adrian Perez
Comment 1 2017-05-25 16:10:42 PDT
Michael Catanzaro
Comment 2 2017-05-25 19:57:32 PDT
I know you already have a patch here and normally I'd favor the bug with the patch, but there's good discussion in bug #167643 so please reattach it there. My concern is that these macros are all undefined behavior, so we should consider eliminating them. *** This bug has been marked as a duplicate of bug 167643 ***
Michael Catanzaro
Comment 3 2017-05-25 20:12:17 PDT
Comment on attachment 311307 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=311307&action=review > Source/cmake/OptionsCommon.cmake:78 > + if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "7.1.0") > + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-expansion-to-defined") > + endif () No need to check compiler version, just enable it unconditionally. Look for wherever our other warning flags are used; we probably don't need to add a new line, just add it to wherever the other ones are.
Note You need to log in before you can comment on or make changes to this bug.