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
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);
15 flag_no_builtin = !value;
18 + case OPT_fhonour_copts:
19 + if (c_language == clk_c) {
24 case OPT_fconstant_string_class_:
25 constant_string_class_name = arg;
27 @@ -1034,6 +1043,47 @@
31 + if (c_language == clk_c) {
32 + char *ev = getenv ("GCC_HONOUR_COPTS");
36 + else if ((*ev == '0') || (*ev == '\0'))
38 + else if (*ev == '1')
40 + else if (*ev == '2')
42 + else if (*ev == 's')
45 + warning (0, "unknown GCC_HONOUR_COPTS value, assuming 1");
46 + evv = 1; /* maybe depend this on something like MIRBSD_NATIVE? */
49 + if (honour_copts == 0) {
50 + error ("someone does not honour COPTS at all in lenient mode");
52 + } else if (honour_copts != 1) {
53 + warning (0, "someone does not honour COPTS correctly, passed %d times",
56 + } else if (evv == 2) {
57 + if (honour_copts == 0) {
58 + error ("someone does not honour COPTS at all in strict mode");
60 + } else if (honour_copts != 1) {
61 + error ("someone does not honour COPTS correctly, passed %d times",
65 + } else if (evv == 0) {
66 + if (honour_copts != 1)
67 + inform (0, "someone does not honour COPTS correctly, passed %d times",
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
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
84 +; Documented in common.opt
87 C ObjC C++ ObjC++ Var(warn_float_equal) Warning
88 Warn if testing floating point numbers for equality
91 C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
94 +C ObjC C++ ObjC++ RejectNegative
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
104 Treat specified warning as error
108 +If environment variable GCC_NO_WERROR is set, act as -Wno-error
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
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
127 Make all warnings into hard errors. Source code which triggers warnings
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
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
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
186 class name. Append dummy `.c' that can be stripped by set_input so %b
188 set_input (concat (main_class_name, "main.c", NULL));
189 + putenv ("GCC_HONOUR_COPTS=s"); /* XXX hack! */
190 err = do_spec (jvgenmain_spec);
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
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);
209 + case OPT_Werror_maybe_reset:
211 + char *ev = getenv ("GCC_NO_WERROR");
212 + if ((ev != NULL) && (*ev != '0'))
213 + warnings_are_errors = 0;
217 + case OPT_fhonour_copts:
220 case OPT_Wlarger_than_:
221 opts->x_larger_than_size = value;
222 opts->x_warn_larger_than = value != -1;