diff options
author | Nathan Sidwell <nathan@acm.org> | 2020-07-22 08:20:31 -0700 |
---|---|---|
committer | Nathan Sidwell <nathan@acm.org> | 2020-07-22 08:43:25 -0700 |
commit | 0f32c94fc72313798b3a9033c92ceb34f7b7febc (patch) | |
tree | 59649da06fa27294415cba4aaf3bcb560e7dc37d /gcc/cp/decl2.c | |
parent | 63fa0927e8aba59b1a301f7d13f5cd0e6bb62a66 (diff) | |
download | gcc-0f32c94fc72313798b3a9033c92ceb34f7b7febc.zip gcc-0f32c94fc72313798b3a9033c92ceb34f7b7febc.tar.gz gcc-0f32c94fc72313798b3a9033c92ceb34f7b7febc.tar.bz2 |
c++: More cleanups for modern C++
Here are some more places where we can declare variables at the
assignment point, rather than use C89. Also, let's name our variables
by what they contain -- the register allocator is perfectly able to
track liveness for us.
gcc/cp/
* decl.c (decls_match): Move variables into scopes
they're needed in.
(duplicate_decls): Use STRIP_TEMPLATE.
(build_typename_type): Move var decls to their assignments.
(begin_function_body): Likewise.
* decl2.c (get_guard): Likewise.
(mark_used): Use true for truthiness.
* error.c (dump_aggr_type): Hold the decl in a var called
'decl', not 'name'.
Diffstat (limited to 'gcc/cp/decl2.c')
-rw-r--r-- | gcc/cp/decl2.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 5bada50..33c8377 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -3294,11 +3294,8 @@ copy_linkage (tree guard, tree decl) tree get_guard (tree decl) { - tree sname; - tree guard; - - sname = mangle_guard_variable (decl); - guard = get_global_binding (sname); + tree sname = mangle_guard_variable (decl); + tree guard = get_global_binding (sname); if (! guard) { tree guard_type; @@ -5536,10 +5533,11 @@ mark_used (tree decl, tsubst_flags_t complain) return true; /* Set TREE_USED for the benefit of -Wunused. */ - TREE_USED (decl) = 1; + TREE_USED (decl) = true; + /* And for structured bindings also the underlying decl. */ if (DECL_DECOMPOSITION_P (decl) && DECL_DECOMP_BASE (decl)) - TREE_USED (DECL_DECOMP_BASE (decl)) = 1; + TREE_USED (DECL_DECOMP_BASE (decl)) = true; if (TREE_CODE (decl) == TEMPLATE_DECL) return true; |