decl.c (grokdeclarator): Restore error messages about __thread.
authorMark Mitchell <mark@codesourcery.com>
Fri, 25 Jun 2004 04:48:53 +0000 (04:48 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Fri, 25 Jun 2004 04:48:53 +0000 (04:48 +0000)
* decl.c (grokdeclarator): Restore error messages about __thread.
* parser.c (cp_parser_decl_specifier_seq): Likewise.

From-SVN: r83636

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/parser.c

index fee6c9a122340f64ad660e6c92dbbd01d41d0e57..0063722b879fb2db35a9c441f918eec5d52c541c 100644 (file)
@@ -1,3 +1,8 @@
+2004-06-24  Mark Mitchell  <mark@codesourcery.com>
+
+       * decl.c (grokdeclarator): Restore error messages about __thread.
+       * parser.c (cp_parser_decl_specifier_seq): Likewise.
+
 2004-06-24  Jason Merrill  <jason@redhat.com>
 
        PR c++/16115
index 2798440816f068c76304e4a29fac6ee3fcbcf269..5f7fb81ee06910b7c379c247ac44b928576c8e68 100644 (file)
@@ -6545,7 +6545,25 @@ grokdeclarator (const cp_declarator *declarator,
            longlong = 1;
        } 
       else if (declspecs->specs[(int)ds] > 1)
-       error ("duplicate decl-specifier");
+       {
+         static const char *decl_spec_names[] = {
+           "signed",
+           "unsigned",
+           "short",
+           "long",
+           "const",
+           "volatile",
+           "restrict",
+           "inline",
+           "virtual",
+           "explicit",
+           "friend",
+           "typedef",
+           "__complex",
+           "__thread"
+         };
+         error ("duplicate `%s'", decl_spec_names[(int)ds]);
+       }
     }
 
 #if 0
@@ -6796,9 +6814,19 @@ grokdeclarator (const cp_declarator *declarator,
      kinds of declarations (parameters, typenames, etc.).  */
   if (declspecs->multiple_storage_classes_p)
     error ("multiple storage classes in declaration of `%s'", name);
+  else if (declspecs->specs[(int)ds_thread]
+          && ((declspecs->storage_class 
+               && declspecs->storage_class != sc_extern
+               && declspecs->storage_class != sc_static)
+              || declspecs->specs[(int)ds_typedef]))
+    {
+      error ("multiple storage classes in declaration of `%s'", name);
+      declspecs->specs[(int)ds_thread] = 0;
+    }
   else if (decl_context != NORMAL 
-          && declspecs->storage_class != sc_none
-          && declspecs->storage_class != sc_mutable)
+          && ((declspecs->storage_class != sc_none
+               && declspecs->storage_class != sc_mutable)
+              || declspecs->specs[(int)ds_thread]))
     {
       if ((decl_context == PARM || decl_context == CATCHPARM)
          && (declspecs->storage_class == sc_register
index ffaf0c85c99ca7958c9b52d71a202466885660ad..346ad1cabcff2e7de7daa03f51ae0d8af9769c71 100644 (file)
@@ -7200,17 +7200,21 @@ cp_parser_decl_specifier_seq (cp_parser* parser,
          /* Consume the token.  */
          cp_lexer_consume_token (parser->lexer);
          if (decl_specs->specs[(int) ds_thread])
-           error ("`__thread' before `static'");
-         else
-           cp_parser_set_storage_class (decl_specs, sc_static);
+           {
+             error ("`__thread' before `static'");
+             decl_specs->specs[(int) ds_thread] = 0;
+           }
+         cp_parser_set_storage_class (decl_specs, sc_static);
          break;
        case RID_EXTERN:
          /* Consume the token.  */
          cp_lexer_consume_token (parser->lexer);
          if (decl_specs->specs[(int) ds_thread])
-           error ("`__thread' before `extern'");
-         else
-           cp_parser_set_storage_class (decl_specs, sc_extern);
+           {
+             error ("`__thread' before `extern'");
+             decl_specs->specs[(int) ds_thread] = 0;
+           }
+         cp_parser_set_storage_class (decl_specs, sc_extern);
          break;
        case RID_MUTABLE:
          /* Consume the token.  */