diff options
author | obrien <obrien@FreeBSD.org> | 2002-12-04 16:13:54 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2002-12-04 16:13:54 +0000 |
commit | ddc99173dfeb2896a4211b68ef3cfb13c512b00d (patch) | |
tree | 6624c99c05abd0c5b4279cdb8a377f37d7ccff23 /contrib | |
parent | ed69fd7f3740bfed57cca78477178e189eb445e1 (diff) | |
download | FreeBSD-src-ddc99173dfeb2896a4211b68ef3cfb13c512b00d.zip FreeBSD-src-ddc99173dfeb2896a4211b68ef3cfb13c512b00d.tar.gz |
Merge rev 1.8 (printf format error fixes) into Gcc 3.2.1 release.
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/gcc/cp/decl.c | 64 |
1 files changed, 39 insertions, 25 deletions
diff --git a/contrib/gcc/cp/decl.c b/contrib/gcc/cp/decl.c index 4a48b5e..6d4e0d2 100644 --- a/contrib/gcc/cp/decl.c +++ b/contrib/gcc/cp/decl.c @@ -3509,7 +3509,6 @@ duplicate_decls (newdecl, olddecl) except for any that we copy here from the old type. */ DECL_ATTRIBUTES (newdecl) = (*targetm.merge_decl_attributes) (olddecl, newdecl); - decl_attributes (&newdecl, DECL_ATTRIBUTES (newdecl), 0); if (TREE_CODE (newdecl) == TEMPLATE_DECL) { @@ -5769,6 +5768,12 @@ make_typename_type (context, name, complain) t = lookup_field (context, name, 0, 1); if (t) { + if (TREE_CODE (t) != TYPE_DECL) + { + if (complain & tf_error) + error ("no type named `%#T' in `%#T'", name, context); + return error_mark_node; + } if (DECL_ARTIFICIAL (t) || !(complain & tf_keep_type_decl)) t = TREE_TYPE (t); if (IMPLICIT_TYPENAME_P (t)) @@ -7337,7 +7342,7 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes) switch (TREE_CODE (decl)) { case TYPE_DECL: - error ("typedef `%D' is initialized", decl); + error ("typedef `%D' is initialized (use __typeof__ instead)", decl); initialized = 0; break; @@ -8035,6 +8040,12 @@ maybe_inject_for_scope_var (decl) { if (!DECL_NAME (decl)) return; + + /* Declarations of __FUNCTION__ and its ilk appear magically when + the variable is first used. If that happens to be inside a + for-loop, we don't want to do anything special. */ + if (DECL_PRETTY_FUNCTION_P (decl)) + return; if (current_binding_level->is_for_scope) { @@ -10069,6 +10080,16 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) next = 0; break; + case TEMPLATE_DECL: + /* Sometimes, we see a template-name used as part of a + decl-specifier like in + std::allocator alloc; + Handle that gracefully. */ + error ("invalid use of template-name '%E' in a declarator", + decl); + return error_mark_node; + break; + default: internal_error ("`%D' as declarator", decl); } @@ -10709,19 +10730,6 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) type = create_array_type_for_decl (dname, type, size); - /* VLAs never work as fields. */ - if (decl_context == FIELD && !processing_template_decl - && TREE_CODE (type) == ARRAY_TYPE - && TYPE_DOMAIN (type) != NULL_TREE - && !TREE_CONSTANT (TYPE_MAX_VALUE (TYPE_DOMAIN (type)))) - { - error ("size of member `%D' is not constant", dname); - /* Proceed with arbitrary constant size, so that offset - computations don't get confused. */ - type = create_array_type_for_decl (dname, TREE_TYPE (type), - integer_one_node); - } - ctype = NULL_TREE; } break; @@ -11028,8 +11036,9 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) pop_decl_namespace (); else if (friendp && (TREE_COMPLEXITY (declarator) < 2)) /* Don't fall out into global scope. Hides real bug? --eichin */ ; - else if (! IS_AGGR_TYPE_CODE - (TREE_CODE (TREE_OPERAND (declarator, 0)))) + else if (!TREE_OPERAND (declarator, 0) + || !IS_AGGR_TYPE_CODE + (TREE_CODE (TREE_OPERAND (declarator, 0)))) ; else if (TREE_COMPLEXITY (declarator) == current_class_depth) { @@ -11209,6 +11218,14 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) type = error_mark_node; } + if (decl_context == FIELD + && !processing_template_decl + && variably_modified_type_p (type)) + { + error ("data member may not have variably modified type `%T'", type); + type = error_mark_node; + } + if (explicitp == 1 || (explicitp && friendp)) { /* [dcl.fct.spec] The explicit specifier shall only be used in @@ -14110,6 +14127,10 @@ finish_destructor_body () { tree exprstmt; + /* Any return from a destructor will end up here; that way all base + and member cleanups will be run when the function returns. */ + add_stmt (build_stmt (LABEL_STMT, dtor_label)); + /* And perform cleanups for our bases and members. */ perform_base_cleanups (); @@ -14185,14 +14206,7 @@ void finish_function_body (compstmt) tree compstmt; { - if (processing_template_decl) - /* Do nothing now. */; - else if (DECL_DESTRUCTOR_P (current_function_decl)) - /* Any return from a destructor will end up here. Put it before the - cleanups so that an explicit return doesn't duplicate them. */ - add_stmt (build_stmt (LABEL_STMT, dtor_label)); - - /* Close the block; in a destructor, run the member cleanups. */ + /* Close the block. */ finish_compound_stmt (0, compstmt); if (processing_template_decl) |