A const-ify patch for gperf generated files
Kaveh R. Ghazi
ghazi@caip.rutgers.edu
Sat Mar 27 13:25:00 GMT 1999
This const-ify patch patch gets rid of around 900
-Wwrite-strings warnings in the gperf generated files used in egcs.
Okay to install?
--Kaveh
Sat Mar 27 12:39:51 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* Makefile.in (c-gperf.h): Generate using gperf language 'C', not
'KR-C', so gperf uses the `const' keyword on strings.
* c-parse.gperf (resword): Const-ify a char*.
diff -rup orig/egcs-CVS19990327/gcc/Makefile.in egcs-CVS19990327/gcc/Makefile.in
--- orig/egcs-CVS19990327/gcc/Makefile.in Sat Mar 27 08:36:27 1999
+++ egcs-CVS19990327/gcc/Makefile.in Sat Mar 27 11:56:26 1999
@@ -1325,7 +1325,7 @@ $(srcdir)/c-parse.y: c-parse.in
$(srcdir)/move-if-change tmp-c-parse.y $(srcdir)/c-parse.y
$(srcdir)/c-gperf.h: c-parse.gperf
- gperf -L KR-C -F ', 0, 0' -p -j1 -i 1 -g -o -t -G -N is_reserved_word \
+ gperf -L C -F ', 0, 0' -p -j1 -i 1 -g -o -t -G -N is_reserved_word \
-k1,3,$$ $(srcdir)/c-parse.gperf >tmp-gperf.h
$(srcdir)/move-if-change tmp-gperf.h $(srcdir)/c-gperf.h
diff -rup orig/egcs-CVS19990327/gcc/c-parse.gperf egcs-CVS19990327/gcc/c-parse.gperf
--- orig/egcs-CVS19990327/gcc/c-parse.gperf Wed Dec 16 15:53:49 1998
+++ egcs-CVS19990327/gcc/c-parse.gperf Sat Mar 27 11:48:12 1999
@@ -1,7 +1,7 @@
%{
/* Command-line: gperf -L KR-C -F ', 0, 0' -p -j1 -i 1 -g -o -t -N is_reserved_word -k1,3,$ c-parse.gperf */
%}
-struct resword { char *name; short token; enum rid rid; };
+struct resword { const char *name; short token; enum rid rid; };
%%
@class, CLASS, NORID
@compatibility_alias, ALIAS, NORID
Sat Mar 27 12:39:51 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* Makefile.in (hash.h): Generate using gperf language 'C', not
'KR-C', so gperf uses the `const' keyword on strings.
* gperf (resword): Const-ify a char*.
diff -rup orig/egcs-CVS19990327/gcc/ch/Makefile.in egcs-CVS19990327/gcc/ch/Makefile.in
--- orig/egcs-CVS19990327/gcc/ch/Makefile.in Tue Jan 19 17:32:27 1999
+++ egcs-CVS19990327/gcc/ch/Makefile.in Sat Mar 27 12:11:19 1999
@@ -266,7 +266,7 @@ $(srcdir)/hash.h:
gawk '{ printf ("s/^%s,/%s,/\n", $$1, toupper ($$1)) }' < gperf.tmp > sed.tmp
sed -f sed.tmp < gperf.tmp > gperf.tmp2
cat $(srcdir)/gperf gperf.tmp2 > gperf.tmp
- gperf -L KR-C -F ', 0, 0, 0' -D -E -S1 -p -j1 -i 1 -g -o -t -k'*' \
+ gperf -L C -F ', 0, 0, 0' -D -E -S1 -p -j1 -i 1 -g -o -t -k'*' \
gperf.tmp > $(srcdir)/hash.h
$(RM) gperf.tmp gperf.tmp2 sed.tmp
diff -rup orig/egcs-CVS19990327/gcc/ch/gperf egcs-CVS19990327/gcc/ch/gperf
--- orig/egcs-CVS19990327/gcc/ch/gperf Wed Dec 16 15:59:13 1998
+++ egcs-CVS19990327/gcc/ch/gperf Sat Mar 27 12:11:45 1999
@@ -1,5 +1,5 @@
struct resword {
- char *name;
+ const char *name;
short token;
enum rid rid;
enum toktype { RESERVED, DIRECTIVE, PREDEF } flags;
Sat Mar 27 12:39:51 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* Makefile.in (hash.h): Generate using gperf language 'C', not
'KR-C', so gperf uses the `const' keyword on strings.
* gxx.gperf (resword): Const-ify a char*.
diff -rup orig/egcs-CVS19990327/gcc/cp/Makefile.in egcs-CVS19990327/gcc/cp/Makefile.in
--- orig/egcs-CVS19990327/gcc/cp/Makefile.in Wed Mar 24 08:23:12 1999
+++ egcs-CVS19990327/gcc/cp/Makefile.in Sat Mar 27 12:02:30 1999
@@ -245,7 +245,7 @@ $(PARSE_C) : $(srcdir)/parse.y
# the C front-end already requires this if c-parse.gperf is changed,
# so we should be consistent.
$(srcdir)/hash.h: $(srcdir)/gxx.gperf
- gperf -L KR-C -F ', 0, 0' -p -j1 -g -o -t -N is_reserved_word \
+ gperf -L C -F ', 0, 0' -p -j1 -g -o -t -N is_reserved_word \
'-k1,4,7,$$' $(srcdir)/gxx.gperf >$(srcdir)/hash.h
spew.o : spew.c $(CONFIG_H) $(CXX_TREE_H) $(PARSE_H) $(srcdir)/../flags.h \
diff -rup orig/egcs-CVS19990327/gcc/cp/gxx.gperf egcs-CVS19990327/gcc/cp/gxx.gperf
--- orig/egcs-CVS19990327/gcc/cp/gxx.gperf Wed Dec 16 16:15:30 1998
+++ egcs-CVS19990327/gcc/cp/gxx.gperf Sat Mar 27 12:02:46 1999
@@ -1,7 +1,7 @@
%{
/* Command-line: gperf -L KR-C -F ', 0, 0' -p -j1 -g -o -t -N is_reserved_word -k1,4,$,7 gplus.gperf */
%}
-struct resword { char *name; short token; enum rid rid;};
+struct resword { const char *name; short token; enum rid rid;};
%%
__alignof, ALIGNOF, NORID
__alignof__, ALIGNOF, NORID
Sat Mar 27 12:39:51 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* Makefile.in (keyword.h): Generate using gperf language 'C', not
'KR-C', so gperf uses the `const' keyword on strings.
* keyword.gperf (java_keyword): Const-ify a char*.
diff -rup orig/egcs-CVS19990327/gcc/java/Makefile.in egcs-CVS19990327/gcc/java/Makefile.in
--- orig/egcs-CVS19990327/gcc/java/Makefile.in Tue Mar 23 09:49:45 1999
+++ egcs-CVS19990327/gcc/java/Makefile.in Sat Mar 27 12:23:16 1999
@@ -247,7 +247,7 @@ lex.c: keyword.h lex.h
lang.o: $(srcdir)/java-tree.def
keyword.h: keyword.gperf
- gperf -L KR-C -F ', 0' -p -t -j1 -i 1 -g -o -N java_keyword -k1,3,$$ \
+ gperf -L C -F ', 0' -p -t -j1 -i 1 -g -o -N java_keyword -k1,3,$$ \
keyword.gperf > keyword.h
jcf-path.o : jcf-path.c $(CONFIG_H) $(srcdir)/../system.h jcf.h
diff -rup orig/egcs-CVS19990327/gcc/java/keyword.gperf egcs-CVS19990327/gcc/java/keyword.gperf
--- orig/egcs-CVS19990327/gcc/java/keyword.gperf Wed Dec 16 16:20:52 1998
+++ egcs-CVS19990327/gcc/java/keyword.gperf Sat Mar 27 12:22:08 1999
@@ -25,7 +25,7 @@ of Sun Microsystems, Inc. in the United
The Free Software Foundation is independent of Sun Microsystems, Inc. */
%}
-struct java_keyword { char *name; int token; };
+struct java_keyword { const char *name; int token; };
%%
abstract, ABSTRACT_TK
default, DEFAULT_TK
More information about the Gcc-patches
mailing list