diff options
Diffstat (limited to 'contrib/gcc/cp')
-rw-r--r-- | contrib/gcc/cp/ChangeLog | 17 | ||||
-rw-r--r-- | contrib/gcc/cp/cp-lang.c | 10 | ||||
-rw-r--r-- | contrib/gcc/cp/decl.c | 3 | ||||
-rw-r--r-- | contrib/gcc/cp/decl2.c | 3 | ||||
-rw-r--r-- | contrib/gcc/cp/parse.y | 42 |
5 files changed, 54 insertions, 21 deletions
diff --git a/contrib/gcc/cp/ChangeLog b/contrib/gcc/cp/ChangeLog index e7c5b8c..f75f91f 100644 --- a/contrib/gcc/cp/ChangeLog +++ b/contrib/gcc/cp/ChangeLog @@ -1,3 +1,20 @@ +2002-09-04 Jakub Jelinek <jakub@redhat.com> + + * decl.c (start_cleanup_fn): Clear interface_only before + start_function, restore it afterwards. + +2002-09-01 Alexandre Oliva <aoliva@redhat.com> + + * parse.y (sizeof, alignof, typeof): New non-terminals to + increment skip_evaluation. Replace terminals with them and + decrement skip_evaluation at the end of rules using them. + * decl2.c (mark_used): Don't assemble_external if + skipping evaluation. + +2002-08-31 Jason Merrill <jason@redhat.com> + + * cp-lang.c (cp_expr_size): Don't abort. + 2002-08-27 Mark Mitchell <mark@codesourcery.com> * cp-tree.h (warn_abi): Declare it. diff --git a/contrib/gcc/cp/cp-lang.c b/contrib/gcc/cp/cp-lang.c index 7b1d860..b573cce 100644 --- a/contrib/gcc/cp/cp-lang.c +++ b/contrib/gcc/cp/cp-lang.c @@ -122,14 +122,8 @@ cp_expr_size (exp) { if (CLASS_TYPE_P (TREE_TYPE (exp))) { - /* The backend should not be interested in the size of an expression - of a type with both of these set; all copies of such types must go - through a constructor or assignment op. */ - if (TYPE_HAS_COMPLEX_INIT_REF (TREE_TYPE (exp)) - && TYPE_HAS_COMPLEX_ASSIGN_REF (TREE_TYPE (exp))) - abort (); - /* This would be wrong for a type with virtual bases, but they are - caught by the abort above. */ + /* This would be wrong for a type with virtual bases, but they should + not get here. */ return CLASSTYPE_SIZE_UNIT (TREE_TYPE (exp)); } else diff --git a/contrib/gcc/cp/decl.c b/contrib/gcc/cp/decl.c index 82ec357..105e7a0 100644 --- a/contrib/gcc/cp/decl.c +++ b/contrib/gcc/cp/decl.c @@ -8515,6 +8515,7 @@ static tree start_cleanup_fn () { static int counter = 0; + int old_interface_only = interface_only; int old_interface_unknown = interface_unknown; char name[32]; tree parmtypes; @@ -8526,6 +8527,7 @@ start_cleanup_fn () /* No need to mangle this. */ push_lang_context (lang_name_c); + interface_only = 0; interface_unknown = 1; /* Build the parameter-types. */ @@ -8567,6 +8569,7 @@ start_cleanup_fn () start_function (/*specs=*/NULL_TREE, fndecl, NULL_TREE, SF_PRE_PARSED); interface_unknown = old_interface_unknown; + interface_only = old_interface_only; pop_lang_context (); diff --git a/contrib/gcc/cp/decl2.c b/contrib/gcc/cp/decl2.c index 09a30f4..0eb4799 100644 --- a/contrib/gcc/cp/decl2.c +++ b/contrib/gcc/cp/decl2.c @@ -5186,7 +5186,8 @@ mark_used (decl) TREE_USED (decl) = 1; if (processing_template_decl) return; - assemble_external (decl); + if (!skip_evaluation) + assemble_external (decl); /* Is it a synthesized method that needs to be synthesized? */ if (TREE_CODE (decl) == FUNCTION_DECL diff --git a/contrib/gcc/cp/parse.y b/contrib/gcc/cp/parse.y index d1e3761..6782621 100644 --- a/contrib/gcc/cp/parse.y +++ b/contrib/gcc/cp/parse.y @@ -1255,16 +1255,20 @@ unary_expr: /* Refer to the address of a label as a pointer. */ | ANDAND identifier { $$ = finish_label_address_expr ($2); } - | SIZEOF unary_expr %prec UNARY - { $$ = finish_sizeof ($2); } - | SIZEOF '(' type_id ')' %prec HYPERUNARY + | sizeof unary_expr %prec UNARY + { $$ = finish_sizeof ($2); + skip_evaluation--; } + | sizeof '(' type_id ')' %prec HYPERUNARY { $$ = finish_sizeof (groktypename ($3.t)); - check_for_new_type ("sizeof", $3); } - | ALIGNOF unary_expr %prec UNARY - { $$ = finish_alignof ($2); } - | ALIGNOF '(' type_id ')' %prec HYPERUNARY + check_for_new_type ("sizeof", $3); + skip_evaluation--; } + | alignof unary_expr %prec UNARY + { $$ = finish_alignof ($2); + skip_evaluation--; } + | alignof '(' type_id ')' %prec HYPERUNARY { $$ = finish_alignof (groktypename ($3.t)); - check_for_new_type ("alignof", $3); } + check_for_new_type ("alignof", $3); + skip_evaluation--; } /* The %prec EMPTY's here are required by the = init initializer syntax extension; see below. */ @@ -1989,6 +1993,18 @@ reserved_typespecquals: { $$ = tree_cons ($1, NULL_TREE, NULL_TREE); } ; +sizeof: + SIZEOF { skip_evaluation++; } + ; + +alignof: + ALIGNOF { skip_evaluation++; } + ; + +typeof: + TYPEOF { skip_evaluation++; } + ; + /* A typespec (but not a type qualifier). Once we have seen one of these in a declaration, if a typedef name appears then it is being redeclared. */ @@ -2000,12 +2016,14 @@ typespec: { $$.t = $1; $$.new_type_flag = 0; $$.lookups = NULL_TREE; } | complete_type_name { $$.t = $1; $$.new_type_flag = 0; $$.lookups = NULL_TREE; } - | TYPEOF '(' expr ')' + | typeof '(' expr ')' { $$.t = finish_typeof ($3); - $$.new_type_flag = 0; $$.lookups = NULL_TREE; } - | TYPEOF '(' type_id ')' + $$.new_type_flag = 0; $$.lookups = NULL_TREE; + skip_evaluation--; } + | typeof '(' type_id ')' { $$.t = groktypename ($3.t); - $$.new_type_flag = 0; $$.lookups = NULL_TREE; } + $$.new_type_flag = 0; $$.lookups = NULL_TREE; + skip_evaluation--; } | SIGOF '(' expr ')' { tree type = TREE_TYPE ($3); |