diff options
author | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-10-14 00:34:01 +0000 |
---|---|---|
committer | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-10-14 00:34:01 +0000 |
commit | 19702c1d34daddd799073407407ff47a44d0084c (patch) | |
tree | d480ea1c4408842eab54602e3d430ca39cc2a0b7 /gcc/c-tree.h | |
parent | a86d7a65a99e943f5cd93f16e1d8b8b9c31ff1b1 (diff) | |
download | gcc-19702c1d34daddd799073407407ff47a44d0084c.tar.gz |
* c-tree.h (enum c_typespec_kind, struct c_typespec,
parser_xref_tag): New.
(struct c_declspecs): Add tag_defined_p. Adjust definition of
typedef_p.
(declspecs_add_type): Adjust prototypes.
* c-parse.in (%union): Add tstype.
(typespec_nonattr, typespec_attr, typespec_reserved_nonattr,
typespec_reserved_attr, typespec_nonreserved_nonattr,
structsp_attr, structsp_nonattr): Change to tstype. Update
actions.
* c-decl.c (build_null_declspecs): Initialize tag_defined_p.
(declspecs_add_type): Update to take struct c_typespec argument.
Set tag_defined_p and typedef_p as appropriate.
(xref_tag): Rename to parser_xref_tag and replace by wrapper.
Update to return struct c_typespec.
(shadow_tag_warned): Don't let empty declarations with qualifiers
or storage class specifiers redeclare a tag if a previous
declaration is visible.
testsuite:
* gcc.dg/c99-tag-3.c, gcc.dg/declspec-14.c: New tests.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@89021 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-tree.h')
-rw-r--r-- | gcc/c-tree.h | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/gcc/c-tree.h b/gcc/c-tree.h index f6e195fa101..18d200fb592 100644 --- a/gcc/c-tree.h +++ b/gcc/c-tree.h @@ -131,6 +131,39 @@ struct c_expr enum tree_code original_code; }; +/* A kind of type specifier. Note that this information is currently + only used to distinguish tag definitions, tag references and typeof + uses. */ +enum c_typespec_kind { + /* A reserved keyword type specifier. */ + ctsk_resword, + /* A reference to a tag, previously declared, such as "struct foo". + This includes where the previous declaration was as a different + kind of tag, in which case this is only valid if shadowing that + tag in an inner scope. */ + ctsk_tagref, + /* A reference to a tag, not previously declared in a visible + scope. */ + ctsk_tagfirstref, + /* A definition of a tag such as "struct foo { int a; }". */ + ctsk_tagdef, + /* A typedef name. */ + ctsk_typedef, + /* An ObjC-specific kind of type specifier. */ + ctsk_objc, + /* A typeof specifier. */ + ctsk_typeof +}; + +/* A type specifier: this structure is created in the parser and + passed to declspecs_add_type only. */ +struct c_typespec { + /* What kind of type specifier this is. */ + enum c_typespec_kind kind; + /* The specifier itself. */ + tree spec; +}; + /* A storage class specifier. */ enum c_storage_class { csc_none, @@ -178,8 +211,12 @@ struct c_declspecs { specifiers to be handled separately from storage class specifiers.) */ BOOL_BITFIELD non_sc_seen_p : 1; - /* Whether the type is specified by a typedef. */ + /* Whether the type is specified by a typedef or typeof name. */ BOOL_BITFIELD typedef_p : 1; + /* Whether a struct, union or enum type either had its content + defined by a type specifier in the list or was the first visible + declaration of its tag. */ + BOOL_BITFIELD tag_defined_p : 1; /* Whether the type is explicitly "signed" or specified by a typedef whose type is explicitly "signed". */ BOOL_BITFIELD explicit_signed_p : 1; @@ -371,6 +408,7 @@ extern tree start_struct (enum tree_code, tree); extern void store_parm_decls (void); extern void store_parm_decls_from (struct c_arg_info *); extern tree xref_tag (enum tree_code, tree); +extern struct c_typespec parser_xref_tag (enum tree_code, tree); extern int c_expand_decl (tree); extern struct c_parm *build_c_parm (struct c_declspecs *, tree, struct c_declarator *); @@ -383,7 +421,8 @@ extern struct c_declarator *make_pointer_declarator (struct c_declspecs *, struct c_declarator *); extern struct c_declspecs *build_null_declspecs (void); extern struct c_declspecs *declspecs_add_qual (struct c_declspecs *, tree); -extern struct c_declspecs *declspecs_add_type (struct c_declspecs *, tree); +extern struct c_declspecs *declspecs_add_type (struct c_declspecs *, + struct c_typespec); extern struct c_declspecs *declspecs_add_scspec (struct c_declspecs *, tree); extern struct c_declspecs *declspecs_add_attrs (struct c_declspecs *, tree); extern struct c_declspecs *finish_declspecs (struct c_declspecs *); |