Compiling WebKit with GCC 4.8 generates lots of warnings due to COMPILE_ASSERT defining an unused typedef. Example: generated/InspectorTypeBuilder.h: In member function 'WebCore::TypeBuilder::Network::CachedResource::Builder<STATE>::operator WTF::RefPtr<WebCore::TypeBuilder::Network::CachedResource>&()': ..\WTF/wtf/Assertions.h:328:47: warning: typedef 'dummyresult_is_not_ready' locally defined but not used [-Wunused-local-typedefs] #define COMPILE_ASSERT(exp, name) typedef int dummy##name [(exp) ? 1 : -1] ^ generated/InspectorTypeBuilder.h:2932:13: note: in expansion of macro 'COMPILE_ASSERT' COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
Compile_assert should probably be implemented using static_assert when available.
We could also just diable the warning: #pragma GCC diagnostic ignored "-Wunused-local-typedefs" (Note that you can't disable it 'locally' with pragma push, pragma pop though cause it's part of a #define).
(In reply to comment #1) > Compile_assert should probably be implemented using static_assert when available. Uploaded that to bug 113308
Does this bug still track anything useful, given that bug 113308 will fix the symptom?
(In reply to comment #4) > Does this bug still track anything useful, given that bug 113308 will fix the symptom? C++11 support may not be enabled in GCC. In fact it is default off.
(In reply to comment #5) > (In reply to comment #4) > > Does this bug still track anything useful, given that bug 113308 will fix the symptom? > > C++11 support may not be enabled in GCC. In fact it is default off. The GTK port only enforces the C++11 standard when building the WebKit2 framework. This means that when building WTF, WebCore etc. static_assert is still not available and thus the same warnings are still being spat out. Is this true for the Qt port as well?
(In reply to comment #6) > (In reply to comment #5) > > (In reply to comment #4) > > > Does this bug still track anything useful, given that bug 113308 will fix the symptom? > > > > C++11 support may not be enabled in GCC. In fact it is default off. > > The GTK port only enforces the C++11 standard when building the WebKit2 framework. This means that when building WTF, WebCore etc. static_assert is still not available and thus the same warnings are still being spat out. > > Is this true for the Qt port as well? As far as I know Qt does not enforce C++11 on any framework yet.
(In reply to comment #6) > (In reply to comment #5) > > (In reply to comment #4) > > > Does this bug still track anything useful, given that bug 113308 will fix the symptom? > > > > C++11 support may not be enabled in GCC. In fact it is default off. > > The GTK port only enforces the C++11 standard when building the WebKit2 framework. This means that when building WTF, WebCore etc. static_assert is still not available and thus the same warnings are still being spat out. > > Is this true for the Qt port as well? Let me put it this way: WebCore doesn't build with C++11 enabled, see bug 111579.
Right, understood. The warnings that the dummy COMPILE_ASSERT implementation is throwing out can be suppressed using the __attribute__((unused)) directive. It seems to work with GCC 4.7 and 4.8 and with Clang 3.2, though there are other compilers that people use that don't necessary support the directive. https://svn.boost.org/trac/boost/ticket/7242
Created attachment 195890 [details] Patch
Attachment 195890 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WTF/ChangeLog', u'Source/WTF/wtf/Assertions.h']" exit_code: 1 Source/WTF/wtf/Assertions.h:354: Extra space before [ [whitespace/braces] [5] Total errors found: 1 in 2 files If any of these errors are false positives, please file a bug against check-webkit-style.
There are also warnings generated by Source/WTF/wtf/dtoa/utils.h:294:22: error: typedef ‘VerifySizesAreEqual’ locally defined but not used [-Werror=unused-local-typedefs] typedef char VerifySizesAreEqual[sizeof(Dest) == sizeof(Source) ? 1 : -1]; Source/WTF/wtf/HashTable.h:1302:84: warning: typedef ‘HashTableType’ locally defined but not used [-Wunused-local-typedefs] typedef HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits> HashTableType; ^ Source/WTF/wtf/HashTable.h:1303:97: warning: typedef ‘const_iterator’ locally defined but not used [-Wunused-local-typedefs] typedef HashTableConstIterator<Key, Value, Extractor, HashFunctions, Traits, KeyTraits> const_iterator; ^ Doesn't it make more sense to add a macro to Compiler.h that's defined when we have either gcc or clang and use it in all those declarations?
This doesn't seem like a helpful warning, let's just turn it off.
(In reply to comment #13) > This doesn't seem like a helpful warning, let's just turn it off. Hmm, do you mean leaving it up to each build system to detect the compiler and its version and pass -Wno-unused-local-typedefs accordingly?
(In reply to comment #14) > (In reply to comment #13) > > This doesn't seem like a helpful warning, let's just turn it off. > > Hmm, do you mean leaving it up to each build system to detect the compiler and its version and pass -Wno-unused-local-typedefs accordingly? I think it would be better to disable it in source code than to try to rely on specific compiler flags.
(In reply to comment #15) > (In reply to comment #14) > > (In reply to comment #13) > > > This doesn't seem like a helpful warning, let's just turn it off. > > > > Hmm, do you mean leaving it up to each build system to detect the compiler and its version and pass -Wno-unused-local-typedefs accordingly? > > I think it would be better to disable it in source code than to try to rely on specific compiler flags. I agree, and I think this was the direction we were moving towards, but Anders' comment sounded like he had a different opinion.
Created attachment 196483 [details] Patch
Comment on attachment 196483 [details] Patch LGTM
Comment on attachment 196483 [details] Patch Clearing flags on attachment: 196483 Committed r147640: <http://trac.webkit.org/changeset/147640>
All reviewed patches have been landed. Closing bug.