]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
parse.y (TYPENAME): Rename as tTYPENAME to avoid the clash with decl.h's TYPENAME.
authorAkim Demaille <akim@epita.fr>
Thu, 27 May 2010 20:00:57 +0000 (22:00 +0200)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 27 May 2010 20:00:57 +0000 (16:00 -0400)
* parse.y (TYPENAME): Rename as tTYPENAME to avoid the clash with
decl.h's TYPENAME.
* spew.c, lex.c: Adjust.
* parse.y (explicit_instantiation): Add empty action to override
the default $$ = $1 where it introduces a type clash.

From-SVN: r159944

gcc/cp/ChangeLog
gcc/cp/lex.c
gcc/cp/parse.y
gcc/cp/spew.c

index 7203e127f06381d839b953dba4ac2d48f4f00f32..e8aa3add9c095315ce33e9d4d45d25f49f3859f2 100644 (file)
@@ -1,3 +1,11 @@
+2002-06-19  Akim Demaille  <akim@epita.fr>
+
+       * parse.y (TYPENAME): Rename as tTYPENAME to avoid the clash with
+       decl.h's TYPENAME.
+       * spew.c, lex.c: Adjust.
+       * parse.y (explicit_instantiation): Add empty action to override
+       the default $$ = $1 where it introduces a type clash.
+
 2002-04-06  Jason Merrill  <jason@redhat.com>
 
        PR c++/4934
index e2b18b4be36cfeb860ed78df8d9b2d6a4982b66d..2aaae16cffebec772716cc850573728898df93eb 100644 (file)
@@ -94,10 +94,11 @@ extern YYSTYPE yylval;              /*  the semantic value of the           */
 int warn_traditional = 0;
 int flag_digraphs = 1;
 
-/* the declaration found for the last IDENTIFIER token read in.
-   yylex must look this up to detect typedefs, which get token type TYPENAME,
-   so it is left around in case the identifier is not a typedef but is
-   used in a context which makes it a reference to a variable.  */
+/* the declaration found for the last IDENTIFIER token read in.  yylex
+   must look this up to detect typedefs, which get token type
+   tTYPENAME, so it is left around in case the identifier is not a
+   typedef but is used in a context which makes it a reference to a
+   variable.  */
 tree lastiddecl;
 
 /* Array for holding counts of the numbers of tokens seen.  */
