linux: bump all lts / stable to latest
[openadk.git] / toolchain / gcc / patches / 4.9.4 / cflags.patch
blobd4119cd3939557bbf26f958799b368baf20c18a2
1 diff -Nur gcc-4.9.1.orig/gcc/c-family/c-opts.c gcc-4.9.1/gcc/c-family/c-opts.c
2 --- gcc-4.9.1.orig/gcc/c-family/c-opts.c 2014-05-06 12:48:08.000000000 +0200
3 +++ gcc-4.9.1/gcc/c-family/c-opts.c 2014-08-05 15:54:02.000000000 +0200
4 @@ -105,6 +105,9 @@
5 /* Whether any standard preincluded header has been preincluded. */
6 static bool done_preinclude;
8 +/* Check if a port honours COPTS. */
9 +static int honour_copts = 0;
11 static void handle_OPT_d (const char *);
12 static void set_std_cxx98 (int);
13 static void set_std_cxx11 (int);
14 @@ -492,6 +495,12 @@
15 flag_no_builtin = !value;
16 break;
18 + case OPT_fhonour_copts:
19 + if (c_language == clk_c) {
20 + honour_copts++;
21 + }
22 + break;
24 case OPT_fconstant_string_class_:
25 constant_string_class_name = arg;
26 break;
27 @@ -1048,6 +1057,47 @@
28 return false;
31 + if (c_language == clk_c) {
32 + char *ev = getenv ("GCC_HONOUR_COPTS");
33 + int evv;
34 + if (ev == NULL)
35 + evv = -1;
36 + else if ((*ev == '0') || (*ev == '\0'))
37 + evv = 0;
38 + else if (*ev == '1')
39 + evv = 1;
40 + else if (*ev == '2')
41 + evv = 2;
42 + else if (*ev == 's')
43 + evv = -1;
44 + else {
45 + warning (0, "unknown GCC_HONOUR_COPTS value, assuming 1");
46 + evv = 1; /* maybe depend this on something like MIRBSD_NATIVE? */
47 + }
48 + if (evv == 1) {
49 + if (honour_copts == 0) {
50 + error ("someone does not honour COPTS at all in lenient mode");
51 + return false;
52 + } else if (honour_copts != 1) {
53 + warning (0, "someone does not honour COPTS correctly, passed %d times",
54 + honour_copts);
55 + }
56 + } else if (evv == 2) {
57 + if (honour_copts == 0) {
58 + error ("someone does not honour COPTS at all in strict mode");
59 + return false;
60 + } else if (honour_copts != 1) {
61 + error ("someone does not honour COPTS correctly, passed %d times",
62 + honour_copts);
63 + return false;
64 + }
65 + } else if (evv == 0) {
66 + if (honour_copts != 1)
67 + inform (0, "someone does not honour COPTS correctly, passed %d times",
68 + honour_copts);
69 + }
70 + }
72 return true;
75 diff -Nur gcc-4.9.1.orig/gcc/c-family/c.opt gcc-4.9.1/gcc/c-family/c.opt
76 --- gcc-4.9.1.orig/gcc/c-family/c.opt 2014-04-03 15:41:55.000000000 +0200
77 +++ gcc-4.9.1/gcc/c-family/c.opt 2014-08-05 15:54:02.000000000 +0200
78 @@ -391,6 +391,10 @@
79 C ObjC C++ ObjC++ Var(warn_float_conversion) LangEnabledBy(C ObjC C++ ObjC++,Wconversion)
80 Warn for implicit type conversions that cause loss of floating point precision
82 +Werror-maybe-reset
83 +C ObjC C++ ObjC++
84 +; Documented in common.opt
86 Wfloat-equal
87 C ObjC C++ ObjC++ Var(warn_float_equal) Warning
88 Warn if testing floating point numbers for equality
89 @@ -972,6 +976,9 @@
90 fhonor-std
91 C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
93 +fhonour-copts
94 +C ObjC C++ ObjC++ RejectNegative
96 fhosted
97 C ObjC
98 Assume normal C execution environment
99 diff -Nur gcc-4.9.1.orig/gcc/common.opt gcc-4.9.1/gcc/common.opt
100 --- gcc-4.9.1.orig/gcc/common.opt 2014-04-07 15:27:39.000000000 +0200
101 +++ gcc-4.9.1/gcc/common.opt 2014-08-05 15:54:02.000000000 +0200
102 @@ -549,6 +549,10 @@
103 Common Joined
104 Treat specified warning as error
106 +Werror-maybe-reset
107 +Common
108 +If environment variable GCC_NO_WERROR is set, act as -Wno-error
110 Wextra
111 Common Var(extra_warnings) Warning
112 Print extra (possibly unwanted) warnings
113 @@ -1287,6 +1291,9 @@
114 Common Report Var(flag_guess_branch_prob) Optimization
115 Enable guessing of branch probabilities
117 +fhonour-copts
118 +Common RejectNegative
120 ; Nonzero means ignore `#ident' directives. 0 means handle them.
121 ; Generate position-independent code for executables if possible
122 ; On SVR4 targets, it also controls whether or not to emit a
123 diff -Nur gcc-4.9.1.orig/gcc/doc/cppopts.texi gcc-4.9.1/gcc/doc/cppopts.texi
124 --- gcc-4.9.1.orig/gcc/doc/cppopts.texi 2014-01-02 23:23:26.000000000 +0100
125 +++ gcc-4.9.1/gcc/doc/cppopts.texi 2014-08-05 15:54:02.000000000 +0200
126 @@ -163,6 +163,11 @@
127 Make all warnings into hard errors. Source code which triggers warnings
128 will be rejected.
130 + at item -Werror-maybe-reset
131 + at opindex Werror-maybe-reset
132 +Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment
133 +variable is set to anything other than 0 or empty.
135 @item -Wsystem-headers
136 @opindex Wsystem-headers
137 Issue warnings for code in system headers. These are normally unhelpful
138 diff -Nur gcc-4.9.1.orig/gcc/doc/invoke.texi gcc-4.9.1/gcc/doc/invoke.texi
139 --- gcc-4.9.1.orig/gcc/doc/invoke.texi 2014-05-28 13:37:50.000000000 +0200
140 +++ gcc-4.9.1/gcc/doc/invoke.texi 2014-08-05 15:54:02.000000000 +0200
141 @@ -243,7 +243,7 @@
142 -Wconversion -Wcoverage-mismatch -Wdate-time -Wdelete-incomplete -Wno-cpp @gol
143 -Wno-deprecated -Wno-deprecated-declarations -Wdisabled-optimization @gol
144 -Wno-div-by-zero -Wdouble-promotion -Wempty-body -Wenum-compare @gol
145 --Wno-endif-labels -Werror -Werror=* @gol
146 +-Wno-endif-labels -Werror -Werror=* -Werror-maybe-reset @gol
147 -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
148 -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
149 -Wformat-security -Wformat-y2k @gol
150 @@ -5041,6 +5041,22 @@
151 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
152 @option{-Wno-pointer-sign}.
154 + at item -Werror-maybe-reset
155 + at opindex Werror-maybe-reset
156 +Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment
157 +variable is set to anything other than 0 or empty.
159 + at item -fhonour-copts
160 + at opindex fhonour-copts
161 +If @env{GCC_HONOUR_COPTS} is set to 1, abort if this option is not
162 +given at least once, and warn if it is given more than once.
163 +If @env{GCC_HONOUR_COPTS} is set to 2, abort if this option is not
164 +given exactly once.
165 +If @env{GCC_HONOUR_COPTS} is set to 0 or unset, warn if this option
166 +is not given exactly once.
167 +The warning is quelled if @env{GCC_HONOUR_COPTS} is set to @samp{s}.
168 +This flag and environment variable only affect the C language.
170 @item -Wstack-protector
171 @opindex Wstack-protector
172 @opindex Wno-stack-protector
173 @@ -7188,7 +7204,7 @@
174 second branch or a point immediately following it, depending on whether
175 the condition is known to be true or false.
177 -Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
178 +Enabled at levels @option{-O3}.
180 @item -fsplit-wide-types
181 @opindex fsplit-wide-types
182 diff -Nur gcc-4.9.1.orig/gcc/java/jvspec.c gcc-4.9.1/gcc/java/jvspec.c
183 --- gcc-4.9.1.orig/gcc/java/jvspec.c 2014-01-02 23:23:26.000000000 +0100
184 +++ gcc-4.9.1/gcc/java/jvspec.c 2014-08-05 15:54:02.000000000 +0200
185 @@ -626,6 +626,7 @@
186 class name. Append dummy `.c' that can be stripped by set_input so %b
187 is correct. */
188 set_input (concat (main_class_name, "main.c", NULL));
189 + putenv ("GCC_HONOUR_COPTS=s"); /* XXX hack! */
190 err = do_spec (jvgenmain_spec);
191 if (err == 0)
193 diff -Nur gcc-4.9.1.orig/gcc/opts.c gcc-4.9.1/gcc/opts.c
194 --- gcc-4.9.1.orig/gcc/opts.c 2014-05-18 00:20:43.000000000 +0200
195 +++ gcc-4.9.1/gcc/opts.c 2014-08-05 15:54:02.000000000 +0200
196 @@ -499,6 +499,8 @@
197 { OPT_LEVELS_2_PLUS, OPT_fisolate_erroneous_paths_dereference, NULL, 1 },
199 /* -O3 optimizations. */
200 + { OPT_LEVELS_3_PLUS, OPT_fstrict_aliasing, NULL, 1 },
201 + { OPT_LEVELS_3_PLUS, OPT_fstrict_overflow, NULL, 1 },
202 { OPT_LEVELS_3_PLUS, OPT_ftree_loop_distribute_patterns, NULL, 1 },
203 { OPT_LEVELS_3_PLUS, OPT_fpredictive_commoning, NULL, 1 },
204 /* Inlining of functions reducing size is a good idea with -Os
205 @@ -1536,6 +1538,17 @@
206 opts, opts_set, loc, dc);
207 break;
209 + case OPT_Werror_maybe_reset:
211 + char *ev = getenv ("GCC_NO_WERROR");
212 + if ((ev != NULL) && (*ev != '0'))
213 + warnings_are_errors = 0;
215 + break;
217 + case OPT_fhonour_copts:
218 + break;
220 case OPT_Wlarger_than_:
221 opts->x_larger_than_size = value;
222 opts->x_warn_larger_than = value != -1;