diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2002-08-15 21:16:23 +0000 |
---|---|---|
committer | Alexandre Oliva <aoliva@gcc.gnu.org> | 2002-08-15 21:16:23 +0000 |
commit | 25587e40f5d35cc73b6351b140e4c3d90aed8f7c (patch) | |
tree | be917cdfeaeec953b25fe411d7db833f292e9f3a /gcc | |
parent | 0053afb9651947ee0bb421501ba71f042981dcae (diff) | |
download | gcc-25587e40f5d35cc73b6351b140e4c3d90aed8f7c.zip gcc-25587e40f5d35cc73b6351b140e4c3d90aed8f7c.tar.gz gcc-25587e40f5d35cc73b6351b140e4c3d90aed8f7c.tar.bz2 |
c-tree.h (skip_evaluation): Move declaration...
* c-tree.h (skip_evaluation): Move declaration...
* c-common.h: ... here.
* c-typeck.c (build_external_ref): Don't assemble_external nor
mark a tree as used if skip_evaluation is set.
* c-parse.in (typeof): New non-terminal to set skip_evaluation
around TYPEOF.
(typespec_nonreserved_nonattr): Use it.
From-SVN: r56358
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/c-common.h | 5 | ||||
-rw-r--r-- | gcc/c-parse.in | 12 | ||||
-rw-r--r-- | gcc/c-tree.h | 5 | ||||
-rw-r--r-- | gcc/c-typeck.c | 3 |
5 files changed, 25 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7d618c3..015b240 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2002-08-15 Alexandre Oliva <aoliva@redhat.com> + + * c-tree.h (skip_evaluation): Move declaration... + * c-common.h: ... here. + * c-typeck.c (build_external_ref): Don't assemble_external nor + mark a tree as used if skip_evaluation is set. + * c-parse.in (typeof): New non-terminal to set skip_evaluation + around TYPEOF. + (typespec_nonreserved_nonattr): Use it. + 2002-08-15 Douglas B Rupp <rupp@gnat.com> * dbxout.c (dbx_debug_hooks): Update end_prologue, end_epilogue. diff --git a/gcc/c-common.h b/gcc/c-common.h index 038b239..6968d70 100644 --- a/gcc/c-common.h +++ b/gcc/c-common.h @@ -790,6 +790,11 @@ extern int warn_deprecated; extern int max_tinst_depth; +/* Nonzero means the expression being parsed will never be evaluated. + This is a count, since unevaluated expressions can nest. */ + +extern int skip_evaluation; + /* C types are partitioned into three subsets: object, function, and incomplete types. */ #define C_TYPE_OBJECT_P(type) \ diff --git a/gcc/c-parse.in b/gcc/c-parse.in index 11e0e44..eab176a 100644 --- a/gcc/c-parse.in +++ b/gcc/c-parse.in @@ -562,6 +562,10 @@ alignof: ALIGNOF { skip_evaluation++; } ; +typeof: + TYPEOF { skip_evaluation++; } + ; + cast_expr: unary_expr | '(' typename ')' cast_expr %prec UNARY @@ -1394,10 +1398,10 @@ ifobjc | non_empty_protocolrefs { $$ = get_object_reference ($1); } end ifobjc - | TYPEOF '(' expr ')' - { $$ = TREE_TYPE ($3); } - | TYPEOF '(' typename ')' - { $$ = groktypename ($3); } + | typeof '(' expr ')' + { skip_evaluation--; $$ = TREE_TYPE ($3); } + | typeof '(' typename ')' + { skip_evaluation--; $$ = groktypename ($3); } ; /* typespec_nonreserved_attr does not exist. */ diff --git a/gcc/c-tree.h b/gcc/c-tree.h index c92f1f1..0d6829f 100644 --- a/gcc/c-tree.h +++ b/gcc/c-tree.h @@ -311,11 +311,6 @@ extern int current_function_returns_null; extern int current_function_returns_abnormally; -/* Nonzero means the expression being parsed will never be evaluated. - This is a count, since unevaluated expressions can nest. */ - -extern int skip_evaluation; - /* Nonzero means we are reading code that came from a system header file. */ extern int system_header_p; diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index dedb72f..bfc4484 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -1441,7 +1441,8 @@ build_external_ref (id, fun) if (TREE_TYPE (ref) == error_mark_node) return error_mark_node; - assemble_external (ref); + if (!skip_evaluation) + assemble_external (ref); TREE_USED (ref) = 1; if (TREE_CODE (ref) == CONST_DECL) |