]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: Make static init generation more consistent
authorNathan Sidwell <nathan@acm.org>
Tue, 31 May 2022 14:56:53 +0000 (07:56 -0700)
committerNathan Sidwell <nathan@acm.org>
Wed, 1 Jun 2022 14:29:33 +0000 (07:29 -0700)
commitee21974c8ecbbaa2a1d44f2dba873f8724ed9ad4
tree8d40950b3ea66b946070d7192eab84e388c7fff0
parent57a8fb92ac4161ebbf9381b009e8c5af843e3e5f
c++: Make static init generation more consistent

The end-of-compilation static init code generation functions are:

* Inconsistent in argument ordering (swapping 'is-init' and 'priority',
  wrt each other and other arguments).

* Inconsistent in naming. mostly calling the is-init argument 'initp',
  but sometimes calling it 'constructor_p' and in the worst case using
  a transcoded 'methody_type' character, and naming the priority
  argument 'initp'.

* Inconsistent in typing.  Sometimes the priority is unsigned,
  sometimes signed.  And the initp argument can of course be a bool.

* Several of the function comments have bit-rotted.

This addresses those oddities.  Name is-init 'initp', name priority
'priority'.  Place initp first, make priority unsigned.

gcc/cp/
* decl2.cc (start_objects): Replace 'method_type' parameter
with 'initp' boolean, rename and retype 'priority' parameter.
(finish_objects): Likewise.  Do not expand here.
(one_static_initialization_or_destruction): Move 'initp'
parameter first.
(do_static_initialization_or_destruction): Likewise.
(generate_ctor_or_dtor_function): Rename 'initp' parameter.
Adjust start_objects/finish_obects calls and expand here.
(generate_ctor_and_dtor_functions_for_priority): Adjust calls.
(c_parse_final_cleanups): Likewise.
(vtv_start_verification_constructor_init): Adjust.
(vtv_finish_verification_constructor_init): Use finish_objects.
gcc/cp/decl2.cc