diff options
author | Nathan Sidwell <nathan@acm.org> | 2022-06-08 11:25:14 -0700 |
---|---|---|
committer | Nathan Sidwell <nathan@acm.org> | 2022-06-09 06:22:15 -0700 |
commit | 97b81fb036342d32d2c80c0d5f3844406e06d3ae (patch) | |
tree | d6bcd572bd672afa46957b50f5b241bb3811b01b /gcc/cp/cp-tree.h | |
parent | 209de00fdb9da90a727337d6e752ea583a11d982 (diff) | |
download | gcc-97b81fb036342d32d2c80c0d5f3844406e06d3ae.zip gcc-97b81fb036342d32d2c80c0d5f3844406e06d3ae.tar.gz gcc-97b81fb036342d32d2c80c0d5f3844406e06d3ae.tar.bz2 |
c++: Better module initializer code
Every module interface needs to emit a global initializer, but it
might have nothing to init. In those cases, there's no need for any
idempotency boolean to be emitted.
gcc/cp
* cp-tree.h (module_initializer_kind): Replace with ...
(module_global_init_needed, module_has_import_inits): ...
these.
* decl2.cc (start_objects): Add has_body parm. Reorganize
module initializer creation.
(generate_ctor_or_dtor_function): Adjust.
(c_parse_final_cleanups): Adjust.
(vtv_start_verification_constructor_init_function): Adjust.
* module.cc (module_initializer_kind): Replace with ...
(module_global_init_needed, module_has_import_inits): ...
these.
gcc/testsuite/
* g++.dg/modules/init-2_a.C: Check no idempotency.
* g++.dg/modules/init-2_b.C: Check idempotency.
Diffstat (limited to 'gcc/cp/cp-tree.h')
-rw-r--r-- | gcc/cp/cp-tree.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 3d8a08b..a5d9328 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -7179,7 +7179,8 @@ extern module_state *get_module (tree name, module_state *parent = NULL, bool partition = false); extern bool module_may_redeclare (tree decl); -extern int module_initializer_kind (); +extern bool module_global_init_needed (); +extern bool module_has_import_inits (); extern void module_add_import_initializers (); /* Where the namespace-scope decl was originally declared. */ |