linux: bump all lts / stable to latest
[openadk.git] / toolchain / gcc / patches / 4.4.7 / cflags.patch
blob7952d71fec515cba589d7dd652ce23cd7518565c
1 diff -Nur gcc-4.4.7.orig/gcc/common.opt gcc-4.4.7/gcc/common.opt
2 --- gcc-4.4.7.orig/gcc/common.opt 2009-03-28 18:28:45.000000000 +0100
3 +++ gcc-4.4.7/gcc/common.opt 2014-09-09 19:50:59.000000000 +0200
4 @@ -102,6 +102,10 @@
5 Common Joined
6 Treat specified warning as error
8 +Werror-maybe-reset
9 +Common
10 +If environment variable GCC_NO_WERROR is set, act as -Wno-error
12 Wextra
13 Common Warning
14 Print extra (possibly unwanted) warnings
15 @@ -573,6 +577,9 @@
16 Common Report Var(flag_guess_branch_prob) Optimization
17 Enable guessing of branch probabilities
19 +fhonour-copts
20 +Common RejectNegative
22 ; Nonzero means ignore `#ident' directives. 0 means handle them.
23 ; Generate position-independent code for executables if possible
24 ; On SVR4 targets, it also controls whether or not to emit a
25 diff -Nur gcc-4.4.7.orig/gcc/c.opt gcc-4.4.7/gcc/c.opt
26 --- gcc-4.4.7.orig/gcc/c.opt 2009-09-18 23:53:23.000000000 +0200
27 +++ gcc-4.4.7/gcc/c.opt 2014-09-09 19:50:59.000000000 +0200
28 @@ -215,6 +215,10 @@
29 C ObjC RejectNegative Warning
30 This switch is deprecated; use -Werror=implicit-function-declaration instead
32 +Werror-maybe-reset
33 +C ObjC C++ ObjC++
34 +; Documented in common.opt
36 Wfloat-equal
37 C ObjC C++ ObjC++ Var(warn_float_equal) Warning
38 Warn if testing floating point numbers for equality
39 @@ -613,6 +617,9 @@
40 fhonor-std
41 C++ ObjC++
43 +fhonour-copts
44 +C ObjC C++ ObjC++ RejectNegative
46 fhosted
47 C ObjC
48 Assume normal C execution environment
49 diff -Nur gcc-4.4.7.orig/gcc/c-opts.c gcc-4.4.7/gcc/c-opts.c
50 --- gcc-4.4.7.orig/gcc/c-opts.c 2009-02-18 03:16:03.000000000 +0100
51 +++ gcc-4.4.7/gcc/c-opts.c 2014-09-09 19:50:59.000000000 +0200
52 @@ -105,6 +105,9 @@
53 /* Number of deferred options scanned for -include. */
54 static size_t include_cursor;
56 +/* Check if a port honours COPTS. */
57 +static int honour_copts = 0;
59 static void set_Wimplicit (int);
60 static void handle_OPT_d (const char *);
61 static void set_std_cxx98 (int);
62 @@ -454,6 +457,14 @@
63 enable_warning_as_error ("implicit-function-declaration", value, CL_C | CL_ObjC);
64 break;
66 + case OPT_Werror_maybe_reset:
67 + {
68 + char *ev = getenv ("GCC_NO_WERROR");
69 + if ((ev != NULL) && (*ev != '0'))
70 + cpp_opts->warnings_are_errors = 0;
71 + }
72 + break;
74 case OPT_Wformat:
75 set_Wformat (value);
76 break;
77 @@ -690,6 +701,12 @@
78 flag_exceptions = value;
79 break;
81 + case OPT_fhonour_copts:
82 + if (c_language == clk_c) {
83 + honour_copts++;
84 + }
85 + break;
87 case OPT_fimplement_inlines:
88 flag_implement_inlines = value;
89 break;
90 @@ -1209,6 +1226,47 @@
91 return false;
94 + if (c_language == clk_c) {
95 + char *ev = getenv ("GCC_HONOUR_COPTS");
96 + int evv;
97 + if (ev == NULL)
98 + evv = -1;
99 + else if ((*ev == '0') || (*ev == '\0'))
100 + evv = 0;
101 + else if (*ev == '1')
102 + evv = 1;
103 + else if (*ev == '2')
104 + evv = 2;
105 + else if (*ev == 's')
106 + evv = -1;
107 + else {
108 + warning (0, "unknown GCC_HONOUR_COPTS value, assuming 1");
109 + evv = 1; /* maybe depend this on something like MIRBSD_NATIVE? */
111 + if (evv == 1) {
112 + if (honour_copts == 0) {
113 + error ("someone does not honour COPTS at all in lenient mode");
114 + return false;
115 + } else if (honour_copts != 1) {
116 + warning (0, "someone does not honour COPTS correctly, passed %d times",
117 + honour_copts);
119 + } else if (evv == 2) {
120 + if (honour_copts == 0) {
121 + error ("someone does not honour COPTS at all in strict mode");
122 + return false;
123 + } else if (honour_copts != 1) {
124 + error ("someone does not honour COPTS correctly, passed %d times",
125 + honour_copts);
126 + return false;
128 + } else if (evv == 0) {
129 + if (honour_copts != 1)
130 + inform (0, "someone does not honour COPTS correctly, passed %d times",
131 + honour_copts);
135 return true;
138 diff -Nur gcc-4.4.7.orig/gcc/doc/cppopts.texi gcc-4.4.7/gcc/doc/cppopts.texi
139 --- gcc-4.4.7.orig/gcc/doc/cppopts.texi 2008-06-15 11:42:13.000000000 +0200
140 +++ gcc-4.4.7/gcc/doc/cppopts.texi 2014-09-09 19:50:59.000000000 +0200
141 @@ -164,6 +164,11 @@
142 Make all warnings into hard errors. Source code which triggers warnings
143 will be rejected.
145 + at item -Werror-maybe-reset
146 + at opindex Werror-maybe-reset
147 +Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment
148 +variable is set to anything other than 0 or empty.
150 @item -Wsystem-headers
151 @opindex Wsystem-headers
152 Issue warnings for code in system headers. These are normally unhelpful
153 diff -Nur gcc-4.4.7.orig/gcc/doc/invoke.texi gcc-4.4.7/gcc/doc/invoke.texi
154 --- gcc-4.4.7.orig/gcc/doc/invoke.texi 2011-03-23 23:02:12.000000000 +0100
155 +++ gcc-4.4.7/gcc/doc/invoke.texi 2014-09-09 19:50:59.000000000 +0200
156 @@ -234,7 +234,7 @@
157 -Wconversion -Wcoverage-mismatch -Wno-deprecated @gol
158 -Wno-deprecated-declarations -Wdisabled-optimization @gol
159 -Wno-div-by-zero -Wempty-body -Wenum-compare -Wno-endif-labels @gol
160 --Werror -Werror=* @gol
161 +-Werror -Werror=* -Werror-maybe-reset @gol
162 -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
163 -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
164 -Wformat-security -Wformat-y2k @gol
165 @@ -4182,6 +4182,22 @@
166 @option{-Wall} and by @option{-pedantic}, which can be disabled with
167 @option{-Wno-pointer-sign}.
169 + at item -Werror-maybe-reset
170 + at opindex Werror-maybe-reset
171 +Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment
172 +variable is set to anything other than 0 or empty.
174 + at item -fhonour-copts
175 + at opindex fhonour-copts
176 +If @env{GCC_HONOUR_COPTS} is set to 1, abort if this option is not
177 +given at least once, and warn if it is given more than once.
178 +If @env{GCC_HONOUR_COPTS} is set to 2, abort if this option is not
179 +given exactly once.
180 +If @env{GCC_HONOUR_COPTS} is set to 0 or unset, warn if this option
181 +is not given exactly once.
182 +The warning is quelled if @env{GCC_HONOUR_COPTS} is set to @samp{s}.
183 +This flag and environment variable only affect the C language.
185 @item -Wstack-protector
186 @opindex Wstack-protector
187 @opindex Wno-stack-protector
188 @@ -5721,7 +5737,7 @@
189 second branch or a point immediately following it, depending on whether
190 the condition is known to be true or false.
192 -Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
193 +Enabled at levels @option{-O3}.
195 @item -fsplit-wide-types
196 @opindex fsplit-wide-types
197 @@ -5866,7 +5882,7 @@
198 @option{-fno-delete-null-pointer-checks} to disable this optimization
199 for programs which depend on that behavior.
201 -Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
202 +Enabled at levels @option{-O3}.
204 @item -fexpensive-optimizations
205 @opindex fexpensive-optimizations
206 diff -Nur gcc-4.4.7.orig/gcc/java/jvspec.c gcc-4.4.7/gcc/java/jvspec.c
207 --- gcc-4.4.7.orig/gcc/java/jvspec.c 2007-07-31 18:19:49.000000000 +0200
208 +++ gcc-4.4.7/gcc/java/jvspec.c 2014-09-09 19:50:59.000000000 +0200
209 @@ -670,6 +670,7 @@
210 class name. Append dummy `.c' that can be stripped by set_input so %b
211 is correct. */
212 set_input (concat (main_class_name, "main.c", NULL));
213 + putenv ("GCC_HONOUR_COPTS=s"); /* XXX hack! */
214 err = do_spec (jvgenmain_spec);
215 if (err == 0)
217 diff -Nur gcc-4.4.7.orig/gcc/opts.c gcc-4.4.7/gcc/opts.c
218 --- gcc-4.4.7.orig/gcc/opts.c 2009-11-27 12:34:32.000000000 +0100
219 +++ gcc-4.4.7/gcc/opts.c 2014-09-09 19:50:59.000000000 +0200
220 @@ -898,9 +898,6 @@
221 flag_schedule_insns_after_reload = opt2;
222 #endif
223 flag_regmove = opt2;
224 - flag_strict_aliasing = opt2;
225 - flag_strict_overflow = opt2;
226 - flag_delete_null_pointer_checks = opt2;
227 flag_reorder_blocks = opt2;
228 flag_reorder_functions = opt2;
229 flag_tree_vrp = opt2;
230 @@ -924,6 +921,9 @@
232 /* -O3 optimizations. */
233 opt3 = (optimize >= 3);
234 + flag_strict_aliasing = opt3;
235 + flag_strict_overflow = opt3;
236 + flag_delete_null_pointer_checks = opt3;
237 flag_predictive_commoning = opt3;
238 flag_inline_functions = opt3;
239 flag_unswitch_loops = opt3;
240 @@ -1603,6 +1603,17 @@
241 enable_warning_as_error (arg, value, lang_mask);
242 break;
244 + case OPT_Werror_maybe_reset:
246 + char *ev = getenv ("GCC_NO_WERROR");
247 + if ((ev != NULL) && (*ev != '0'))
248 + warnings_are_errors = 0;
250 + break;
252 + case OPT_fhonour_copts:
253 + break;
255 case OPT_Wextra:
256 set_Wextra (value);
257 break;