linux: bump all lts / stable to latest
[openadk.git] / package / gcc / patches / 5.4.0 / cflags.patch
blob7ebb5e548907d5fd6f598fea95e777523dac4cb5
1 diff -Nur gcc-5.1.0.orig/gcc/c-family/c-opts.c gcc-5.1.0/gcc/c-family/c-opts.c
2 --- gcc-5.1.0.orig/gcc/c-family/c-opts.c 2015-02-13 06:26:37.000000000 +0100
3 +++ gcc-5.1.0/gcc/c-family/c-opts.c 2015-05-01 23:07:27.000000000 +0200
4 @@ -122,6 +122,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 @@ -449,6 +452,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 @@ -1034,6 +1043,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-5.1.0.orig/gcc/c-family/c.opt gcc-5.1.0/gcc/c-family/c.opt
76 --- gcc-5.1.0.orig/gcc/c-family/c.opt 2015-03-27 11:29:04.000000000 +0100
77 +++ gcc-5.1.0/gcc/c-family/c.opt 2015-05-01 23:07:27.000000000 +0200
78 @@ -431,6 +431,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 @@ -1161,6 +1165,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-5.1.0.orig/gcc/common.opt gcc-5.1.0/gcc/common.opt
100 --- gcc-5.1.0.orig/gcc/common.opt 2015-02-27 03:06:48.000000000 +0100
101 +++ gcc-5.1.0/gcc/common.opt 2015-05-01 23:07:27.000000000 +0200
102 @@ -561,6 +561,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 @@ -1357,6 +1361,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-5.1.0.orig/gcc/doc/cppopts.texi gcc-5.1.0/gcc/doc/cppopts.texi
124 --- gcc-5.1.0.orig/gcc/doc/cppopts.texi 2015-03-23 02:12:06.000000000 +0100
125 +++ gcc-5.1.0/gcc/doc/cppopts.texi 2015-05-01 23:07:27.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-5.1.0.orig/gcc/doc/invoke.texi gcc-5.1.0/gcc/doc/invoke.texi
139 --- gcc-5.1.0.orig/gcc/doc/invoke.texi 2015-04-12 21:29:44.000000000 +0200
140 +++ gcc-5.1.0/gcc/doc/invoke.texi 2015-05-01 23:07:27.000000000 +0200
141 @@ -251,7 +251,7 @@
142 -Wdisabled-optimization @gol
143 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @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-signedness -Wformat-y2k @gol
150 @@ -5370,6 +5370,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 @@ -7843,7 +7859,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-5.1.0.orig/gcc/java/jvspec.c gcc-5.1.0/gcc/java/jvspec.c
183 --- gcc-5.1.0.orig/gcc/java/jvspec.c 2015-01-30 17:15:00.000000000 +0100
184 +++ gcc-5.1.0/gcc/java/jvspec.c 2015-05-01 23:07:27.000000000 +0200
185 @@ -629,6 +629,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-5.1.0.orig/gcc/opts.c gcc-5.1.0/gcc/opts.c
194 --- gcc-5.1.0.orig/gcc/opts.c 2015-02-17 22:25:56.000000000 +0100
195 +++ gcc-5.1.0/gcc/opts.c 2015-05-01 23:07:27.000000000 +0200
196 @@ -511,6 +511,8 @@
197 { OPT_LEVELS_2_PLUS, OPT_flra_remat, 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 @@ -1699,6 +1701,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;