From f1b90a04e0f8e682a4053b8e0d06c6afb1ee1219 Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Fri, 25 Jun 2004 04:48:53 +0000 Subject: [PATCH] decl.c (grokdeclarator): Restore error messages about __thread. * decl.c (grokdeclarator): Restore error messages about __thread. * parser.c (cp_parser_decl_specifier_seq): Likewise. From-SVN: r83636 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/decl.c | 34 +++++++++++++++++++++++++++++++--- gcc/cp/parser.c | 16 ++++++++++------ 3 files changed, 46 insertions(+), 9 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index fee6c9a1223..0063722b879 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2004-06-24 Mark Mitchell + + * decl.c (grokdeclarator): Restore error messages about __thread. + * parser.c (cp_parser_decl_specifier_seq): Likewise. + 2004-06-24 Jason Merrill PR c++/16115 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 2798440816f..5f7fb81ee06 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index ffaf0c85c99..346ad1cabcf 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -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. */ -- 2.30.2