Bug 176869
| Summary: | Unified JSC build triggers -Wsubobject-linkage warning | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Michael Catanzaro <mcatanzaro> |
| Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED DUPLICATE | ||
| Severity: | Normal | CC: | keith_miller, mcatanzaro |
| Priority: | P2 | ||
| Version: | Other | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Michael Catanzaro
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 | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Michael Catanzaro
*** This bug has been marked as a duplicate of bug 176876 ***