diff options
author | dnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-04-22 18:29:36 +0000 |
---|---|---|
committer | dnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-04-22 18:29:36 +0000 |
commit | fb1e4f4abf01d3559f37568d2624b734410d3b3e (patch) | |
tree | c5c412bca065fddee835089ec9fbd863ee283f18 /gcc/gengtype-parse.c | |
parent | 57187d90a77fa29871fa5bbf1bffe9cdb35b8cfa (diff) | |
download | gcc-fb1e4f4abf01d3559f37568d2624b734410d3b3e.tar.gz |
2009-04-21 Taras Glek <tglek@mozilla.com>
* include/hashtab.h: Update GTY annotations to new syntax
* include/splay-tree.h: Likewise
gcc/ChangeLog
2009-04-21 Taras Glek <tglek@mozilla.com>
* alias.c: Update GTY annotations to new syntax
* basic-block.h: Likewise
* bitmap.h: Likewise
* c-common.h: Likewise
* c-decl.c: Likewise
* c-parser.c: Likewise
* c-pragma.c: Likewise
* c-tree.h: Likewise
* cfgloop.h: Likewise
* cgraph.h: Likewise
* config/alpha/alpha.c: Likewise
* config/arm/arm.h: Likewise
* config/avr/avr.h: Likewise
* config/bfin/bfin.c: Likewise
* config/cris/cris.c: Likewise
* config/darwin.c: Likewise
* config/frv/frv.c: Likewise
* config/i386/i386.c: Likewise
* config/i386/i386.h: Likewise
* config/i386/winnt.c: Likewise
* config/ia64/ia64.h: Likewise
* config/iq2000/iq2000.c: Likewise
* config/mips/mips.c: Likewise
* config/mmix/mmix.h: Likewise
* config/pa/pa.c: Likewise
* config/pa/pa.h: Likewise
* config/rs6000/rs6000.c: Likewise
* config/s390/s390.c: Likewise
* config/sparc/sparc.c: Likewise
* config/xtensa/xtensa.c: Likewise
* cselib.h: Likewise
* dbxout.c: Likewise
* dwarf2out.c: Likewise
* except.c: Likewise
* except.h: Likewise
* fixed-value.h: Likewise
* function.c: Likewise
* function.h: Likewise
* gimple.h: Likewise
* integrate.c: Likewise
* optabs.c: Likewise
* output.h: Likewise
* real.h: Likewise
* rtl.h: Likewise
* stringpool.c: Likewise
* tree-data-ref.c: Likewise
* tree-flow.h: Likewise
* tree-scalar-evolution.c: Likewise
* tree-ssa-address.c: Likewise
* tree-ssa-alias.h: Likewise
* tree-ssa-operands.h: Likewise
* tree.c: Likewise
* tree.h: Likewise
* varasm.c: Likewise
* varray.h: Likewise
* vec.h: Likewise
* coretypes.h: Do not define GTY macro if it is already defined
* doc/gty.texi: Update GTY documentation to new syntax
* gengtype-lex.l: Enforce attribute-like syntax for GTY annotations on structs
* gengtype-parse.c: Likewise
gcc/ada/ChangeLog
2009-04-21 Taras Glek <tglek@mozilla.com>
* gcc-interface/ada-tree.h: Update GTY annotations to new syntax
* gcc-interface/trans.c: Likewise
* gcc-interface/utils.c: Likewise
gcc/cp/ChangeLog
2009-04-21 Taras Glek <tglek@mozilla.com>
* cp-tree.h: Update GTY annotations to new syntax
* decl.c: Likewise
* mangle.c: Likewise
* name-lookup.c: Likewise
* name-lookup.h: Likewise
* parser.c: Likewise
* pt.c: Likewise
* rtti.c: Likewise
* semantics.c: Likewise
* typeck2.c: Likewise
gcc/fortran/ChangeLog
2009-04-21 Taras Glek <tglek@mozilla.com>
* f95-lang.c: Update GTY annotations to new syntax
* trans-intrinsic.c: Likewise
* trans-io.c: Likewise
* trans.h: Likewise
gcc/java/ChangeLog
2009-04-21 Taras Glek <tglek@mozilla.com>
* builtins.c: Update GTY annotations to new syntax
* decl.c: Likewise
* java-tree.h: Likewise
* jcf.h: Likewise
* lang.c: Likewise
gcc/objc/ChangeLog
2009-04-21 Taras Glek <tglek@mozilla.com>
* objc-act.c: Update GTY annotations to new syntax
* objc-act.h: Likewise
libcpp/ChangeLog
2009-04-21 Taras Glek <tglek@mozilla.com>
* include/cpp-id-data.h: Update GTY annotations to new syntax
* include/cpplib.h: Likewise
* include/line-map.h: Likewise
* include/symtab.h: Likewise
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146607 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gengtype-parse.c')
-rw-r--r-- | gcc/gengtype-parse.c | 61 |
1 files changed, 42 insertions, 19 deletions
diff --git a/gcc/gengtype-parse.c b/gcc/gengtype-parse.c index 357981ad3cb..6b0cd2e1a24 100644 --- a/gcc/gengtype-parse.c +++ b/gcc/gengtype-parse.c @@ -677,7 +677,6 @@ static type_p type (options_p *optsp, bool nested) { const char *s; - bool is_union; *optsp = 0; switch (token ()) { @@ -694,15 +693,17 @@ type (options_p *optsp, bool nested) case UNION: { options_p opts = 0; - - is_union = (token() == UNION); + /* GTY annotations follow attribute syntax + GTY_BEFORE_ID is for union/struct declarations + GTY_AFTER_ID is for variable declarations. */ + enum { + NO_GTY, + GTY_BEFORE_ID, + GTY_AFTER_ID + } is_gty = NO_GTY; + bool is_union = (token () == UNION); advance (); - if (token () == ID) - s = advance (); - else - s = xasprintf ("anonymous:%s:%d", lexer_line.file, lexer_line.line); - /* Top-level structures that are not explicitly tagged GTY(()) are treated as mere forward declarations. This is because there are a lot of structures that we don't need to know @@ -710,18 +711,40 @@ type (options_p *optsp, bool nested) that we can't handle. */ if (nested || token () == GTY_TOKEN) { - opts = gtymarker_opt (); - if (token () == '{') - { - pair_p fields; - advance (); - fields = struct_field_seq (); - require ('}'); - return new_structure (s, is_union, &lexer_line, fields, opts); - } + is_gty = GTY_BEFORE_ID; + opts = gtymarker_opt (); } - else if (token () == '{') - consume_balanced ('{', '}'); + + if (token () == ID) + s = advance (); + else + s = xasprintf ("anonymous:%s:%d", lexer_line.file, lexer_line.line); + + /* Unfortunately above GTY_TOKEN check does not capture the + typedef struct_type GTY case. */ + if (token () == GTY_TOKEN) + { + is_gty = GTY_AFTER_ID; + opts = gtymarker_opt (); + } + + if (is_gty) + { + if (token () == '{') + { + pair_p fields; + + if (is_gty == GTY_AFTER_ID) + parse_error ("GTY must be specified before identifier"); + + advance (); + fields = struct_field_seq (); + require ('}'); + return new_structure (s, is_union, &lexer_line, fields, opts); + } + } + else if (token () == '{') + consume_balanced ('{', '}'); if (opts) *optsp = opts; return find_structure (s, is_union); |