@@ -768,7 +769,7 @@ yyprint (file, yychar, yylval)
   switch (yychar)
     {
     case IDENTIFIER:
-    case TYPENAME:
+    case tTYPENAME:
     case TYPESPEC:
     case PTYPENAME:
     case PFUNCNAME:
@@ -1009,7 +1010,7 @@ check_for_missing_semicolon (type)
   if ((yychar > 255
        && yychar != SCSPEC
        && yychar != IDENTIFIER
-       && yychar != TYPENAME
+       && yychar != tTYPENAME
        && yychar != CV_QUALIFIER
        && yychar != SELFNAME)
       || yychar == 0  /* EOF */)
index 1ce797cd35b7f7898acb0a3f832be53e7bdc38e3..2db154a101301a8d36853720a1780af1d67c7428 100644 (file)
@@ -237,7 +237,7 @@ cp_parse_init ()
 /* All identifiers that are declared typedefs in the current block.
    In some contexts, they are treated just like IDENTIFIER,
    but they can also serve as typespecs in declarations.  */
-%token TYPENAME
+%token tTYPENAME
 %token SELFNAME
 
 /* A template function.  */
@@ -295,7 +295,7 @@ cp_parse_init ()
 %nonassoc IF
 %nonassoc ELSE
 
-%left IDENTIFIER PFUNCNAME TYPENAME SELFNAME PTYPENAME SCSPEC TYPESPEC CV_QUALIFIER ENUM AGGR ELLIPSIS TYPEOF SIGOF OPERATOR NSNAME TYPENAME_KEYWORD
+%left IDENTIFIER PFUNCNAME tTYPENAME SELFNAME PTYPENAME SCSPEC TYPESPEC CV_QUALIFIER ENUM AGGR ELLIPSIS TYPEOF SIGOF OPERATOR NSNAME TYPENAME_KEYWORD
 
 %left '{' ',' ';'
 
@@ -325,7 +325,7 @@ cp_parse_init ()
 
 %type <code> unop
 
-%type <ttype> identifier IDENTIFIER TYPENAME CONSTANT expr nonnull_exprlist
+%type <ttype> identifier IDENTIFIER tTYPENAME CONSTANT expr nonnull_exprlist
 %type <ttype> PFUNCNAME maybe_identifier
 %type <ttype> paren_expr_or_null nontrivial_exprlist SELFNAME
 %type <ttype> expr_no_commas expr_no_comma_rangle
@@ -956,7 +956,7 @@ member_init:
 
 identifier:
          IDENTIFIER
-       | TYPENAME
+       | tTYPENAME
        | SELFNAME
        | PTYPENAME
        | NSNAME
@@ -993,17 +993,21 @@ explicit_instantiation:
                { do_type_instantiation ($4.t, $1, 1);
                  yyungetc (';', 1); }
           end_explicit_instantiation
+               {}
        | SCSPEC TEMPLATE begin_explicit_instantiation typed_declspecs 
           declarator
                { tree specs = strip_attrs ($4.t);
                  do_decl_instantiation (specs, $5, $1); }
           end_explicit_instantiation
+               {}
        | SCSPEC TEMPLATE begin_explicit_instantiation notype_declarator
                { do_decl_instantiation (NULL_TREE, $4, $1); }
           end_explicit_instantiation
+               {}
        | SCSPEC TEMPLATE begin_explicit_instantiation constructor_declarator
                { do_decl_instantiation (NULL_TREE, $4, $1); }
           end_explicit_instantiation
+               {}
        ;
 
 begin_explicit_instantiation: 
@@ -1020,7 +1024,7 @@ template_type:
          PTYPENAME '<' template_arg_list_opt template_close_bracket
            .finish_template_type
                 { $$ = $5; }
-       | TYPENAME  '<' template_arg_list_opt template_close_bracket
+       | tTYPENAME  '<' template_arg_list_opt template_close_bracket
            .finish_template_type
                 { $$ = $5; }
        | self_template_type
@@ -1487,7 +1491,7 @@ object_template_id:
 
 unqualified_id:
          notype_unqualified_id
-       | TYPENAME
+       | tTYPENAME
        | SELFNAME
        ;
 
@@ -2706,7 +2710,7 @@ after_type_component_declarator0:
          after_type_declarator maybeasm maybe_attribute maybe_init
                { $$ = parse_field0 ($1, $<ftype>0.t, $<ftype>0.lookups,
                                     $3, $2, $4); }
-       | TYPENAME ':' expr_no_commas maybe_attribute
+       | tTYPENAME ':' expr_no_commas maybe_attribute
                { $$ = parse_bitfield0 ($1, $<ftype>0.t, $<ftype>0.lookups,
                                        $4, $3); }
        ;
@@ -2729,7 +2733,7 @@ notype_component_declarator0:
 after_type_component_declarator:
          after_type_declarator maybeasm maybe_attribute maybe_init
                { $$ = parse_field ($1, $3, $2, $4); }
-       | TYPENAME ':' expr_no_commas maybe_attribute
+       | tTYPENAME ':' expr_no_commas maybe_attribute
                { $$ = parse_bitfield ($1, $4, $3); }
        ;
 
@@ -2995,7 +2999,7 @@ functional_cast:
        ;
 
 type_name:
-         TYPENAME
+         tTYPENAME
        | SELFNAME
        | template_type  %prec EMPTY
        ;
@@ -3012,7 +3016,7 @@ nested_name_specifier:
 /* Why the @#$%^& do type_name and notype_identifier need to be expanded
    inline here?!?  (jason) */
 nested_name_specifier_1:
-         TYPENAME SCOPE
+         tTYPENAME SCOPE
                {
                  if (TREE_CODE ($1) == IDENTIFIER_NODE)
                    {
@@ -3108,7 +3112,7 @@ typename_sub1:
 /* This needs to return a TYPE_DECL for simple names so that we don't
    forget what name was used.  */
 typename_sub2:
-         TYPENAME SCOPE
+         tTYPENAME SCOPE
                {
                  if (TREE_CODE ($1) != TYPE_DECL)
                    $$ = lastiddecl;
@@ -3542,7 +3546,7 @@ label_colon:
                 { finish_label_stmt ($1); }
        | PTYPENAME ':'
                 { finish_label_stmt ($1); }
-       | TYPENAME ':'
+       | tTYPENAME ':'
                 { finish_label_stmt ($1); }
        | SELFNAME ':'
                 { finish_label_stmt ($1); }
index c47c6a505ca5f65920cd604ca074cb35f2cc53ae..b5d8a72a6d7db344f01b02ddbf45a8c8ae75e8d0 100644 (file)
@@ -143,10 +143,11 @@ static enum cpp_ttype last_token;
 static tree last_token_id;
 
 /* From lex.c: */
-/* the declaration found for the last IDENTIFIER token read in.
-   yylex must look this up to detect typedefs, which get token type TYPENAME,
-   so it is left around in case the identifier is not a typedef but is
-   used in a context which makes it a reference to a variable.  */
+/* the declaration found for the last IDENTIFIER token read in.  yylex
+   must look this up to detect typedefs, which get token type
+   tTYPENAME, so it is left around in case the identifier is not a
+   typedef but is used in a context which makes it a reference to a
+   variable.  */
 extern tree lastiddecl;                /* let our brains leak out here too */
 extern int     yychar;         /*  the lookahead symbol                */
 extern YYSTYPE yylval;         /*  the semantic value of the           */
@@ -642,11 +643,11 @@ identifier_type (decl)
   if (t && t == decl)
     return SELFNAME;
 
-  return TYPENAME;
+  return tTYPENAME;
 }
 
 /* token[0] == AGGR (struct/union/enum)
-   Thus, token[1] is either a TYPENAME or a TYPENAME_DEFN.
+   Thus, token[1] is either a tTYPENAME or a TYPENAME_DEFN.
    If token[2] == '{' or ':' then it's TYPENAME_DEFN.
    It's also a definition if it's a forward declaration (as in 'struct Foo;')
    which we can tell if token[2] == ';' *and* token[-1] != FRIEND or NEW.  */
@@ -658,7 +659,7 @@ do_aggr ()
   
   scan_tokens (2);
   yc1 = nth_token (1)->yychar;
-  if (yc1 != TYPENAME && yc1 != IDENTIFIER && yc1 != PTYPENAME)
+  if (yc1 != tTYPENAME && yc1 != IDENTIFIER && yc1 != PTYPENAME)
     return;
   yc2 = nth_token (2)->yychar;
   if (yc2 == ';')
@@ -673,7 +674,7 @@ do_aggr ()
 
   switch (yc1)
     {
-    case TYPENAME:
+    case tTYPENAME:
       nth_token (1)->yychar = TYPENAME_DEFN;
       break;
     case PTYPENAME:
@@ -771,7 +772,7 @@ yylex ()
       break;
     }
     case IDENTIFIER_DEFN:
-    case TYPENAME:
+    case tTYPENAME:
     case TYPENAME_DEFN:
     case PTYPENAME:
     case PTYPENAME_DEFN:
@@ -911,7 +912,7 @@ frob_id (yyc, peek, idp)
       yyc = identifier_type (trrr);
       switch(yyc)
         {
-          case TYPENAME:
+          case tTYPENAME:
           case SELFNAME:
           case NSNAME:
           case PTYPENAME:
@@ -1456,7 +1457,7 @@ debug_yychar (yy)
 {
   if (yy<256)
     fprintf (stderr, "->%d < %c >\n", lineno, yy);
-  else if (yy == IDENTIFIER || yy == TYPENAME)
+  else if (yy == IDENTIFIER || yy == tTYPENAME)
     {
       const char *id;
       if (TREE_CODE (yylval.ttype) == IDENTIFIER_NODE)