-
- Downloads
c++: Adjust module initializer calling emission
We special-case emitting the calls of module initializer functions. It's simpler to just emit a static fn do do that, and add it onto the front of the global init fn chain. We can also move the calculation of the set of initializers to call to the point of use. gcc/cp/ * cp-tree.h (module_has_import_init): Rename to ... (module_determined_import_inits): ... here. * decl2.cc (start_objects): Do not handle module initializers here. (c_parse_final_cleanups): Generate a separate module initializer calling function and add it to the list. Shrink the c-lang region. * module.cc (num_init_calls_needed): Delete. (module_has_import_init): Rename to ... (module_determined_import_inits): ... here. Do the calculation here ... (finish_module_processing): ... rather than here. (module_add_import_initializers): Reformat. gcc/testsuite/ * g++.dg/modules/init-3_a.C: New. * g++.dg/modules/init-3_b.C: New. * g++.dg/modules/init-3_c.C: New.
Showing
- gcc/cp/cp-tree.h 1 addition, 1 deletiongcc/cp/cp-tree.h
- gcc/cp/decl2.cc 24 additions, 23 deletionsgcc/cp/decl2.cc
- gcc/cp/module.cc 52 additions, 58 deletionsgcc/cp/module.cc
- gcc/testsuite/g++.dg/modules/init-3_a.C 17 additions, 0 deletionsgcc/testsuite/g++.dg/modules/init-3_a.C
- gcc/testsuite/g++.dg/modules/init-3_b.C 6 additions, 0 deletionsgcc/testsuite/g++.dg/modules/init-3_b.C
- gcc/testsuite/g++.dg/modules/init-3_c.C 17 additions, 0 deletionsgcc/testsuite/g++.dg/modules/init-3_c.C
Loading
Please register or sign in to comment