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
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 @@ -1048,6 +1057,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-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
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-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
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 @@ -1287,6 +1291,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-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
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-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
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
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
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-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
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);
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;