source: trunk/toolchain/gcc/patches/4.5.1+l/910-mbsd_multi.patch @ 23703

Last change on this file since 23703 was 23703, checked in by kaloz, 6 years ago

[toolchain/gcc]: add support for Linaro GCC 2010.10

File size: 7.3 KB
  • gcc/c-opts.c

    	This patch brings over a few features from MirBSD:
    	* -fhonour-copts
    	  If this option is not given, it's warned (depending
    	  on environment variables). This is to catch errors
    	  of misbuilt packages which override CFLAGS themselves.
    	* -Werror-maybe-reset
    	  Has the effect of -Wno-error if GCC_NO_WERROR is
    	  set and not '0', a no-operation otherwise. This is
    	  to be able to use -Werror in "make" but prevent
    	  GNU autoconf generated configure scripts from
    	  freaking out.
    	* Make -fno-strict-aliasing and -fno-delete-null-pointer-checks
    	  the default for -O2/-Os, because they trigger gcc bugs
    	  and can delete code with security implications.
    
    	This patch was authored by Thorsten Glaser <tg at mirbsd.de>
    	with copyright assignment to the FSF in effect.
    
    a b  
    105105/* Number of deferred options scanned for -include.  */ 
    106106static size_t include_cursor; 
    107107 
     108/* Check if a port honours COPTS.  */ 
     109static int honour_copts = 0; 
     110 
    108111static void set_Wimplicit (int); 
    109112static void handle_OPT_d (const char *); 
    110113static void set_std_cxx98 (int); 
     
    454457      enable_warning_as_error ("implicit-function-declaration", value, CL_C | CL_ObjC);  
    455458      break; 
    456459 
     460    case OPT_Werror_maybe_reset: 
     461      break; 
     462 
    457463    case OPT_Wformat: 
    458464      set_Wformat (value); 
    459465      break; 
     
    690701      flag_exceptions = value; 
    691702      break; 
    692703 
     704    case OPT_fhonour_copts: 
     705      if (c_language == clk_c) { 
     706        honour_copts++; 
     707      } 
     708      break; 
     709 
    693710    case OPT_fimplement_inlines: 
    694711      flag_implement_inlines = value; 
    695712      break; 
     
    12091226      return false; 
    12101227    } 
    12111228 
     1229  if (c_language == clk_c) { 
     1230    char *ev = getenv ("GCC_HONOUR_COPTS"); 
     1231    int evv; 
     1232    if (ev == NULL) 
     1233      evv = -1; 
     1234    else if ((*ev == '0') || (*ev == '\0')) 
     1235      evv = 0; 
     1236    else if (*ev == '1') 
     1237      evv = 1; 
     1238    else if (*ev == '2') 
     1239      evv = 2; 
     1240    else if (*ev == 's') 
     1241      evv = -1; 
     1242    else { 
     1243      warning (0, "unknown GCC_HONOUR_COPTS value, assuming 1"); 
     1244      evv = 1; /* maybe depend this on something like MIRBSD_NATIVE?  */ 
     1245    } 
     1246    if (evv == 1) { 
     1247      if (honour_copts == 0) { 
     1248        error ("someone does not honour COPTS at all in lenient mode"); 
     1249        return false; 
     1250      } else if (honour_copts != 1) { 
     1251        warning (0, "someone does not honour COPTS correctly, passed %d times", 
     1252         honour_copts); 
     1253      } 
     1254    } else if (evv == 2) { 
     1255      if (honour_copts == 0) { 
     1256        error ("someone does not honour COPTS at all in strict mode"); 
     1257        return false; 
     1258      } else if (honour_copts != 1) { 
     1259        error ("someone does not honour COPTS correctly, passed %d times", 
     1260         honour_copts); 
     1261        return false; 
     1262      } 
     1263    } else if (evv == 0) { 
     1264      if (honour_copts != 1) 
     1265        inform (0, "someone does not honour COPTS correctly, passed %d times", 
     1266         honour_copts); 
     1267    } 
     1268  } 
     1269 
    12121270  return true; 
    12131271} 
    12141272 
  • gcc/c.opt

    a b  
    215215C ObjC RejectNegative Warning 
    216216This switch is deprecated; use -Werror=implicit-function-declaration instead 
    217217 
     218Werror-maybe-reset 
     219C ObjC C++ ObjC++ 
     220; Documented in common.opt 
     221 
    218222Wfloat-equal 
    219223C ObjC C++ ObjC++ Var(warn_float_equal) Warning 
    220224Warn if testing floating point numbers for equality 
     
    609613fhonor-std 
    610614C++ ObjC++ 
    611615 
     616fhonour-copts 
     617C ObjC C++ ObjC++ RejectNegative 
     618 
    612619fhosted 
    613620C ObjC 
    614621Assume normal C execution environment 
  • gcc/common.opt

    a b  
    102102Common Joined 
    103103Treat specified warning as error 
    104104 
     105Werror-maybe-reset 
     106Common 
     107If environment variable GCC_NO_WERROR is set, act as -Wno-error 
     108 
    105109Wextra 
    106110Common Warning 
    107111Print extra (possibly unwanted) warnings 
     
    573577Common Report Var(flag_guess_branch_prob) Optimization 
    574578Enable guessing of branch probabilities 
    575579 
     580fhonour-copts 
     581Common RejectNegative 
     582 
    576583; Nonzero means ignore `#ident' directives.  0 means handle them. 
    577584; Generate position-independent code for executables if possible 
    578585; On SVR4 targets, it also controls whether or not to emit a 
  • gcc/opts.c

    a b  
    896896  flag_schedule_insns_after_reload = opt2; 
    897897#endif 
    898898  flag_regmove = opt2; 
    899   flag_strict_aliasing = opt2; 
    900   flag_strict_overflow = opt2; 
    901899  flag_reorder_blocks = opt2; 
    902900  flag_reorder_functions = opt2; 
    903901  flag_tree_vrp = opt2; 
     
    922919 
    923920  /* -O3 optimizations.  */ 
    924921  opt3 = (optimize >= 3); 
     922  flag_strict_aliasing = opt3; 
     923  flag_strict_overflow = opt3; 
    925924  flag_predictive_commoning = opt3; 
    926925  flag_inline_functions = opt3; 
    927926  flag_unswitch_loops = opt3; 
     
    16011601      enable_warning_as_error (arg, value, lang_mask); 
    16021602      break; 
    16031603 
     1604    case OPT_Werror_maybe_reset: 
     1605      { 
     1606        char *ev = getenv ("GCC_NO_WERROR"); 
     1607        if ((ev != NULL) && (*ev != '0')) 
     1608          warnings_are_errors = 0; 
     1609      } 
     1610      break; 
     1611 
     1612    case OPT_fhonour_copts: 
     1613      break; 
     1614 
    16041615    case OPT_Wlarger_than_: 
    16051616      /* This form corresponds to -Wlarger-than-.  
    16061617         Kept for backward compatibility. 
  • gcc/doc/cppopts.texi

    a b  
    164164Make all warnings into hard errors.  Source code which triggers warnings 
    165165will be rejected. 
    166166 
     167 at item -Werror-maybe-reset 
     168 at opindex Werror-maybe-reset 
     169Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment 
     170variable is set to anything other than 0 or empty. 
     171 
    167172@item -Wsystem-headers 
    168173@opindex Wsystem-headers 
    169174Issue warnings for code in system headers.  These are normally unhelpful 
  • gcc/doc/invoke.texi

    a b  
    234234-Wconversion  -Wcoverage-mismatch  -Wno-deprecated  @gol 
    235235-Wno-deprecated-declarations -Wdisabled-optimization  @gol 
    236236-Wno-div-by-zero -Wdouble-promotion -Wempty-body  -Wenum-compare @gol 
    237 -Wno-endif-labels -Werror  -Werror=* @gol 
     237-Wno-endif-labels -Werror  -Werror=* -Werror-maybe-reset @gol 
    238238-Wfatal-errors  -Wfloat-equal  -Wformat  -Wformat=2 @gol 
    239239-Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol 
    240240-Wformat-security  -Wformat-y2k @gol 
     
    41614161@option{-Wall} and by @option{-pedantic}, which can be disabled with 
    41624162@option{-Wno-pointer-sign}. 
    41634163 
     4164 at item -Werror-maybe-reset 
     4165 at opindex Werror-maybe-reset 
     4166Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment 
     4167variable is set to anything other than 0 or empty. 
     4168 
     4169 at item -fhonour-copts 
     4170 at opindex fhonour-copts 
     4171If @env{GCC_HONOUR_COPTS} is set to 1, abort if this option is not 
     4172given at least once, and warn if it is given more than once. 
     4173If @env{GCC_HONOUR_COPTS} is set to 2, abort if this option is not 
     4174given exactly once. 
     4175If @env{GCC_HONOUR_COPTS} is set to 0 or unset, warn if this option 
     4176is not given exactly once. 
     4177The warning is quelled if @env{GCC_HONOUR_COPTS} is set to @samp{s}. 
     4178This flag and environment variable only affect the C language. 
     4179 
    41644180@item -Wstack-protector 
    41654181@opindex Wstack-protector 
    41664182@opindex Wno-stack-protector 
     
    56995715second branch or a point immediately following it, depending on whether 
    57005716the condition is known to be true or false. 
    57015717 
    5702 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 
     5718Enabled at levels @option{-O3}. 
    57035719 
    57045720@item -fsplit-wide-types 
    57055721@opindex fsplit-wide-types 
  • gcc/java/jvspec.c

    a b  
    670670     class name.  Append dummy `.c' that can be stripped by set_input so %b 
    671671     is correct.  */  
    672672  set_input (concat (main_class_name, "main.c", NULL)); 
     673  putenv ("GCC_HONOUR_COPTS=s"); /* XXX hack!  */ 
    673674  err = do_spec (jvgenmain_spec); 
    674675  if (err == 0) 
    675676    { 
Note: See TracBrowser for help on using the repository browser.