diff options
author | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-09-09 01:25:48 +0000 |
---|---|---|
committer | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-09-09 01:25:48 +0000 |
commit | 9553111d52cbe9f5dcfcc65e2a251d9e7803e521 (patch) | |
tree | 9281b8a84cb7f58197f54b2a640390953626fb55 /gcc/c-tree.h | |
parent | ac206aff0574a7d02a44278c0ab08420efa6fca8 (diff) | |
download | gcc-9553111d52cbe9f5dcfcc65e2a251d9e7803e521.tar.gz |
PR c/8420
* c-tree.h (struct c_declspecs): New.
(struct c_declarator, struct c_type_name, struct c_parm): Update
element types.
(build_array_declarator, grokfield, shadow_tag, shadow_tag_warned,
start_function, start_decl, build_c_parm,
make_pointer_declarator): Update prototypes.
(build_null_declspecs, declspecs_add_qual, declspecs_add_type,
declspecs_add_scspec, declspecs_add_attrs): New.
(split_specs_attrs): Remove.
* c-parse.in (%union): Add dsptype.
(declspecs_nosc_nots_nosa_noea, declspecs_nosc_nots_nosa_ea,
declspecs_nosc_nots_sa_noea, declspecs_nosc_nots_sa_ea,
declspecs_nosc_ts_nosa_noea, declspecs_nosc_ts_nosa_ea,
declspecs_nosc_ts_sa_noea, declspecs_nosc_ts_sa_ea,
declspecs_sc_nots_nosa_noea, declspecs_sc_nots_nosa_ea,
declspecs_sc_nots_sa_noea, declspecs_sc_nots_sa_ea,
declspecs_sc_ts_nosa_noea, declspecs_sc_ts_nosa_ea,
declspecs_sc_ts_sa_noea, declspecs_sc_ts_sa_ea, declspecs_ts,
declspecs_nots, declspecs_ts_nosa, declspecs_nots_nosa,
declspecs_nosc_ts, declspecs_nosc_nots, declspecs_nosc, declspecs,
maybe_type_quals_attrs): Change to dsptype.
(struct c_declspec_stack): New.
(current_declspecs, declspec_stack): Change type.
(PUSH_DECLSPEC_STACK, POP_DECLSPEC_STACK): Update to new
structures.
(extdefs): Likewise.
(setspecs): Likewise.
(fndef): Use current_declspecs for empty declspecs list.
(declspecs_nosc_nots_nosa_noea, declspecs_nosc_nots_nosa_ea,
declspecs_nosc_nots_sa_noea, declspecs_nosc_nots_sa_ea,
declspecs_nosc_ts_nosa_noea, declspecs_nosc_ts_nosa_ea,
declspecs_nosc_ts_sa_noea, declspecs_nosc_ts_sa_ea,
declspecs_sc_nots_nosa_noea, declspecs_sc_nots_nosa_ea,
declspecs_sc_nots_sa_noea, declspecs_sc_nots_sa_ea,
declspecs_sc_ts_nosa_noea, declspecs_sc_ts_nosa_ea,
declspecs_sc_ts_sa_noea, declspecs_sc_ts_sa_ea): Update to new
structures and helper functions. Update comments.
(typespec_nonattr): Correct comment.
(maybe_type_quals_attrs, typename): Update to new structures.
* c-decl.c (grokdeclarator, build_array_declarator, grokfield,
shadow_tag, shadow_tag_warned, start_function, start_decl,
build_c_parm, make_pointer_declarator,
set_array_declarator_inner, groktypename): Update to new
structures.
(build_null_declspecs, declspecs_add_qual, declspecs_add_type,
declspecs_add_scspec, declspecs_add_attrs): New.
(split_specs_attrs): Remove.
(shadow_tag_warned): Make warning for useless type names a
pedwarn. Give hard error for long, short, signed, unsigned or
_Complex used with struct, union or enum in empty declaration.
Make found_tag a bool.
(grokdeclarator): Remove checks now done at parse time.
testsuite:
* gcc.dg/anon-struct-4.c, gcc.dg/declspec-1.c,
gcc.dg/declspec-2.c, gcc.dg/declspec-3.c, gcc.dg/declspec-4.c,
gcc.dg/declspec-5.c, gcc.dg/declspec-6.c,
gcc.dg/long-long-typespec-1.c: New tests.
* gcc.dg/tls/diag-2.c: Update expected diagnostics
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@87218 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-tree.h')
-rw-r--r-- | gcc/c-tree.h | 65 |
1 files changed, 52 insertions, 13 deletions
diff --git a/gcc/c-tree.h b/gcc/c-tree.h index 09f679ef8b1..37075518b83 100644 --- a/gcc/c-tree.h +++ b/gcc/c-tree.h @@ -131,6 +131,38 @@ struct c_expr enum tree_code original_code; }; +/* A sequence of declaration specifiers in C. */ +struct c_declspecs { + /* The type specified, not reflecting modifiers such as "short" and + "unsigned", or NULL_TREE if none. */ + tree type; + /* If the type was specified with a typedef, that typedef decl. */ + tree typedef_decl; + /* The attributes from a typedef decl. */ + tree decl_attr; + /* When parsing, the attributes. Outside the parser, this will be + NULL; attributes (possibly from multiple lists) will be passed + separately. */ + tree attrs; + /* The modifier bits present. */ + int specbits; + /* Whether something other than a storage class specifier or + attribute has been seen. This is used to warn for the + obsolescent usage of storage class specifiers other than at the + start of the list. (Doing this properly would require function + specifiers to be handled separately from storage class + specifiers.) */ + BOOL_BITFIELD non_sc_seen_p : 1; + /* Whether the specifiers include a deprecated typedef. */ + BOOL_BITFIELD deprecated_p : 1; + /* Whether "int" was explicitly specified. */ + BOOL_BITFIELD explicit_int_p : 1; + /* Whether "char" was explicitly specified. */ + BOOL_BITFIELD explicit_char_p : 1; + /* Whether "long" was specified more than once. */ + BOOL_BITFIELD long_long_p : 1; +}; + /* The various kinds of declarators in C. */ enum c_declarator_kind { /* An identifier. */ @@ -175,14 +207,14 @@ struct c_declarator { /* The array dimension, or NULL for [] and [*]. */ tree dimen; /* The qualifiers (and attributes, currently ignored) inside []. */ - tree quals; + struct c_declspecs *quals; /* Whether [static] was used. */ BOOL_BITFIELD static_p : 1; /* Whether [*] was used. */ BOOL_BITFIELD vla_unspec_p : 1; } array; /* For pointers, the qualifiers on the pointer type. */ - tree pointer_quals; + struct c_declspecs *pointer_quals; /* For attributes. */ tree attrs; } u; @@ -191,7 +223,7 @@ struct c_declarator { /* A type name. */ struct c_type_name { /* The declaration specifiers. */ - tree specs; + struct c_declspecs *specs; /* The declarator. */ struct c_declarator *declarator; }; @@ -199,7 +231,7 @@ struct c_type_name { /* A parameter. */ struct c_parm { /* The declaration specifiers, minus any prefix attributes. */ - tree specs; + struct c_declspecs *specs; /* The attributes. */ tree attrs; /* The declarator. */ @@ -246,7 +278,8 @@ extern void c_expand_body (tree); extern void c_init_decl_processing (void); extern void c_dup_lang_specific_decl (tree); extern void c_print_identifier (FILE *, tree, int); -extern struct c_declarator *build_array_declarator (tree, tree, bool, bool); +extern struct c_declarator *build_array_declarator (tree, struct c_declspecs *, + bool, bool); extern tree build_enumerator (tree, tree); extern void check_for_loop_decls (void); extern void mark_forward_parm_decls (void); @@ -260,8 +293,7 @@ extern tree finish_enum (tree, tree, tree); extern void finish_function (void); extern tree finish_struct (tree, tree, tree); extern struct c_arg_info *get_parm_info (bool); -extern tree grokfield (struct c_declarator *, tree, tree); -extern void split_specs_attrs (tree, tree *, tree *); +extern tree grokfield (struct c_declarator *, struct c_declspecs *, tree); extern tree groktypename (struct c_type_name *); extern tree grokparm (const struct c_parm *); extern tree implicitly_declare (tree); @@ -277,24 +309,31 @@ extern struct c_declarator *set_array_declarator_inner (struct c_declarator *, bool); extern tree builtin_function (const char *, tree, int, enum built_in_class, const char *, tree); -extern void shadow_tag (tree); -extern void shadow_tag_warned (tree, int); +extern void shadow_tag (const struct c_declspecs *); +extern void shadow_tag_warned (const struct c_declspecs *, int); extern tree start_enum (tree); -extern int start_function (tree, struct c_declarator *, tree); -extern tree start_decl (struct c_declarator *, tree, bool, tree); +extern int start_function (struct c_declspecs *, struct c_declarator *, tree); +extern tree start_decl (struct c_declarator *, struct c_declspecs *, bool, + tree); 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 int c_expand_decl (tree); -extern struct c_parm *build_c_parm (tree, tree, struct c_declarator *); +extern struct c_parm *build_c_parm (struct c_declspecs *, tree, + struct c_declarator *); extern struct c_declarator *build_attrs_declarator (tree, struct c_declarator *); extern struct c_declarator *build_function_declarator (struct c_arg_info *, struct c_declarator *); extern struct c_declarator *build_id_declarator (tree); -extern struct c_declarator *make_pointer_declarator (tree, +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_scspec (struct c_declspecs *, tree); +extern struct c_declspecs *declspecs_add_attrs (struct c_declspecs *, tree); /* in c-objc-common.c */ extern int c_disregard_inline_limits (tree); |