This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PCH] Make (struct options).info const


Tested by building on powerpc-eabisim.

-- 
Geoff Keating <geoffk@redhat.com>

===File ~/patches/pchbranch-optinforeadonly.patch===========
2002-07-04  Geoffrey Keating  <geoffk@redhat.com>

	* gengtype.h: Make `info' a pointer-to-const.
	* gengtype-yacc.y (yacc_ids): Use xasprintf.

Index: gengtype.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gengtype.h,v
retrieving revision 1.1.2.11
diff -p -u -p -r1.1.2.11 gengtype.h
--- gengtype.h	24 Jun 2002 23:23:08 -0000	1.1.2.11
+++ gengtype.h	4 Jul 2002 21:28:54 -0000
@@ -41,7 +41,7 @@ enum typekind {
 typedef struct options {
   struct options *next;
   const char *name;
-  void *info;
+  const void *info;
 } *options_p;
 
 typedef struct pair *pair_p;
Index: gengtype-yacc.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gengtype-yacc.y,v
retrieving revision 1.1.2.11
diff -p -u -p -r1.1.2.11 gengtype-yacc.y
--- gengtype-yacc.y	24 Jun 2002 23:23:07 -0000	1.1.2.11
+++ gengtype-yacc.y	4 Jul 2002 21:28:54 -0000
@@ -174,8 +174,7 @@ yacc_ids: /* empty */
 	  p->opt = xmalloc (sizeof (*(p->opt)));
 	  p->opt->name = "tag";
 	  p->opt->next = NULL;
-	  p->opt->info = xmalloc (3 + strlen ($2));
-	  sprintf (p->opt->info, "'%s'", $2);
+	  p->opt->info = xasprintf ("'%s'", $2);
 	  $$ = p;
 	}
      ;
============================================================


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]