aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-parser.c
diff options
context:
space:
mode:
authorPaolo Bonzini <bonzini@gnu.org>2010-11-13 09:52:00 +0000
committerPaolo Bonzini <bonzini@gcc.gnu.org>2010-11-13 09:52:00 +0000
commit9e5b21156632fd14bfaeea24919c614e56645989 (patch)
treeeb7240972890ab86d11f88bf6522ea66910f938f /gcc/c-parser.c
parent18406601136a40c875005c3f11563f657fc1f0ca (diff)
downloadgcc-9e5b21156632fd14bfaeea24919c614e56645989.zip
gcc-9e5b21156632fd14bfaeea24919c614e56645989.tar.gz
gcc-9e5b21156632fd14bfaeea24919c614e56645989.tar.bz2
c-tree.h (enum c_typespec_kind): Add ctsk_none.
2010-11-13 Paolo Bonzini <bonzini@gnu.org> * c-tree.h (enum c_typespec_kind): Add ctsk_none. (struct c_declspecs): Replace tagdef_seen_p and type_seen_p with typespec_kind. * c-decl.c (build_null_declspecs): Initialize typespec_kind. (shadow_tag_warned, check_compound_literal_type): Adjust uses of tag_defined_p. (declspecs_add_type): Set typespec_kind. * c-parser.c (c_parser_declaration_or_fndef, c_parser_declspecs, c_parser_struct_declaration, c_parser_parameter_declaration, c_parser_type_name, c_parser_objc_diagnose_bad_element_prefix): Adjust uses of type_seen_p. * c-typeck.c (c_cast_expr): Use typespec_kind instead of tag_defined_p, pass ctsk_firstref through. testsuite: 2010-11-13 Paolo Bonzini <bonzini@gnu.org> * gcc.dg/Wcxx-compat-8.c: Add testcases involving incomplete types. From-SVN: r166699
Diffstat (limited to 'gcc/c-parser.c')
-rw-r--r--gcc/c-parser.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/gcc/c-parser.c b/gcc/c-parser.c
index 484dab2..9761e4e 100644
--- a/gcc/c-parser.c
+++ b/gcc/c-parser.c
@@ -1462,7 +1462,8 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok,
should diagnose if there were no declaration specifiers) or a
function definition (in which case the diagnostic for
implicit int suffices). */
- declarator = c_parser_declarator (parser, specs->type_seen_p,
+ declarator = c_parser_declarator (parser,
+ specs->typespec_kind != ctsk_none,
C_DTR_NORMAL, &dummy);
if (declarator == NULL)
{
@@ -1831,7 +1832,7 @@ c_parser_declspecs (c_parser *parser, struct c_declspecs *specs,
bool scspec_ok, bool typespec_ok, bool start_attr_ok)
{
bool attrs_ok = start_attr_ok;
- bool seen_type = specs->type_seen_p;
+ bool seen_type = specs->typespec_kind != ctsk_none;
while (c_parser_next_token_is (parser, CPP_NAME)
|| c_parser_next_token_is (parser, CPP_KEYWORD)
|| (c_dialect_objc () && c_parser_next_token_is (parser, CPP_LESS)))
@@ -2399,7 +2400,7 @@ c_parser_struct_declaration (c_parser *parser)
|| c_parser_next_token_is (parser, CPP_CLOSE_BRACE))
{
tree ret;
- if (!specs->type_seen_p)
+ if (specs->typespec_kind == ctsk_none)
{
pedwarn (decl_loc, OPT_pedantic,
"ISO C forbids member declarations with no members");
@@ -2434,7 +2435,8 @@ c_parser_struct_declaration (c_parser *parser)
if (c_parser_next_token_is (parser, CPP_COLON))
declarator = build_id_declarator (NULL_TREE);
else
- declarator = c_parser_declarator (parser, specs->type_seen_p,
+ declarator = c_parser_declarator (parser,
+ specs->typespec_kind != ctsk_none,
C_DTR_NORMAL, &dummy);
if (declarator == NULL)
{
@@ -3078,7 +3080,8 @@ c_parser_parameter_declaration (c_parser *parser, tree attrs)
pending_xref_error ();
prefix_attrs = specs->attrs;
specs->attrs = NULL_TREE;
- declarator = c_parser_declarator (parser, specs->type_seen_p,
+ declarator = c_parser_declarator (parser,
+ specs->typespec_kind != ctsk_none,
C_DTR_PARM, &dummy);
if (declarator == NULL)
{
@@ -3370,7 +3373,8 @@ c_parser_type_name (c_parser *parser)
}
pending_xref_error ();
finish_declspecs (specs);
- declarator = c_parser_declarator (parser, specs->type_seen_p,
+ declarator = c_parser_declarator (parser,
+ specs->typespec_kind != ctsk_none,
C_DTR_ABSTRACT, &dummy);
if (declarator == NULL)
return NULL;
@@ -7618,7 +7622,8 @@ static bool
c_parser_objc_diagnose_bad_element_prefix (c_parser *parser,
struct c_declspecs *specs)
{
- if (!specs->declspecs_seen_p || specs->type_seen_p || specs->non_sc_seen_p)
+ if (!specs->declspecs_seen_p || specs->non_sc_seen_p
+ || specs->typespec_kind != ctsk_none)
{
c_parser_error (parser,
"no type or storage class may be specified here,");