]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c-tree.h (skip_evaluation): Move declaration...
authorAlexandre Oliva <aoliva@redhat.com>
Sun, 1 Sep 2002 20:11:07 +0000 (20:11 +0000)
committerAlexandre Oliva <aoliva@gcc.gnu.org>
Sun, 1 Sep 2002 20:11:07 +0000 (20:11 +0000)
* 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: r56727

gcc/ChangeLog
gcc/c-common.h
gcc/c-parse.in
gcc/c-tree.h
gcc/c-typeck.c

index 430f1c2d28a659e9f0e5fd0399baf9ff3e370835..45978d6f7adbbb85f00bb67bc4cd22fb5de6ff96 100644 (file)
@@ -1,3 +1,13 @@
+2002-09-01  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-09-01  Marek Michalkiewicz  <marekm@amelek.gda.pl>
 
        2002-08-13  Denis Chertykov  <denisc@overta.ru>
index df74f2e430267f2457f920fd1282171e9dbaad61..61a7f107f324b1c26f620db96f0012e998b9732f 100644 (file)
@@ -464,6 +464,11 @@ extern int warn_conversion;
 
 extern int warn_long_long;
 
+/* 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) \
index 9740aa376669171f39f76ba363e4f68e111d9e61..c7cbb16d38ec3e2cada74fdc616284524d6788db 100644 (file)
@@ -534,6 +534,10 @@ alignof:
        ALIGNOF { skip_evaluation++; }
        ;
 
+typeof:
+       TYPEOF { skip_evaluation++; }
+       ;
+
 cast_expr:
        unary_expr
        | '(' typename ')' cast_expr  %prec UNARY
@@ -1376,10 +1380,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.  */
index 999bc2f0af0e297862bebbc69243d63051c7257b..54208db58c0a677ea4cd72f1ce667c707a97ee3b 100644 (file)
@@ -287,11 +287,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 `$' can be in an identifier.  */
 
 extern int dollars_in_ident;
index b21cac0bfb0b616b24283c2f2407bdb5902ee7de..d400f3969b68d46ec15a9d4a901d5f3f1fc739fd 100644 (file)
@@ -1493,7 +1493,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)