aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-unswitch.cc
diff options
context:
space:
mode:
authorNathaniel Shead <nathanieloshead@gmail.com>2024-08-19 16:38:41 +1000
committerNathaniel Shead <nathanieloshead@gmail.com>2024-09-27 13:49:23 +1000
commitaf4471cb422a867f1877c7c08bb63fa75a8888fe (patch)
tree6b4ede63935b0d3ead4083163a26e0a4b6ce460f /gcc/tree-ssa-loop-unswitch.cc
parent3471ae37200bd8154084334204a6f72a5bbae974 (diff)
downloadgcc-af4471cb422a867f1877c7c08bb63fa75a8888fe.zip
gcc-af4471cb422a867f1877c7c08bb63fa75a8888fe.tar.gz
gcc-af4471cb422a867f1877c7c08bb63fa75a8888fe.tar.bz2
c++: Update decl_linkage for C++11
Currently modules code uses a variety of ad-hoc methods to attempt to determine whether an entity has internal linkage, which leads to inconsistencies and some correctness issues as different edge cases are neglected. While investigating this I discovered 'decl_linkage', but it doesn't seem to have been updated to account for the C++11 clarification that all entities declared in an anonymous namespace are internal. I'm not convinced that even in C++98 it was intended that e.g. types in anonymous namespaces should be external, but some tests in the testsuite rely on this, so for compatibility I restricted those modifications to C++11 and later. This should have relatively minimal impact as not much seems to actually rely on decl_linkage, but does change the mangling of symbols in anonymous namespaces slightly. Previously, we had namespace { int x; // mangled as '_ZN12_GLOBAL__N_11xE' static int y; // mangled as '_ZN12_GLOBAL__N_1L1yE' } but with this patch the x is now mangled like y (with the extra 'L'). For contrast, Clang currently mangles neither x nor y with the 'L'. Since this only affects internal-linkage entities I don't believe this should break ABI in any observable fashion. gcc/cp/ChangeLog: * name-lookup.cc (do_namespace_alias): Propagate TREE_PUBLIC for namespace aliases. * tree.cc (decl_linkage): Update rules for C++11. gcc/testsuite/ChangeLog: * g++.dg/modules/mod-sym-4.C: Update test to account for non-static internal-linkage variables new mangling. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com> Reviewed-by: Jason Merrill <jason@redhat.com>
Diffstat (limited to 'gcc/tree-ssa-loop-unswitch.cc')
0 files changed, 0 insertions, 0 deletions