summaryrefslogtreecommitdiff
path: root/gcc/gengtype-yacc.y
diff options
context:
space:
mode:
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2004-03-30 19:19:06 +0000
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2004-03-30 19:19:06 +0000
commit7035b2ab9789880dfe54b3d18299b944ef796df6 (patch)
treeeb5c785a332c675110a75f8bdba7609d72204214 /gcc/gengtype-yacc.y
parent97505ac3dcb755ae4f7f6516c72db06a80802a4a (diff)
downloadgcc-7035b2ab9789880dfe54b3d18299b944ef796df6.tar.gz
* gengtype.c (create_option): New function.
* gengtype.h: Prototype it. * gengtype-yacc.y (stringseq): New rule. (option): Use create_option. Add new bare ID production. Use stringseq, not STRING directly. * alias.c, bitmap.c, c-decl.c, cgraph.h, cpplib.h, cselib.h * dwarf2out.c, emit-rtl.c, function.h, lists.c, tree.h * varray.h, config/alpha/alpha.c, cp/name-lookup.c, cp/parser.c * f/com.c, java/builtins.c, java/expr.c, java/jcf.h, java/parse.h: Use new shorter form of GTY markers. * doc/gty.texi: Rewrite. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@80091 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gengtype-yacc.y')
-rw-r--r--gcc/gengtype-yacc.y35
1 files changed, 19 insertions, 16 deletions
diff --git a/gcc/gengtype-yacc.y b/gcc/gengtype-yacc.y
index 928c962a584..18b65f14c5c 100644
--- a/gcc/gengtype-yacc.y
+++ b/gcc/gengtype-yacc.y
@@ -57,7 +57,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
%type <p> struct_fields yacc_ids yacc_typematch
%type <t> type lasttype
%type <o> optionsopt options option optionseq optionseqopt
-%type <s> type_option
+%type <s> type_option stringseq
%%
@@ -268,21 +268,12 @@ type_option : ALIAS
{ $$ = $1; }
;
-option: type_option '(' type ')'
- {
- options_p o = xmalloc (sizeof (*o));
- o->name = $1;
- o->info = adjust_field_type ($3, NULL);
- $$ = o;
- }
- | ID '(' STRING ')'
- {
- options_p o = xmalloc (sizeof (*o));
- o->name = $1;
- o->info = (void *)$3;
- $$ = o;
- }
- ;
+option: ID
+ { $$ = create_option ($1, (void *)""); }
+ | ID '(' stringseq ')'
+ { $$ = create_option ($1, (void *)$3); }
+ | type_option '(' type ')'
+ { $$ = create_option ($1, adjust_field_type ($3, NULL)); }
optionseq: option
{
@@ -299,4 +290,16 @@ optionseq: option
optionseqopt: { $$ = NULL; }
| optionseq { $$ = $1; }
;
+
+stringseq: STRING
+ { $$ = $1; }
+ | stringseq STRING
+ {
+ size_t l1 = strlen ($1);
+ size_t l2 = strlen ($2);
+ char *s = xrealloc ((char *)$1, l1 + l2 + 1);
+ memcpy (s + l1, $2, l2 + 1);
+ free ((void *)$2);
+ $$ = s;
+ }
%%