3 if [ $# -eq 3 -a "$2" = '-d' ]; then
5 elif [ $# -ne 1 ]; then
6 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
10 -patch) patch $pdir -f --no-backup-if-mismatch -p0 < $0;;
11 -unpatch) patch $pdir -f --no-backup-if-mismatch -R -p0 < $0;;
13 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
18 # append the patch here and adjust the -p? flag in the patch calls.
20 From: Jim Kingdon <kingdon@redhat.com>
22 CC: gcc-patches@gcc.gnu.org
23 Subject: Re: patch to make -Wpointer-arith work with glibc 2.1.2pre3
24 Date: Tue, 21 Sep 1999 15:50:20 -0400
26 Richard Henderson writes:
28 > This could all be tidied a bit by creating a couple of macros near
29 > the beginning of c-parse.in to do the encoding and decoding. Also,
30 > setting the type of `extension' means $<itype>1 can be written $1.
32 Here you go (sorry for the delay, I plead hurricanes and other
35 Let me know if you still aren't happy :-).
37 # DP: Wed Sep 1 09:12:02 1999 Jim Kingdon <http://developer.redhat.com>
39 # DP: * c-parse.in: save and restore warn_pointer_arith on __extension__
40 # DP: along with pedantic.
41 # DP: (SAVE_WARN_FLAGS, RESTORE_WARN_FLAGS): Added.
42 # DP: Set the type of extension to itype rather than $<itype>1 kludge.
43 # DP: * extend.texi (Alternate Keywords): Adjust documentation.
46 ===================================================================
47 RCS file: /cvs/egcs/egcs/gcc/c-parse.in,v
48 retrieving revision 1.23
49 diff -u -r1.23 c-parse.in
50 --- gcc/c-parse.in 1999/09/07 05:47:29 1.23
51 +++ gcc/c-parse.in 1999/09/21 19:05:43
53 %type <ttype> parmlist_or_identifiers parmlist_or_identifiers_1
54 %type <ttype> identifiers_or_typenames
56 +%type <itype> extension
58 %type <itype> setspecs
60 %type <ends_in_label> lineno_stmt_or_label lineno_stmt_or_labels stmt_or_label
62 /* 1 if we explained undeclared var errors. */
63 static int undeclared_variable_notice;
65 +/* For __extension__, save/restore the warning flags which are
66 + controlled by __extension__. */
67 +#define SAVE_WARN_FLAGS() (pedantic | (warn_pointer_arith << 1))
68 +#define RESTORE_WARN_FLAGS(val) \
70 + pedantic = val & 1; \
71 + warn_pointer_arith = (val >> 1) & 1; \
75 /* Objective-C specific information */
79 error ("argument of `asm' is not a constant string"); }
81 - { pedantic = $<itype>1; }
82 + { RESTORE_WARN_FLAGS ($1); }
87 /* __extension__ turns off -pedantic for following primary. */
88 | extension cast_expr %prec UNARY
90 - pedantic = $<itype>1; }
91 + RESTORE_WARN_FLAGS ($1); }
92 | unop cast_expr %prec UNARY
93 { $$ = build_unary_op ($1, $2, 0);
94 overflow_warning ($$); }
97 { pedwarn ("empty declaration"); }
99 - { pedantic = $<itype>1; }
100 + { RESTORE_WARN_FLAGS ($1); }
103 /* Declspecs which contain at least one type specifier or typedef name.
104 @@ -1607,7 +1618,7 @@
106 | extension component_decl
108 - pedantic = $<itype>1; }
109 + RESTORE_WARN_FLAGS ($1); }
113 @@ -2441,8 +2452,9 @@
117 - { $<itype>$ = pedantic;
119 + { $$ = SAVE_WARN_FLAGS();
121 + warn_pointer_arith = 0; }