RESOLVED DUPLICATE of bug 176876176869
Unified JSC build triggers -Wsubobject-linkage warning
https://bugs.webkit.org/show_bug.cgi?id=176869
Summary Unified JSC build triggers -Wsubobject-linkage warning
Michael Catanzaro
Reported 2017-09-13 11:51:09 PDT
I see a couple new warnings after r221954: [505/5235] Building CXX object Source/...s/JavaScriptCore/UnifiedSource44.cpp.o In file included from DerivedSources/JavaScriptCore/UnifiedSource44.cpp:1:0: ../../Source/JavaScriptCore/dfg/DFGLICMPhase.cpp:64:7: warning: ‘JSC::DFG::LICMPhase’ has a field ‘JSC::DFG::LICMPhase::m_data’ whose type uses the anonymous namespace [-Wsubobject-linkage] class LICMPhase : public Phase { ^~~~~~~~~ [507/5235] Building CXX object Source/...s/JavaScriptCore/UnifiedSource43.cpp.o In file included from DerivedSources/JavaScriptCore/UnifiedSource43.cpp:2:0: ../../Source/JavaScriptCore/dfg/DFGIntegerCheckCombiningPhase.cpp:174:7: warning: ‘JSC::DFG::IntegerCheckCombiningPhase’ has a field ‘JSC::DFG::IntegerCheckCombiningPhase::m_map’ whose type uses the anonymous namespace [-Wsubobject-linkage] class IntegerCheckCombiningPhase : public Phase { ^~~~~~~~~~~~~~~~~~~~~~~~~~ Fix would be to move those two types into the anonymous namespace as well, according to gcc(1): -Wsubobject-linkage (C++ and Objective-C++ only) Warn if a class type has a base or a field whose type uses the anonymous namespace or depends on a type with no linkage. If a type A depends on a type B with no or internal linkage, defining it in multiple translation units would be an ODR violation because the meaning of B is different in each translation unit. If A only appears in a single translation unit, the best way to silence the warning is to give it internal linkage by putting it in an anonymous namespace as well. The compiler doesn't give this warning for types defined in the main .C file, as those are unlikely to have multiple definitions. -Wsubobject-linkage is enabled by default.
Attachments
Michael Catanzaro
Comment 1 2017-09-13 20:45:01 PDT
*** This bug has been marked as a duplicate of bug 176876 ***
Note You need to log in before you can comment on or make changes to this bug.