2 This patch brings over a few features from MirBSD:
4 If this option is not given, it's warned (depending
5 on environment variables). This is to catch errors
6 of misbuilt packages which override CFLAGS themselves.
7 * Make -fno-strict-aliasing and -fno-delete-null-pointer-checks
8 the default for -O2/-Os, because they trigger gcc bugs
9 and can delete code with security implications.
11 This patch was authored by Thorsten Glaser <tg at mirbsd.de>
12 with copyright assignment to the FSF in effect.
17 /* Number of deferred options scanned for -include. */
18 static size_t include_cursor;
20 +/* Check if a port honours COPTS. */
21 +static int honour_copts = 0;
23 static void set_Wimplicit (int);
24 static void handle_OPT_d (const char *);
25 static void set_std_cxx98 (int);
27 flag_exceptions = value;
30 + case OPT_fhonour_copts:
31 + if (c_language == clk_c) {
36 case OPT_fimplement_inlines:
37 flag_implement_inlines = value;
39 @@ -1209,6 +1226,47 @@
43 + if (c_language == clk_c) {
44 + char *ev = getenv ("GCC_HONOUR_COPTS");
48 + else if ((*ev == '0') || (*ev == '\0'))
50 + else if (*ev == '1')
52 + else if (*ev == '2')
54 + else if (*ev == 's')
57 + warning (0, "unknown GCC_HONOUR_COPTS value, assuming 1");
58 + evv = 1; /* maybe depend this on something like MIRBSD_NATIVE? */
61 + if (honour_copts == 0) {
62 + error ("someone does not honour COPTS at all in lenient mode");
64 + } else if (honour_copts != 1) {
65 + warning (0, "someone does not honour COPTS correctly, passed %d times",
68 + } else if (evv == 2) {
69 + if (honour_copts == 0) {
70 + error ("someone does not honour COPTS at all in strict mode");
72 + } else if (honour_copts != 1) {
73 + error ("someone does not honour COPTS correctly, passed %d times",
77 + } else if (evv == 0) {
78 + if (honour_copts != 1)
79 + inform (0, "someone does not honour COPTS correctly, passed %d times",
94 +C ObjC C++ ObjC++ RejectNegative
98 Assume normal C execution environment
102 Common Report Var(flag_guess_branch_prob) Optimization
103 Enable guessing of branch probabilities
106 +Common RejectNegative
108 ; Nonzero means ignore `#ident' directives. 0 means handle them.
109 ; Generate position-independent code for executables if possible
110 ; On SVR4 targets, it also controls whether or not to emit a
114 flag_schedule_insns_after_reload = opt2;
117 - flag_strict_aliasing = opt2;
118 - flag_strict_overflow = opt2;
119 - flag_delete_null_pointer_checks = opt2;
120 flag_reorder_blocks = opt2;
121 flag_reorder_functions = opt2;
122 flag_tree_vrp = opt2;
125 /* -O3 optimizations. */
126 opt3 = (optimize >= 3);
127 + flag_strict_aliasing = opt3;
128 + flag_strict_overflow = opt3;
129 + flag_delete_null_pointer_checks = opt3;
130 flag_predictive_commoning = opt3;
131 flag_inline_functions = opt3;
132 flag_unswitch_loops = opt3;
133 --- a/gcc/doc/invoke.texi
134 +++ b/gcc/doc/invoke.texi
135 @@ -5699,7 +5715,7 @@
136 second branch or a point immediately following it, depending on whether
137 the condition is known to be true or false.
139 -Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
140 +Enabled at levels @option{-O3}.
142 @item -fsplit-wide-types
143 @opindex fsplit-wide-types
144 @@ -5844,7 +5860,7 @@
145 @option{-fno-delete-null-pointer-checks} to disable this optimization
146 for programs which depend on that behavior.
148 -Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
149 +Enabled at levels @option{-O3}.
151 @item -fexpensive-optimizations
152 @opindex fexpensive-optimizations
153 --- a/gcc/java/jvspec.c
154 +++ b/gcc/java/jvspec.c
156 class name. Append dummy `.c' that can be stripped by set_input so %b
158 set_input (concat (main_class_name, "main.c", NULL));
159 + putenv ("GCC_HONOUR_COPTS=s"); /* XXX hack! */
160 err = do_spec (jvgenmain_spec);