mac80211: add intel drivers to PKG_CONFIG_DEPENDS
[openwrt.git] / toolchain / gcc / patches / 4.5.2 / 910-mbsd_multi.patch
1
2 This patch brings over a few features from MirBSD:
3 * -fhonour-copts
4 If this option is not given, it's warned (depending
5 on environment variables). This is to catch errors
6 of misbuilt packages which override CFLAGS themselves.
7 * -Werror-maybe-reset
8 Has the effect of -Wno-error if GCC_NO_WERROR is
9 set and not '0', a no-operation otherwise. This is
10 to be able to use -Werror in "make" but prevent
11 GNU autoconf generated configure scripts from
12 freaking out.
13 * Make -fno-strict-aliasing and -fno-delete-null-pointer-checks
14 the default for -O2/-Os, because they trigger gcc bugs
15 and can delete code with security implications.
16
17 This patch was authored by Thorsten Glaser <tg at mirbsd.de>
18 with copyright assignment to the FSF in effect.
19
20 --- a/gcc/c-opts.c
21 +++ b/gcc/c-opts.c
22 @@ -105,6 +105,9 @@
23 /* Number of deferred options scanned for -include. */
24 static size_t include_cursor;
25
26 +/* Check if a port honours COPTS. */
27 +static int honour_copts = 0;
28 +
29 static void set_Wimplicit (int);
30 static void handle_OPT_d (const char *);
31 static void set_std_cxx98 (int);
32 @@ -454,6 +457,9 @@
33 enable_warning_as_error ("implicit-function-declaration", value, CL_C | CL_ObjC);
34 break;
35
36 + case OPT_Werror_maybe_reset:
37 + break;
38 +
39 case OPT_Wformat:
40 set_Wformat (value);
41 break;
42 @@ -690,6 +701,12 @@
43 flag_exceptions = value;
44 break;
45
46 + case OPT_fhonour_copts:
47 + if (c_language == clk_c) {
48 + honour_copts++;
49 + }
50 + break;
51 +
52 case OPT_fimplement_inlines:
53 flag_implement_inlines = value;
54 break;
55 @@ -1209,6 +1226,47 @@
56 return false;
57 }
58
59 + if (c_language == clk_c) {
60 + char *ev = getenv ("GCC_HONOUR_COPTS");
61 + int evv;
62 + if (ev == NULL)
63 + evv = -1;
64 + else if ((*ev == '0') || (*ev == '\0'))
65 + evv = 0;
66 + else if (*ev == '1')
67 + evv = 1;
68 + else if (*ev == '2')
69 + evv = 2;
70 + else if (*ev == 's')
71 + evv = -1;
72 + else {
73 + warning (0, "unknown GCC_HONOUR_COPTS value, assuming 1");
74 + evv = 1; /* maybe depend this on something like MIRBSD_NATIVE? */
75 + }
76 + if (evv == 1) {
77 + if (honour_copts == 0) {
78 + error ("someone does not honour COPTS at all in lenient mode");
79 + return false;
80 + } else if (honour_copts != 1) {
81 + warning (0, "someone does not honour COPTS correctly, passed %d times",
82 + honour_copts);
83 + }
84 + } else if (evv == 2) {
85 + if (honour_copts == 0) {
86 + error ("someone does not honour COPTS at all in strict mode");
87 + return false;
88 + } else if (honour_copts != 1) {
89 + error ("someone does not honour COPTS correctly, passed %d times",
90 + honour_copts);
91 + return false;
92 + }
93 + } else if (evv == 0) {
94 + if (honour_copts != 1)
95 + inform (0, "someone does not honour COPTS correctly, passed %d times",
96 + honour_copts);
97 + }
98 + }
99 +
100 return true;
101 }
102
103 --- a/gcc/c.opt
104 +++ b/gcc/c.opt
105 @@ -215,6 +215,10 @@
106 C ObjC RejectNegative Warning
107 This switch is deprecated; use -Werror=implicit-function-declaration instead
108
109 +Werror-maybe-reset
110 +C ObjC C++ ObjC++
111 +; Documented in common.opt
112 +
113 Wfloat-equal
114 C ObjC C++ ObjC++ Var(warn_float_equal) Warning
115 Warn if testing floating point numbers for equality
116 @@ -609,6 +613,9 @@
117 fhonor-std
118 C++ ObjC++
119
120 +fhonour-copts
121 +C ObjC C++ ObjC++ RejectNegative
122 +
123 fhosted
124 C ObjC
125 Assume normal C execution environment
126 --- a/gcc/common.opt
127 +++ b/gcc/common.opt
128 @@ -102,6 +102,10 @@
129 Common Joined
130 Treat specified warning as error
131
132 +Werror-maybe-reset
133 +Common
134 +If environment variable GCC_NO_WERROR is set, act as -Wno-error
135 +
136 Wextra
137 Common Warning
138 Print extra (possibly unwanted) warnings
139 @@ -573,6 +577,9 @@
140 Common Report Var(flag_guess_branch_prob) Optimization
141 Enable guessing of branch probabilities
142
143 +fhonour-copts
144 +Common RejectNegative
145 +
146 ; Nonzero means ignore `#ident' directives. 0 means handle them.
147 ; Generate position-independent code for executables if possible
148 ; On SVR4 targets, it also controls whether or not to emit a
149 --- a/gcc/opts.c
150 +++ b/gcc/opts.c
151 @@ -896,8 +896,6 @@
152 flag_schedule_insns_after_reload = opt2;
153 #endif
154 flag_regmove = opt2;
155 - flag_strict_aliasing = opt2;
156 - flag_strict_overflow = opt2;
157 flag_reorder_blocks = opt2;
158 flag_reorder_functions = opt2;
159 flag_tree_vrp = opt2;
160 @@ -922,6 +919,8 @@
161
162 /* -O3 optimizations. */
163 opt3 = (optimize >= 3);
164 + flag_strict_aliasing = opt3;
165 + flag_strict_overflow = opt3;
166 flag_predictive_commoning = opt3;
167 flag_inline_functions = opt3;
168 flag_unswitch_loops = opt3;
169 @@ -1601,6 +1601,17 @@
170 enable_warning_as_error (arg, value, lang_mask);
171 break;
172
173 + case OPT_Werror_maybe_reset:
174 + {
175 + char *ev = getenv ("GCC_NO_WERROR");
176 + if ((ev != NULL) && (*ev != '0'))
177 + warnings_are_errors = 0;
178 + }
179 + break;
180 +
181 + case OPT_fhonour_copts:
182 + break;
183 +
184 case OPT_Wlarger_than_:
185 /* This form corresponds to -Wlarger-than-.
186 Kept for backward compatibility.
187 --- a/gcc/doc/cppopts.texi
188 +++ b/gcc/doc/cppopts.texi
189 @@ -164,6 +164,11 @@
190 Make all warnings into hard errors. Source code which triggers warnings
191 will be rejected.
192
193 + at item -Werror-maybe-reset
194 + at opindex Werror-maybe-reset
195 +Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment
196 +variable is set to anything other than 0 or empty.
197 +
198 @item -Wsystem-headers
199 @opindex Wsystem-headers
200 Issue warnings for code in system headers. These are normally unhelpful
201 --- a/gcc/doc/invoke.texi
202 +++ b/gcc/doc/invoke.texi
203 @@ -234,7 +234,7 @@
204 -Wconversion -Wcoverage-mismatch -Wno-deprecated @gol
205 -Wno-deprecated-declarations -Wdisabled-optimization @gol
206 -Wno-div-by-zero -Wempty-body -Wenum-compare -Wno-endif-labels @gol
207 --Werror -Werror=* @gol
208 +-Werror -Werror=* -Werror-maybe-reset @gol
209 -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
210 -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
211 -Wformat-security -Wformat-y2k @gol
212 @@ -4161,6 +4161,22 @@
213 @option{-Wall} and by @option{-pedantic}, which can be disabled with
214 @option{-Wno-pointer-sign}.
215
216 + at item -Werror-maybe-reset
217 + at opindex Werror-maybe-reset
218 +Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment
219 +variable is set to anything other than 0 or empty.
220 +
221 + at item -fhonour-copts
222 + at opindex fhonour-copts
223 +If @env{GCC_HONOUR_COPTS} is set to 1, abort if this option is not
224 +given at least once, and warn if it is given more than once.
225 +If @env{GCC_HONOUR_COPTS} is set to 2, abort if this option is not
226 +given exactly once.
227 +If @env{GCC_HONOUR_COPTS} is set to 0 or unset, warn if this option
228 +is not given exactly once.
229 +The warning is quelled if @env{GCC_HONOUR_COPTS} is set to @samp{s}.
230 +This flag and environment variable only affect the C language.
231 +
232 @item -Wstack-protector
233 @opindex Wstack-protector
234 @opindex Wno-stack-protector
235 @@ -5699,7 +5715,7 @@
236 second branch or a point immediately following it, depending on whether
237 the condition is known to be true or false.
238
239 -Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
240 +Enabled at levels @option{-O3}.
241
242 @item -fsplit-wide-types
243 @opindex fsplit-wide-types
244 --- a/gcc/java/jvspec.c
245 +++ b/gcc/java/jvspec.c
246 @@ -670,6 +670,7 @@
247 class name. Append dummy `.c' that can be stripped by set_input so %b
248 is correct. */
249 set_input (concat (main_class_name, "main.c", NULL));
250 + putenv ("GCC_HONOUR_COPTS=s"); /* XXX hack! */
251 err = do_spec (jvgenmain_spec);
252 if (err == 0)
253 {
This page took 0.04939 seconds and 5 git commands to generate.