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
This commit is contained in:
Mark Mitchell 2004-06-25 04:48:53 +00:00 committed by Mark Mitchell
parent 6f0aa5e195
commit f1b90a04e0
3 changed files with 46 additions and 9 deletions

View 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> 2004-06-24 Jason Merrill <jason@redhat.com>
PR c++/16115 PR c++/16115

View File

@ -6545,7 +6545,25 @@ grokdeclarator (const cp_declarator *declarator,
longlong = 1; longlong = 1;
} }
else if (declspecs->specs[(int)ds] > 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 #if 0
@ -6796,9 +6814,19 @@ grokdeclarator (const cp_declarator *declarator,
kinds of declarations (parameters, typenames, etc.). */ kinds of declarations (parameters, typenames, etc.). */
if (declspecs->multiple_storage_classes_p) if (declspecs->multiple_storage_classes_p)
error ("multiple storage classes in declaration of `%s'", name); 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 else if (decl_context != NORMAL
&& declspecs->storage_class != sc_none && ((declspecs->storage_class != sc_none
&& declspecs->storage_class != sc_mutable) && declspecs->storage_class != sc_mutable)
|| declspecs->specs[(int)ds_thread]))
{ {
if ((decl_context == PARM || decl_context == CATCHPARM) if ((decl_context == PARM || decl_context == CATCHPARM)
&& (declspecs->storage_class == sc_register && (declspecs->storage_class == sc_register

View File

@ -7200,16 +7200,20 @@ cp_parser_decl_specifier_seq (cp_parser* parser,
/* Consume the token. */ /* Consume the token. */
cp_lexer_consume_token (parser->lexer); cp_lexer_consume_token (parser->lexer);
if (decl_specs->specs[(int) ds_thread]) if (decl_specs->specs[(int) ds_thread])
{
error ("`__thread' before `static'"); error ("`__thread' before `static'");
else decl_specs->specs[(int) ds_thread] = 0;
}
cp_parser_set_storage_class (decl_specs, sc_static); cp_parser_set_storage_class (decl_specs, sc_static);
break; break;
case RID_EXTERN: case RID_EXTERN:
/* Consume the token. */ /* Consume the token. */
cp_lexer_consume_token (parser->lexer); cp_lexer_consume_token (parser->lexer);
if (decl_specs->specs[(int) ds_thread]) if (decl_specs->specs[(int) ds_thread])
{
error ("`__thread' before `extern'"); error ("`__thread' before `extern'");
else decl_specs->specs[(int) ds_thread] = 0;
}
cp_parser_set_storage_class (decl_specs, sc_extern); cp_parser_set_storage_class (decl_specs, sc_extern);
break; break;
case RID_MUTABLE: case RID_MUTABLE: