aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/builtin-unreachable-5.c
diff options
context:
space:
mode:
authorNathaniel Shead <nathanieloshead@gmail.com>2025-09-20 23:12:17 +1000
committerNathaniel Shead <nathanieloshead@gmail.com>2025-10-04 14:31:15 +1000
commita8ecf4580442e463c3a023b6724fb27e6b7e0804 (patch)
tree5e9190bb5f638a8509ddceddcb4085d06ff68bef /gcc/testsuite/gcc.dg/builtin-unreachable-5.c
parent806d5417e0c04a15c48a7e876ebf435f06ecfccc (diff)
downloadgcc-master.zip
gcc-master.tar.gz
gcc-master.tar.bz2
c++/modules: Handle naming external TU-local entities in ADLHEADtrunkmaster
This finishes the reworking of ADL handling for modules for PR117658. [basic.link] p18 says that we should diagnose any references to a TU-local entity from a different TU; with our fixed handling of ADL this is now possible to occur. To do this we need to generate fake bindings for these decls on stream-out so that importers know that we have a visible name in this namespace. We don't actually need (or want) to provide full DECLs though, as that could potentially involve streaming other TU-local entities, so we just build a TU_LOCAL_ENTITY for the decl on receipt. The patch also uses 'decl_as_string' to give a more descriptive name for these decls when erroring. We also need somewhere to store these decls. We only actually need the decls for diagnostics; for correctness we only need to know whether any such decls existed, so to not mess with the existing packing of bindings or usages of the OVERLOADs this patch adds a new map to the binding vector that can be looked up when diagnostics need to be generated. Finally, as specified this diagnostic is a pretty broad hammer, as any internal-linkage purview function will stop ADL in exported templates from working with that name. So this patch just makes it a pedwarn and provides an option to disable if needed. PR c++/117658 gcc/c-family/ChangeLog: * c.opt: New flag '-Wexternal-tu-local'. * c.opt.urls: Regenerate. gcc/cp/ChangeLog: * cp-tree.h (TU_LOCAL_ENTITY_NAME): Clarify meaning. * module.cc (depset::entity_kind): New enumerator, assert that we have enough bits reserved. (depset::disc_bits): Assert the discriminator has enough bits. (depset::entity_kind_name): Add 'tu-local' case, assert we have an entry for all relevant entry_kinds. (name_for_tu_local_decl): New function. (trees_out::tree_node): Use it. (depset::hash::make_dependency): Validate EK_TU_LOCAL. (depset::hash::add_binding_entity): Generate bindings for internal purview functions. (enum ct_bind_flags): New enum for TU-local decls. (depset::hash::find_dependencies): Handle EK_TU_LOCAL entities. (binding_cmp): Likewise. (sort_cluster): Likewise. (module_state::write_cluster): Likewise. (module_state::read_cluster): Likewise. * name-lookup.cc (append_imported_binding_slot): Propagate internal decl list when growing binding vector. (name_lookup::adl_namespace_fns): Diagnose if naming a TU-local entity from a different TU. (set_module_binding): Include any internal decls in binding. * name-lookup.h (struct module_tree_map_traits): New type. (struct tree_binding_vec): Add member 'internal_decls'. (BINDING_VECTOR_INTERNAL_DECLS): New getter. (MODULE_BINDING_INTERNAL_DECLS_P): New flag. (set_module_binding): Add parameter. gcc/ChangeLog: * doc/invoke.texi: Document '-Wno-external-tu-local'. gcc/testsuite/ChangeLog: * g++.dg/modules/adl-6_c.C: Adjust diagnostics. * g++.dg/modules/internal-14_c.C: Likewise. * g++.dg/modules/internal-15_a.C: New test. * g++.dg/modules/internal-15_b.C: New test. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com> Reviewed-by: Jason Merrill <jason@redhat.com>
Diffstat (limited to 'gcc/testsuite/gcc.dg/builtin-unreachable-5.c')
0 files changed, 0 insertions, 0 deletions