1
0

cflags.patch 8.1 KB

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