source: trunk/toolchain/gcc/patches/4.7.0/910-mbsd_multi.patch @ 31216

Last change on this file since 31216 was 31216, checked in by mirko, 5 years ago

[toolchain/gcc] add support for gcc 4.7.0 - thanks to acoul!

File size: 8.4 KB
  • gcc/c-family/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 static size_t deferred_count; 
    108108/* Number of deferred options scanned for -include.  */ 
    109109static size_t include_cursor; 
    110110 
     111/* Check if a port honours COPTS.  */ 
     112static int honour_copts = 0; 
     113 
    111114static void handle_OPT_d (const char *); 
    112115static void set_std_cxx98 (int); 
    113116static void set_std_cxx11 (int); 
    c_common_handle_option (size_t scode, co 
    449452      cpp_opts->warn_endif_labels = value; 
    450453      break; 
    451454 
     455    case OPT_Werror_maybe_reset: 
     456      break; 
     457 
    452458    case OPT_Wformat: 
    453459      set_Wformat (value); 
    454460      break; 
    c_common_handle_option (size_t scode, co 
    592598      flag_no_builtin = !value; 
    593599      break; 
    594600 
     601    case OPT_fhonour_copts: 
     602      if (c_language == clk_c) { 
     603        honour_copts++; 
     604      } 
     605      break; 
     606 
    595607    case OPT_fconstant_string_class_: 
    596608      constant_string_class_name = arg; 
    597609      break; 
    c_common_init (void) 
    10981110      return false; 
    10991111    } 
    11001112 
     1113  if (c_language == clk_c) { 
     1114    char *ev = getenv ("GCC_HONOUR_COPTS"); 
     1115    int evv; 
     1116    if (ev == NULL) 
     1117      evv = -1; 
     1118    else if ((*ev == '0') || (*ev == '\0')) 
     1119      evv = 0; 
     1120    else if (*ev == '1') 
     1121      evv = 1; 
     1122    else if (*ev == '2') 
     1123      evv = 2; 
     1124    else if (*ev == 's') 
     1125      evv = -1; 
     1126    else { 
     1127      warning (0, "unknown GCC_HONOUR_COPTS value, assuming 1"); 
     1128      evv = 1; /* maybe depend this on something like MIRBSD_NATIVE?  */ 
     1129    } 
     1130    if (evv == 1) { 
     1131      if (honour_copts == 0) { 
     1132        error ("someone does not honour COPTS at all in lenient mode"); 
     1133        return false; 
     1134      } else if (honour_copts != 1) { 
     1135        warning (0, "someone does not honour COPTS correctly, passed %d times", 
     1136         honour_copts); 
     1137      } 
     1138    } else if (evv == 2) { 
     1139      if (honour_copts == 0) { 
     1140        error ("someone does not honour COPTS at all in strict mode"); 
     1141        return false; 
     1142      } else if (honour_copts != 1) { 
     1143        error ("someone does not honour COPTS correctly, passed %d times", 
     1144         honour_copts); 
     1145        return false; 
     1146      } 
     1147    } else if (evv == 0) { 
     1148      if (honour_copts != 1) 
     1149        inform (0, "someone does not honour COPTS correctly, passed %d times", 
     1150         honour_copts); 
     1151    } 
     1152  } 
     1153 
    11011154  return true; 
    11021155} 
    11031156 
  • gcc/c-family/c.opt

    a b Werror-implicit-function-declaration 
    371371C ObjC RejectNegative Warning Alias(Werror=, implicit-function-declaration) 
    372372This switch is deprecated; use -Werror=implicit-function-declaration instead 
    373373 
     374Werror-maybe-reset 
     375C ObjC C++ ObjC++ 
     376; Documented in common.opt 
     377 
    374378Wfloat-equal 
    375379C ObjC C++ ObjC++ Var(warn_float_equal) Warning 
    376380Warn if testing floating point numbers for equality 
    C++ ObjC++ Optimization Alias(fexception 
    830834fhonor-std 
    831835C++ ObjC++ Ignore Warn(switch %qs is no longer supported) 
    832836 
     837fhonour-copts 
     838C ObjC C++ ObjC++ RejectNegative 
     839 
    833840fhosted 
    834841C ObjC 
    835842Assume normal C execution environment 
  • gcc/common.opt

    a b Werror= 
    531531Common Joined 
    532532Treat specified warning as error 
    533533 
     534Werror-maybe-reset 
     535Common 
     536If environment variable GCC_NO_WERROR is set, act as -Wno-error 
     537 
    534538Wextra 
    535539Common Var(extra_warnings) Warning 
    536540Print extra (possibly unwanted) warnings 
    fguess-branch-probability 
    12091213Common Report Var(flag_guess_branch_prob) Optimization 
    12101214Enable guessing of branch probabilities 
    12111215 
     1216fhonour-copts 
     1217Common RejectNegative 
     1218 
    12121219; Nonzero means ignore `#ident' directives.  0 means handle them. 
    12131220; Generate position-independent code for executables if possible 
    12141221; On SVR4 targets, it also controls whether or not to emit a 
  • gcc/opts.c

    a b static const struct default_options defa 
    470470    { OPT_LEVELS_2_PLUS, OPT_fschedule_insns2, NULL, 1 }, 
    471471#endif 
    472472    { OPT_LEVELS_2_PLUS, OPT_fregmove, NULL, 1 }, 
    473     { OPT_LEVELS_2_PLUS, OPT_fstrict_aliasing, NULL, 1 }, 
    474     { OPT_LEVELS_2_PLUS, OPT_fstrict_overflow, NULL, 1 }, 
    475473    { OPT_LEVELS_2_PLUS, OPT_freorder_blocks, NULL, 1 }, 
    476474    { OPT_LEVELS_2_PLUS, OPT_freorder_functions, NULL, 1 }, 
    477475    { OPT_LEVELS_2_PLUS, OPT_ftree_vrp, NULL, 1 }, 
    static const struct default_options defa 
    489487    { OPT_LEVELS_2_PLUS_SPEED_ONLY, OPT_foptimize_strlen, NULL, 1 }, 
    490488 
    491489    /* -O3 optimizations.  */ 
     490    { OPT_LEVELS_3_PLUS, OPT_fstrict_aliasing, NULL, 1 }, 
     491    { OPT_LEVELS_3_PLUS, OPT_fstrict_overflow, NULL, 1 }, 
    492492    { OPT_LEVELS_3_PLUS, OPT_ftree_loop_distribute_patterns, NULL, 1 }, 
    493493    { OPT_LEVELS_3_PLUS, OPT_fpredictive_commoning, NULL, 1 }, 
    494494    /* Inlining of functions reducing size is a good idea with -Os 
    common_handle_option (struct gcc_options 
    14321432                               opts, opts_set, loc, dc); 
    14331433      break; 
    14341434 
     1435    case OPT_Werror_maybe_reset: 
     1436      { 
     1437        char *ev = getenv ("GCC_NO_WERROR"); 
     1438        if ((ev != NULL) && (*ev != '0')) 
     1439          warnings_are_errors = 0; 
     1440      } 
     1441      break; 
     1442 
     1443    case OPT_fhonour_copts: 
     1444      break; 
     1445 
    14351446    case OPT_Wlarger_than_: 
    14361447      opts->x_larger_than_size = value; 
    14371448      opts->x_warn_larger_than = value != -1; 
  • gcc/doc/cppopts.texi

    a b in older programs. This warning is on 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 Objective-C and Objective-C++ Dialects}. 
    242242-Wconversion  -Wcoverage-mismatch  -Wno-cpp  -Wno-deprecated  @gol 
    243243-Wno-deprecated-declarations -Wdisabled-optimization  @gol 
    244244-Wno-div-by-zero -Wdouble-promotion -Wempty-body  -Wenum-compare @gol 
    245 -Wno-endif-labels -Werror  -Werror=* @gol 
     245-Wno-endif-labels -Werror  -Werror=* -Werror-maybe-reset @gol 
    246246-Wfatal-errors  -Wfloat-equal  -Wformat  -Wformat=2 @gol 
    247247-Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol 
    248248-Wformat-security  -Wformat-y2k @gol 
    This option is only supported for C and 
    46494649@option{-Wall} and by @option{-pedantic}, which can be disabled with 
    46504650@option{-Wno-pointer-sign}. 
    46514651 
     4652 at item -Werror-maybe-reset 
     4653 at opindex Werror-maybe-reset 
     4654Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment 
     4655variable is set to anything other than 0 or empty. 
     4656 
     4657 at item -fhonour-copts 
     4658 at opindex fhonour-copts 
     4659If @env{GCC_HONOUR_COPTS} is set to 1, abort if this option is not 
     4660given at least once, and warn if it is given more than once. 
     4661If @env{GCC_HONOUR_COPTS} is set to 2, abort if this option is not 
     4662given exactly once. 
     4663If @env{GCC_HONOUR_COPTS} is set to 0 or unset, warn if this option 
     4664is not given exactly once. 
     4665The warning is quelled if @env{GCC_HONOUR_COPTS} is set to @samp{s}. 
     4666This flag and environment variable only affect the C language. 
     4667 
    46524668@item -Wstack-protector 
    46534669@opindex Wstack-protector 
    46544670@opindex Wno-stack-protector 
    so, the first branch is redirected to ei 
    65716587second branch or a point immediately following it, depending on whether 
    65726588the condition is known to be true or false. 
    65736589 
    6574 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. 
     6590Enabled at levels @option{-O3}. 
    65756591 
    65766592@item -fsplit-wide-types 
    65776593@opindex fsplit-wide-types 
  • gcc/java/jvspec.c

    a b lang_specific_pre_link (void) 
    627627     class name.  Append dummy `.c' that can be stripped by set_input so %b 
    628628     is correct.  */  
    629629  set_input (concat (main_class_name, "main.c", NULL)); 
     630  putenv ("GCC_HONOUR_COPTS=s"); /* XXX hack!  */ 
    630631  err = do_spec (jvgenmain_spec); 
    631632  if (err == 0) 
    632633    { 
Note: See TracBrowser for help on using the repository browser.