diff options
author | Nathan Sidwell <nathan@acm.org> | 2020-11-02 10:28:52 -0800 |
---|---|---|
committer | Nathan Sidwell <nathan@acm.org> | 2020-11-02 10:34:31 -0800 |
commit | d6912d9b17f9f29a488b64f005649151ef9c794c (patch) | |
tree | 3798c5828f72712f6e2126fbef33fa1954bc9b76 /gcc | |
parent | 9757d793f800a9ea1e35977b7e9e68d6f293e857 (diff) | |
download | gcc-d6912d9b17f9f29a488b64f005649151ef9c794c.zip gcc-d6912d9b17f9f29a488b64f005649151ef9c794c.tar.gz gcc-d6912d9b17f9f29a488b64f005649151ef9c794c.tar.bz2 |
c++: Fixup some vardecls and whitespace
Move some var decls to their initializers. Correct some whitespace.
gcc/cp/
* decl.c (start_decl_1): Refactor declarations. Fixup some
whitespace.
(lookup_and_check_tag): Fixup some whitespace.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/decl.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 3846e82..114e8d0 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -138,7 +138,7 @@ static location_t smallest_type_location (const cp_decl_specifier_seq*); tree cp_global_trees[CPTI_MAX]; /* A list of objects which have constructors or destructors - which reside in the global scope. The decl is stored in + which reside in namespace scope. The decl is stored in the TREE_VALUE slot and the initializer is stored in the TREE_PURPOSE slot. */ tree static_aggregates; @@ -5458,20 +5458,17 @@ start_decl (const cp_declarator *declarator, void start_decl_1 (tree decl, bool initialized) { - tree type; - bool complete_p; - bool aggregate_definition_p; - - gcc_assert (!processing_template_decl); + gcc_checking_assert (!processing_template_decl); if (error_operand_p (decl)) return; - gcc_assert (VAR_P (decl)); + gcc_checking_assert (VAR_P (decl)); - type = TREE_TYPE (decl); - complete_p = COMPLETE_TYPE_P (type); - aggregate_definition_p = MAYBE_CLASS_TYPE_P (type) && !DECL_EXTERNAL (decl); + tree type = TREE_TYPE (decl); + bool complete_p = COMPLETE_TYPE_P (type); + bool aggregate_definition_p + = MAYBE_CLASS_TYPE_P (type) && !DECL_EXTERNAL (decl); /* If an explicit initializer is present, or if this is a definition of an aggregate, then we need a complete type at this point. @@ -5496,6 +5493,7 @@ start_decl_1 (tree decl, bool initialized) : TCTX_STATIC_STORAGE); verify_type_context (input_location, context, TREE_TYPE (decl)); } + if (initialized) /* Is it valid for this decl to have an initializer at all? */ { @@ -14877,7 +14875,6 @@ lookup_and_check_tag (enum tag_types tag_code, tree name, else decl = lookup_elaborated_type (name, how); - if (!decl) /* We found nothing. */ return NULL_TREE; @@ -14898,8 +14895,8 @@ lookup_and_check_tag (enum tag_types tag_code, tree name, if (TREE_CODE (decl) != TYPE_DECL) /* Found not-a-type. */ return NULL_TREE; - - /* Look for invalid nested type: + + /* Look for invalid nested type: class C { class C {}; }; */ |