]> git.pld-linux.org Git - packages/crossmingw32-gcc.git/blame - gcc-pointer-arith.patch
- allow override flags.
[packages/crossmingw32-gcc.git] / gcc-pointer-arith.patch
CommitLineData
66c22bf8
JR
1#! /bin/sh -e
2
3if [ $# -eq 3 -a "$2" = '-d' ]; then
4 pdir="-d $3"
5elif [ $# -ne 1 ]; then
6 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
7 exit 1
8fi
9case "$1" in
10 -patch) patch $pdir -f --no-backup-if-mismatch -p0 < $0;;
11 -unpatch) patch $pdir -f --no-backup-if-mismatch -R -p0 < $0;;
12 *)
13 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
14 exit 1
15esac
16exit 0
17
18# append the patch here and adjust the -p? flag in the patch calls.
19
20From: Jim Kingdon <kingdon@redhat.com>
21To: rth@cygnus.com
22CC: gcc-patches@gcc.gnu.org
23Subject: Re: patch to make -Wpointer-arith work with glibc 2.1.2pre3
24Date: Tue, 21 Sep 1999 15:50:20 -0400
25
26Richard Henderson writes:
27
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.
31
32Here you go (sorry for the delay, I plead hurricanes and other
33causes).
34
35Let me know if you still aren't happy :-).
36
37# DP: Wed Sep 1 09:12:02 1999 Jim Kingdon <http://developer.redhat.com>
38# DP:
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.
44
45Index: c-parse.in
46===================================================================
47RCS file: /cvs/egcs/egcs/gcc/c-parse.in,v
48retrieving revision 1.23
49diff -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
52@@ -185,6 +185,8 @@
53 %type <ttype> parmlist_or_identifiers parmlist_or_identifiers_1
54 %type <ttype> identifiers_or_typenames
55
56+%type <itype> extension
57+
58 %type <itype> setspecs
59
60 %type <ends_in_label> lineno_stmt_or_label lineno_stmt_or_labels stmt_or_label
61@@ -227,6 +229,15 @@
62 /* 1 if we explained undeclared var errors. */
63 static int undeclared_variable_notice;
64
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) \
69+ do { \
70+ pedantic = val & 1; \
71+ warn_pointer_arith = (val >> 1) & 1; \
72+ } while (0)
73+
74 ifobjc
75 /* Objective-C specific information */
76
77@@ -297,7 +308,7 @@
78 else
79 error ("argument of `asm' is not a constant string"); }
80 | extension extdef
81- { pedantic = $<itype>1; }
82+ { RESTORE_WARN_FLAGS ($1); }
83 ;
84
85 datadef:
86@@ -438,7 +449,7 @@
87 /* __extension__ turns off -pedantic for following primary. */
88 | extension cast_expr %prec UNARY
89 { $$ = $2;
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 ($$); }
95@@ -1002,7 +1013,7 @@
96 | declmods ';'
97 { pedwarn ("empty declaration"); }
98 | extension decl
99- { pedantic = $<itype>1; }
100+ { RESTORE_WARN_FLAGS ($1); }
101 ;
102
103 /* Declspecs which contain at least one type specifier or typedef name.
104@@ -1607,7 +1618,7 @@
105 { $$ = NULL_TREE; }
106 | extension component_decl
107 { $$ = $2;
108- pedantic = $<itype>1; }
109+ RESTORE_WARN_FLAGS ($1); }
110 ;
111
112 components:
113@@ -2441,8 +2452,9 @@
114
115 extension:
116 EXTENSION
117- { $<itype>$ = pedantic;
118- pedantic = 0; }
119+ { $$ = SAVE_WARN_FLAGS();
120+ pedantic = 0;
121+ warn_pointer_arith = 0; }
122 ;
123 \f
124 ifobjc
This page took 0.089521 seconds and 4 git commands to generate.