Message ID | Pine.LNX.4.64.1009020054280.24176@digraph.polyomino.org.uk |
---|---|
State | New |
Headers | show |
On Thu, Sep 2, 2010 at 2:56 AM, Joseph S. Myers <joseph@codesourcery.com> wrote: > This patch, relative to a tree with > <http://gcc.gnu.org/ml/gcc-patches/2010-09/msg00080.html> applied, > adds further .opt file facilities: Ignore, to mark options that are > ignored, and Warn, to indicate that an option (possibly ignored or an > alias) should cause a particular warning message to be given. > > This is further preparation for replacing translate_options with > something better integrated in the shared option processing machinery. > As well as aliases for individual options, translate_options has > alternative forms for groups of options, --option for -foption and > --machine-option for -moption (there are a few other such cases as > well, for -W, -g and -O). My plan is for the option processing code > to look up -foption and -moption in such cases like it presently looks > up -foption when given -fno-option - but for it not to do any such > translation for --options where no matching -f, -m etc. option is > known. > > Not doing such translation for unknown options requires that all -f > and -m options actually be known to the .opt files for the equivalent > "--" forms to work, rather than just being handled through specs. > Unknown such options can only be handled through specs if the specs > then use %< to ensure the original option does not get passed to the > core compiler. Some such cases of options only in specs are in fact > ignored options, or options that produce warnings as well as acting as > aliases (see the x86 -mcpu case in this patch), hence the addition of > the facilities in this patch. They are also of course generally > useful for reducing the amount of code in option handlers (a later > stage in preparation for sharing target option handlers between the > driver and the core compilers will try to reduce the amount of code in > such handlers for things covered by the expanded .opt facilities). > > Bootstrapped with no regressions on x86_64-unknown-linux-gnu. OK to > commit (the non-c-family, non-exgettext parts, including the x86 > parts)? Ok. Thanks, Richard. > 2010-09-01 Joseph Myers <joseph@codesourcery.com> > > * opts.h (struct cl_option): Add warn_message field. > (struct cl_decoded_option): Add warn_message field. > * doc/options.texi (Ignore, Warn): Document. > * opt-functions.awk (needs_state_p): Don't consider aliases or > ignored options to need state saved. > * optc-gen.awk: Handle Warn and Ignore. > * opth-gen.awk: Output OPT_SPECIAL_ignore. > * opts-common.c (decode_cmdline_option): Set warn_message field. > Handle ignored options. > (decode_cmdline_options_to_array, generate_option, > generate_option_input_file): Set warn_message field. > (read_cmdline_option): Generate warnings from warn_message field. > Handle ignored options. > * common.opt (Wunreachable-code, fargument-alias, > fargument-noalias, fargument-noalias-global, > fargument-noalias-anything, fcse-skip-blocks, fforce-addr, > floop-optimize, frerun-loop-opt, fsched2-use-traces, fsee, > fstrength-reduce, ftree-store-ccp, ftree-store-copy-prop, > ftree-salias): Mark Ignore. > * config/i386/i386.h (CC1_CPU_SPEC_1): Don't handle -mcpu, > -mintel-syntax and -mno-intel-syntax here. > * config/i386/i386.opt (mcpu=, mintel-syntax): Define as aliases > using Warn. > * opts.c (common_handle_option): Don't handle options marked as > ignored. > (enable_warning_as_error): Handle ignored options. > > c-family: > 2010-09-01 Joseph Myers <joseph@codesourcery.com> > > * c.opt (Wimport, fall-virtual, falt-external-templates, > fdefault-inline, fenum-int-equiv, fexternal-templates, > fguiding-decls, fhonor-std, fhuge-objects, flabels-ok, > fname-mangling-version-, fnew-abi, fnonnull-objects, > foptional-diags, fsquangle, fstrict-prototype, fthis-is-variable, > fvtable-gc, fvtable-thunks, fxref): Mark with Ignore and Warn as > applicable. > (fhandle-exceptions): Mark with Alias and Warn. > * c-opts.c (c_common_handle_option): Don't handle options marked > as ignored. > > po: > 2010-09-01 Joseph Myers <joseph@codesourcery.com> > > * exgettext: Handle {} in operand of MissingArgError. Handle > Warn. > > diff -rupN --exclude=.svn gcc-mainline-0-alias/gcc/c-family/c-opts.c gcc-mainline/gcc/c-family/c-opts.c > --- gcc-mainline-0-alias/gcc/c-family/c-opts.c 2010-08-31 17:49:09.000000000 -0700 > +++ gcc-mainline/gcc/c-family/c-opts.c 2010-09-01 15:22:52.000000000 -0700 > @@ -537,10 +537,6 @@ c_common_handle_option (size_t scode, co > value, c_family_lang_mask, kind, handlers); > break; > > - case OPT_Wimport: > - /* Silently ignore for now. */ > - break; > - > case OPT_Winvalid_pch: > cpp_opts->warn_invalid_pch = value; > break; > @@ -623,25 +619,6 @@ c_common_handle_option (size_t scode, co > flag_cond_mismatch = value; > break; > } > - /* Fall through. */ > - > - case OPT_fall_virtual: > - case OPT_falt_external_templates: > - case OPT_fenum_int_equiv: > - case OPT_fexternal_templates: > - case OPT_fguiding_decls: > - case OPT_fhonor_std: > - case OPT_fhuge_objects: > - case OPT_flabels_ok: > - case OPT_fname_mangling_version_: > - case OPT_fnew_abi: > - case OPT_fnonnull_objects: > - case OPT_fsquangle: > - case OPT_fstrict_prototype: > - case OPT_fthis_is_variable: > - case OPT_fvtable_thunks: > - case OPT_fxref: > - case OPT_fvtable_gc: > warning (0, "switch %qs is no longer supported", option->opt_text); > break; > > @@ -672,10 +649,6 @@ c_common_handle_option (size_t scode, co > constant_string_class_name = arg; > break; > > - case OPT_fdefault_inline: > - /* Ignore. */ > - break; > - > case OPT_fextended_identifiers: > cpp_opts->extended_identifiers = value; > break; > @@ -684,11 +657,6 @@ c_common_handle_option (size_t scode, co > flag_next_runtime = !value; > break; > > - case OPT_fhandle_exceptions: > - warning (0, "-fhandle-exceptions has been renamed -fexceptions (and is now on by default)"); > - flag_exceptions = value; > - break; > - > case OPT_fnext_runtime: > flag_next_runtime = value; > break; > @@ -697,10 +665,6 @@ c_common_handle_option (size_t scode, co > cpp_opts->operator_names = value; > break; > > - case OPT_foptional_diags: > - /* Ignore. */ > - break; > - > case OPT_fpch_deps: > cpp_opts->restore_pch_deps = value; > break; > diff -rupN --exclude=.svn gcc-mainline-0-alias/gcc/c-family/c.opt gcc-mainline/gcc/c-family/c.opt > --- gcc-mainline-0-alias/gcc/c-family/c.opt 2010-08-31 17:46:51.000000000 -0700 > +++ gcc-mainline/gcc/c-family/c.opt 2010-09-01 15:22:38.000000000 -0700 > @@ -275,7 +275,7 @@ C ObjC Var(warn_implicit_int) Init(-1) W > Warn when a declaration does not specify a type > > Wimport > -C ObjC C++ ObjC++ Undocumented > +C ObjC C++ ObjC++ Undocumented Ignore > > Wint-to-pointer-cast > C ObjC C++ ObjC++ Var(warn_int_to_pointer_cast) Init(1) Warning > @@ -534,10 +534,10 @@ C++ ObjC++ Var(flag_access_control) Init > Enforce class member access control semantics > > fall-virtual > -C++ ObjC++ > +C++ ObjC++ Ignore Warn(switch %qs is no longer supported) > > falt-external-templates > -C++ ObjC++ > +C++ ObjC++ Ignore Warn(switch %qs is no longer supported) > Change when template instances are emitted > > fasm > @@ -572,7 +572,7 @@ C++ ObjC++ Var(flag_deduce_init_list) In > -fno-deduce-init-list disable deduction of std::initializer_list for a template type parameter from a brace-enclosed initializer-list > > fdefault-inline > -C++ ObjC++ > +C++ ObjC++ Ignore > Does nothing. Preserved for backward compatibility. > > fdirectives-only > @@ -591,7 +591,7 @@ C++ ObjC++ Var(flag_enforce_eh_specs) In > Generate code to check exception specifications > > fenum-int-equiv > -C++ ObjC++ > +C++ ObjC++ Ignore Warn(switch %qs is no longer supported) > > fexec-charset= > C ObjC C++ ObjC++ Joined RejectNegative > @@ -607,7 +607,7 @@ C ObjC C++ ObjC++ Joined RejectNegative > > > fexternal-templates > -C++ ObjC++ > +C++ ObjC++ Ignore Warn(switch %qs is no longer supported) > > ffor-scope > C++ ObjC++ Var(flag_new_for_scope) Init(1) > @@ -630,20 +630,20 @@ C ObjC Var(flag_gnu89_inline) Init(-1) > Use traditional GNU semantics for inline functions > > fguiding-decls > -C++ ObjC++ > +C++ ObjC++ Ignore Warn(switch %qs is no longer supported) > > fhandle-exceptions > -C++ ObjC++ Optimization > +C++ ObjC++ Optimization Alias(fexceptions) Warn({-fhandle-exceptions has been renamed -fexceptions (and is now on by default)}) > > fhonor-std > -C++ ObjC++ > +C++ ObjC++ Ignore Warn(switch %qs is no longer supported) > > fhosted > C ObjC > Assume normal C execution environment > > fhuge-objects > -C++ ObjC++ > +C++ ObjC++ Ignore Warn(switch %qs is no longer supported) > Enable support for huge objects > > fimplement-inlines > @@ -663,7 +663,7 @@ C++ ObjC++ Var(flag_friend_injection) > Inject friend functions into enclosing namespace > > flabels-ok > -C++ ObjC++ > +C++ ObjC++ Ignore Warn(switch %qs is no longer supported) > > flax-vector-conversions > C ObjC C++ ObjC++ Var(flag_lax_vector_conversions) > @@ -674,10 +674,10 @@ C ObjC C++ ObjC++ Var(flag_ms_extensions > Don't warn about uses of Microsoft extensions > > fname-mangling-version- > -C++ ObjC++ Joined > +C++ ObjC++ Joined Ignore Warn(switch %qs is no longer supported) > > fnew-abi > -C++ ObjC++ > +C++ ObjC++ Ignore Warn(switch %qs is no longer supported) > > fnext-runtime > ObjC ObjC++ > @@ -691,7 +691,7 @@ fnonansi-builtins > C++ ObjC++ Var(flag_no_nonansi_builtin, 0) > > fnonnull-objects > -C++ ObjC++ > +C++ ObjC++ Ignore Warn(switch %qs is no longer supported) > > fnothrow-opt > C++ ObjC++ Optimization Var(flag_nothrow_opt) > @@ -731,7 +731,7 @@ C++ ObjC++ > Recognize C++ keywords like \"compl\" and \"xor\" > > foptional-diags > -C++ ObjC++ > +C++ ObjC++ Ignore > Does nothing. Preserved for backward compatibility. > > fpch-deps > @@ -786,7 +786,7 @@ C ObjC C++ ObjC++ LTO Var(flag_signed_ch > Make \"char\" signed by default > > fsquangle > -C++ ObjC++ > +C++ ObjC++ Ignore Warn(switch %qs is no longer supported) > > fstats > C++ ObjC++ Var(flag_detailed_statistics) > @@ -797,7 +797,7 @@ C++ ObjC++ Optimization Var(flag_strict_ > Assume that values of enumeration type are always within the minimum range of that type > > fstrict-prototype > -C++ ObjC++ > +C++ ObjC++ Ignore Warn(switch %qs is no longer supported) > > ftabstop= > C ObjC C++ ObjC++ Joined RejectNegative UInteger > @@ -811,7 +811,7 @@ C++ ObjC++ Joined RejectNegative UIntege > -ftemplate-depth=<number> Specify maximum template instantiation depth > > fthis-is-variable > -C++ ObjC++ > +C++ ObjC++ Ignore Warn(switch %qs is no longer supported) > > fthreadsafe-statics > C++ ObjC++ Optimization Var(flag_threadsafe_statics) Init(1) > @@ -842,11 +842,11 @@ C++ ObjC++ Var(flag_visibility_ms_compat > Changes visibility to match Microsoft Visual Studio by default > > fvtable-gc > -C++ ObjC++ > +C++ ObjC++ Ignore Warn(switch %qs is no longer supported) > Discard unused virtual functions > > fvtable-thunks > -C++ ObjC++ > +C++ ObjC++ Ignore Warn(switch %qs is no longer supported) > Implement vtables using thunks > > fweak > @@ -862,7 +862,7 @@ C ObjC C++ ObjC++ Var(flag_working_direc > Generate a #line directive pointing at the current working directory > > fxref > -C++ ObjC++ > +C++ ObjC++ Ignore Warn(switch %qs is no longer supported) > Emit cross referencing information > > fzero-link > diff -rupN --exclude=.svn gcc-mainline-0-alias/gcc/common.opt gcc-mainline/gcc/common.opt > --- gcc-mainline-0-alias/gcc/common.opt 2010-08-31 17:37:25.000000000 -0700 > +++ gcc-mainline/gcc/common.opt 2010-09-01 15:13:14.000000000 -0700 > @@ -248,7 +248,7 @@ Common Var(warn_uninitialized) Init(-1) > Warn about uninitialized automatic variables > > Wunreachable-code > -Common > +Common Ignore > Does nothing. Preserved for backward compatibility. > > Wunused > @@ -387,19 +387,19 @@ falign-loops= > Common RejectNegative Joined UInteger > > fargument-alias > -Common > +Common Ignore > Does nothing. Preserved for backward compatibility. > > fargument-noalias > -Common > +Common Ignore > Does nothing. Preserved for backward compatibility. > > fargument-noalias-global > -Common > +Common Ignore > Does nothing. Preserved for backward compatibility. > > fargument-noalias-anything > -Common > +Common Ignore > Does nothing. Preserved for backward compatibility. > > fasynchronous-unwind-tables > @@ -490,7 +490,7 @@ Common Report Var(flag_cse_follow_jumps) > When running CSE, follow jumps to their targets > > fcse-skip-blocks > -Common > +Common Ignore > Does nothing. Preserved for backward compatibility. > > fcx-limited-range > @@ -619,7 +619,7 @@ Common Report Var(flag_float_store) Opti > Don't allocate floats and doubles in extended-precision registers > > fforce-addr > -Common > +Common Ignore > Does nothing. Preserved for backward compatibility. > > fforward-propagate > @@ -852,7 +852,7 @@ Common Report Var(flag_leading_underscor > Give external symbols a leading underscore > > floop-optimize > -Common > +Common Ignore > Does nothing. Preserved for backward compatibility. > > flto > @@ -1098,7 +1098,7 @@ Common Report Var(flag_rerun_cse_after_l > Add a common subexpression elimination pass after loop optimizations > > frerun-loop-opt > -Common > +Common Ignore > Does nothing. Preserved for backward compatibility. > > frounding-math > @@ -1134,7 +1134,7 @@ Common Report Var(flag_sched2_use_superb > If scheduling post reload, do superblock scheduling > > fsched2-use-traces > -Common > +Common Ignore > Does nothing. Preserved for backward compatibility. > > fschedule-insns > @@ -1219,7 +1219,7 @@ Common Report Var(flag_section_anchors) > Access data in the same section from shared anchor points > > fsee > -Common > +Common Ignore > Does nothing. Preserved for backward compatibility. > > fzee > @@ -1286,7 +1286,7 @@ Common RejectNegative Var(flag_stack_usa > Output stack usage information on a per-function basis > > fstrength-reduce > -Common > +Common Ignore > Does nothing. Preserved for backward compatibility. > > ; Nonzero if we should do (language-dependent) alias analysis. > @@ -1349,7 +1349,7 @@ Common Report Var(flag_tree_bit_ccp) Opt > Enable SSA-BIT-CCP optimization on trees > > ftree-store-ccp > -Common > +Common Ignore > Does nothing. Preserved for backward compatibility. > > ftree-ch > @@ -1365,7 +1365,7 @@ Common Report Var(flag_tree_copy_prop) O > Enable copy propagation on trees > > ftree-store-copy-prop > -Common > +Common Ignore > Does nothing. Preserved for backward compatibility. > > ftree-cselim > @@ -1441,7 +1441,7 @@ Common Report Var(flag_tree_reassoc) Ini > Enable reassociation on tree level > > ftree-salias > -Common > +Common Ignore > Does nothing. Preserved for backward compatibility. > > ftree-sink > diff -rupN --exclude=.svn gcc-mainline-0-alias/gcc/config/i386/i386.h gcc-mainline/gcc/config/i386/i386.h > --- gcc-mainline-0-alias/gcc/config/i386/i386.h 2010-08-12 15:57:12.000000000 -0700 > +++ gcc-mainline/gcc/config/i386/i386.h 2010-09-01 15:31:39.000000000 -0700 > @@ -555,15 +555,8 @@ extern const char *host_detect_local_cpu > > #ifndef CC1_CPU_SPEC > #define CC1_CPU_SPEC_1 "\ > -%{mcpu=*:-mtune=%* \ > -%n`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.\n} \ > -%<mcpu=* \ > -%{mintel-syntax:-masm=intel \ > -%n`-mintel-syntax' is deprecated. Use `-masm=intel' instead.\n} \ > %{msse5:-mavx \ > -%n'-msse5' was removed.\n} \ > -%{mno-intel-syntax:-masm=att \ > -%n`-mno-intel-syntax' is deprecated. Use `-masm=att' instead.\n}" > +%n'-msse5' was removed.\n}" > > #ifndef HAVE_LOCAL_CPU_DETECT > #define CC1_CPU_SPEC CC1_CPU_SPEC_1 > diff -rupN --exclude=.svn gcc-mainline-0-alias/gcc/config/i386/i386.opt gcc-mainline/gcc/config/i386/i386.opt > --- gcc-mainline-0-alias/gcc/config/i386/i386.opt 2010-07-29 02:45:30.000000000 -0700 > +++ gcc-mainline/gcc/config/i386/i386.opt 2010-09-01 15:32:34.000000000 -0700 > @@ -1,6 +1,7 @@ > ; Options for the IA-32 and AMD64 ports of the compiler. > > -; Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc. > +; Copyright (C) 2005, 2006, 2007, 2008, 2009, > +; 2010 Free Software Foundation, Inc. > ; > ; This file is part of GCC. > ; > @@ -112,6 +113,9 @@ mcmodel= > Target RejectNegative Joined Var(ix86_cmodel_string) > Use given x86-64 code model > > +mcpu= > +Target RejectNegative Joined Undocumented Alias(mtune=) Warn(%<-mcpu=%> is deprecated; use %<-mtune=%> or %<-march=%> instead) > + > mfancy-math-387 > Target RejectNegative Report InverseMask(NO_FANCY_MATH_387, USE_FANCY_MATH_387) Save > Generate sin, cos, sqrt for FPU > @@ -145,7 +149,7 @@ Target Report Mask(INLINE_STRINGOPS_DYNA > Inline memset/memcpy string operations, but perform inline version only for small blocks > > mintel-syntax > -Target Undocumented > +Target Undocumented Alias(masm=, intel, att) Warn(%<-mintel-syntax%> and %<-mno-intel-syntax%> are deprecated; use %<-masm=intel%> and %<-masm=att%> instead) > ;; Deprecated > > mms-bitfields > diff -rupN --exclude=.svn gcc-mainline-0-alias/gcc/doc/options.texi gcc-mainline/gcc/doc/options.texi > --- gcc-mainline-0-alias/gcc/doc/options.texi 2010-09-01 07:55:26.000000000 -0700 > +++ gcc-mainline/gcc/doc/options.texi 2010-09-01 15:15:56.000000000 -0700 > @@ -273,6 +273,19 @@ not need to handle it and no @samp{OPT_} > for it; only the canonical form of the option will be seen in those > places. > > +@item Ignore > +This option is ignored apart from printing any warning specified using > +@code{Warn}. The option will not be seen by specs and no @samp{OPT_} > +enumeration value is defined for it. > + > +@item Warn(@var{message}) > +If this option is used, output the warning @var{message}. > +@var{message} is a format string, either taking a single operand with > +a @samp{%qs} format which is the option name, or not taking any > +operands, which is passed to the @samp{warning} function. If an alias > +is marked @code{Warn}, the target of the alias must not also be marked > +@code{Warn}. > + > @item Report > The state of the option should be printed by @option{-fverbose-asm}. > > diff -rupN --exclude=.svn gcc-mainline-0-alias/gcc/opt-functions.awk gcc-mainline/gcc/opt-functions.awk > --- gcc-mainline-0-alias/gcc/opt-functions.awk 2010-08-31 17:45:26.000000000 -0700 > +++ gcc-mainline/gcc/opt-functions.awk 2010-09-01 15:45:34.000000000 -0700 > @@ -114,7 +114,9 @@ function global_state_p(flags) > # associated with it. > function needs_state_p(flags) > { > - return flag_set_p("Target", flags) > + return (flag_set_p("Target", flags) \ > + && !flag_set_p("Alias.*", flags) \ > + && !flag_set_p("Ignore", flags)) > } > > # If FLAGS describes an option that needs a static state variable, > diff -rupN --exclude=.svn gcc-mainline-0-alias/gcc/optc-gen.awk gcc-mainline/gcc/optc-gen.awk > --- gcc-mainline-0-alias/gcc/optc-gen.awk 2010-08-31 17:35:49.000000000 -0700 > +++ gcc-mainline/gcc/optc-gen.awk 2010-09-01 14:45:19.000000000 -0700 > @@ -201,9 +201,19 @@ for (i = 0; i < n_opts; i++) { > else > missing_arg_error = quote missing_arg_error quote > > + > + warn_message = opt_args("Warn", flags[i]) > + if (warn_message == "") > + warn_message = "0" > + else > + warn_message = quote warn_message quote > + > alias_arg = opt_args("Alias", flags[i]) > if (alias_arg == "") { > - alias_data = "NULL, NULL, N_OPTS" > + if (flag_set_p("Ignore", flags[i])) > + alias_data = "NULL, NULL, OPT_SPECIAL_ignore" > + else > + alias_data = "NULL, NULL, N_OPTS" > } else { > alias_opt = nth_arg(0, alias_arg) > alias_posarg = nth_arg(1, alias_arg) > @@ -246,8 +256,8 @@ for (i = 0; i < n_opts; i++) { > } > # Split the printf after %u to work around an ia64-hp-hpux11.23 > # awk bug. > - printf(" { %c-%s%c,\n %s,\n %s,\n %s, %s, %u,", > - quote, opts[i], quote, hlp, missing_arg_error, > + printf(" { %c-%s%c,\n %s,\n %s,\n %s,\n %s, %s, %u,", > + quote, opts[i], quote, hlp, missing_arg_error, warn_message, > alias_data, back_chain[i], len) > printf(" %d,\n", idx) > condition = opt_args("Condition", flags[i]) > diff -rupN --exclude=.svn gcc-mainline-0-alias/gcc/opth-gen.awk gcc-mainline/gcc/opth-gen.awk > --- gcc-mainline-0-alias/gcc/opth-gen.awk 2010-08-31 15:15:00.000000000 -0700 > +++ gcc-mainline/gcc/opth-gen.awk 2010-09-01 14:45:57.000000000 -0700 > @@ -369,6 +369,7 @@ for (i = 0; i < n_opts; i++) { > > print " N_OPTS," > print " OPT_SPECIAL_unknown," > +print " OPT_SPECIAL_ignore," > print " OPT_SPECIAL_program_name," > print " OPT_SPECIAL_input_file" > print "};" > diff -rupN --exclude=.svn gcc-mainline-0-alias/gcc/opts-common.c gcc-mainline/gcc/opts-common.c > --- gcc-mainline-0-alias/gcc/opts-common.c 2010-09-01 07:53:00.000000000 -0700 > +++ gcc-mainline/gcc/opts-common.c 2010-09-01 15:53:15.000000000 -0700 > @@ -214,6 +214,7 @@ decode_cmdline_option (const char **argv > char *p; > const struct cl_option *option; > int errors = 0; > + const char *warn_message = NULL; > bool separate_arg_flag; > bool joined_arg_flag; > > @@ -254,6 +255,8 @@ decode_cmdline_option (const char **argv > goto done; > } > > + warn_message = option->warn_message; > + > /* Check to see if the option is disabled for this configuration. */ > if (option->flags & CL_DISABLED) > errors |= CL_ERR_DISABLED; > @@ -300,55 +303,73 @@ decode_cmdline_option (const char **argv > if (arg == NULL && (separate_arg_flag || joined_arg_flag)) > errors |= CL_ERR_MISSING_ARG; > > - /* Is this option an alias? */ > + /* Is this option an alias (or an ignored option, marked as an alias > + of OPT_SPECIAL_ignore)? */ > if (option->alias_target != N_OPTS) > { > size_t new_opt_index = option->alias_target; > - const struct cl_option *new_option = &cl_options[new_opt_index]; > - > - /* The new option must not be an alias itself. */ > - gcc_assert (new_option->alias_target == N_OPTS); > > - if (option->neg_alias_arg) > + if (new_opt_index == OPT_SPECIAL_ignore) > { > - gcc_assert (option->alias_arg != NULL); > - gcc_assert (arg == NULL); > - if (value) > - arg = option->alias_arg; > - else > - arg = option->neg_alias_arg; > + gcc_assert (option->alias_arg == NULL); > + gcc_assert (option->neg_alias_arg == NULL); > + opt_index = new_opt_index; > + arg = NULL; > value = 1; > } > - else if (option->alias_arg) > + else > { > - gcc_assert (value == 1); > - gcc_assert (arg == NULL); > - arg = option->alias_arg; > - } > + const struct cl_option *new_option = &cl_options[new_opt_index]; > > - opt_index = new_opt_index; > - option = new_option; > + /* The new option must not be an alias itself. */ > + gcc_assert (new_option->alias_target == N_OPTS); > > - if (value == 0) > - gcc_assert (!(option->flags & CL_REJECT_NEGATIVE)); > + if (option->neg_alias_arg) > + { > + gcc_assert (option->alias_arg != NULL); > + gcc_assert (arg == NULL); > + if (value) > + arg = option->alias_arg; > + else > + arg = option->neg_alias_arg; > + value = 1; > + } > + else if (option->alias_arg) > + { > + gcc_assert (value == 1); > + gcc_assert (arg == NULL); > + arg = option->alias_arg; > + } > > - /* Recompute what arguments are allowed. */ > - separate_arg_flag = ((option->flags & CL_SEPARATE) > - && !((option->flags & CL_NO_DRIVER_ARG) > - && (lang_mask & CL_DRIVER))); > - joined_arg_flag = (option->flags & CL_JOINED) != 0; > + opt_index = new_opt_index; > + option = new_option; > > - if (!(errors & CL_ERR_MISSING_ARG)) > - { > - if (separate_arg_flag || joined_arg_flag) > - gcc_assert (arg != NULL); > - else > - gcc_assert (arg == NULL); > - } > + if (value == 0) > + gcc_assert (!(option->flags & CL_REJECT_NEGATIVE)); > + > + /* Recompute what arguments are allowed. */ > + separate_arg_flag = ((option->flags & CL_SEPARATE) > + && !((option->flags & CL_NO_DRIVER_ARG) > + && (lang_mask & CL_DRIVER))); > + joined_arg_flag = (option->flags & CL_JOINED) != 0; > + > + if (!(errors & CL_ERR_MISSING_ARG)) > + { > + if (separate_arg_flag || joined_arg_flag) > + gcc_assert (arg != NULL); > + else > + gcc_assert (arg == NULL); > + } > > - /* Recheck for disabled options. */ > - if (option->flags & CL_DISABLED) > - errors |= CL_ERR_DISABLED; > + /* Recheck for warnings and disabled options. */ > + if (option->warn_message) > + { > + gcc_assert (warn_message == NULL); > + warn_message = option->warn_message; > + } > + if (option->flags & CL_DISABLED) > + errors |= CL_ERR_DISABLED; > + } > } > > /* Check if this is a switch for a different front end. */ > @@ -370,6 +391,7 @@ decode_cmdline_option (const char **argv > decoded->arg = arg; > decoded->value = value; > decoded->errors = errors; > + decoded->warn_message = warn_message; > > if (opt_index == OPT_SPECIAL_unknown) > { > @@ -408,7 +430,7 @@ decode_cmdline_option (const char **argv > else > decoded->canonical_option[i] = NULL; > } > - if (opt_index != OPT_SPECIAL_unknown) > + if (opt_index != OPT_SPECIAL_unknown && opt_index != OPT_SPECIAL_ignore) > generate_canonical_option (opt_index, arg, value, decoded); > decoded->orig_option_with_args_text = p = XNEWVEC (char, total_len); > for (i = 0; i < result; i++) > @@ -448,6 +470,7 @@ decode_cmdline_options_to_array (unsigne > opt_array = XNEWVEC (struct cl_decoded_option, argc); > > opt_array[0].opt_index = OPT_SPECIAL_program_name; > + opt_array[0].warn_message = NULL; > opt_array[0].arg = argv[0]; > opt_array[0].orig_option_with_args_text = argv[0]; > opt_array[0].canonical_option_num_elements = 1; > @@ -678,6 +701,7 @@ generate_option (size_t opt_index, const > const struct cl_option *option = &cl_options[opt_index]; > > decoded->opt_index = opt_index; > + decoded->warn_message = NULL; > decoded->arg = arg; > decoded->value = value; > decoded->errors = (option_ok_for_language (option, lang_mask) > @@ -709,6 +733,7 @@ generate_option_input_file (const char * > struct cl_decoded_option *decoded) > { > decoded->opt_index = OPT_SPECIAL_input_file; > + decoded->warn_message = NULL; > decoded->arg = file; > decoded->orig_option_with_args_text = file; > decoded->canonical_option_num_elements = 1; > @@ -729,7 +754,10 @@ read_cmdline_option (struct cl_decoded_o > const struct cl_option_handlers *handlers) > { > const struct cl_option *option; > - const char *opt; > + const char *opt = decoded->orig_option_with_args_text; > + > + if (decoded->warn_message) > + warning (0, decoded->warn_message, opt); > > if (decoded->opt_index == OPT_SPECIAL_unknown) > { > @@ -738,8 +766,10 @@ read_cmdline_option (struct cl_decoded_o > return; > } > > + if (decoded->opt_index == OPT_SPECIAL_ignore) > + return; > + > option = &cl_options[decoded->opt_index]; > - opt = decoded->orig_option_with_args_text; > > if (decoded->errors & CL_ERR_DISABLED) > { > diff -rupN --exclude=.svn gcc-mainline-0-alias/gcc/opts.c gcc-mainline/gcc/opts.c > --- gcc-mainline-0-alias/gcc/opts.c 2010-08-31 17:52:40.000000000 -0700 > +++ gcc-mainline/gcc/opts.c 2010-09-01 15:13:25.000000000 -0700 > @@ -2077,24 +2077,6 @@ common_handle_option (const struct cl_de > global_dc->inhibit_warnings = true; > break; > > - case OPT_fsee: > - case OPT_fcse_skip_blocks: > - case OPT_floop_optimize: > - case OPT_frerun_loop_opt: > - case OPT_fsched2_use_traces: > - case OPT_fstrength_reduce: > - case OPT_ftree_store_copy_prop: > - case OPT_fforce_addr: > - case OPT_ftree_salias: > - case OPT_ftree_store_ccp: > - case OPT_Wunreachable_code: > - case OPT_fargument_alias: > - case OPT_fargument_noalias: > - case OPT_fargument_noalias_anything: > - case OPT_fargument_noalias_global: > - /* These are no-ops, preserved for backward compatibility. */ > - break; > - > case OPT_fuse_linker_plugin: > /* No-op. Used by the driver and passed to us because it starts with f.*/ > break; > @@ -2359,6 +2341,8 @@ enable_warning_as_error (const char *arg > > if (option->alias_target != N_OPTS) > option_index = option->alias_target; > + if (option_index == OPT_SPECIAL_ignore) > + return; > diagnostic_classify_diagnostic (global_dc, option_index, kind, > UNKNOWN_LOCATION); > if (kind == DK_ERROR) > diff -rupN --exclude=.svn gcc-mainline-0-alias/gcc/opts.h gcc-mainline/gcc/opts.h > --- gcc-mainline-0-alias/gcc/opts.h 2010-08-31 14:55:19.000000000 -0700 > +++ gcc-mainline/gcc/opts.h 2010-09-01 14:54:56.000000000 -0700 > @@ -45,6 +45,7 @@ struct cl_option > const char *opt_text; > const char *help; > const char *missing_argument_error; > + const char *warn_message; > const char *alias_arg; > const char *neg_alias_arg; > unsigned short alias_target; > @@ -117,6 +118,9 @@ struct cl_decoded_option > non-options and unknown options. */ > size_t opt_index; > > + /* Any warning to give for use of this option, or NULL if none. */ > + const char *warn_message; > + > /* The string argument, or NULL if none. For OPT_SPECIAL_* cases, > the option or non-option command-line argument. */ > const char *arg; > diff -rupN --exclude=.svn gcc-mainline-0-alias/gcc/po/exgettext gcc-mainline/gcc/po/exgettext > --- gcc-mainline-0-alias/gcc/po/exgettext 2010-07-27 05:02:03.000000000 -0700 > +++ gcc-mainline/gcc/po/exgettext 2010-09-01 15:24:42.000000000 -0700 > @@ -226,7 +226,22 @@ echo "scanning option files..." >&2 > if ((field == 1) && /MissingArgError/) { > line = $0 > sub(".*MissingArgError\\(", "", line) > - sub("\\).*", "", line) > + if (line ~ "^{") { > + sub("^{", "", line) > + sub("}\\).*", "", line) > + } else > + sub("\\).*", "", line) > + printf("#line %d \"%s\"\n", lineno, file) > + printf("_(\"%s\")\n", line) > + } > + if ((field == 1) && /Warn/) { > + line = $0 > + sub(".*Warn\\(", "", line) > + if (line ~ "^{") { > + sub("^{", "", line) > + sub("}\\).*", "", line) > + } else > + sub("\\).*", "", line) > printf("#line %d \"%s\"\n", lineno, file) > printf("_(\"%s\")\n", line) > } > > -- > Joseph S. Myers > joseph@codesourcery.com >
diff -rupN --exclude=.svn gcc-mainline-0-alias/gcc/c-family/c-opts.c gcc-mainline/gcc/c-family/c-opts.c --- gcc-mainline-0-alias/gcc/c-family/c-opts.c 2010-08-31 17:49:09.000000000 -0700 +++ gcc-mainline/gcc/c-family/c-opts.c 2010-09-01 15:22:52.000000000 -0700 @@ -537,10 +537,6 @@ c_common_handle_option (size_t scode, co value, c_family_lang_mask, kind, handlers); break; - case OPT_Wimport: - /* Silently ignore for now. */ - break; - case OPT_Winvalid_pch: cpp_opts->warn_invalid_pch = value; break; @@ -623,25 +619,6 @@ c_common_handle_option (size_t scode, co flag_cond_mismatch = value; break; } - /* Fall through. */ - - case OPT_fall_virtual: - case OPT_falt_external_templates: - case OPT_fenum_int_equiv: - case OPT_fexternal_templates: - case OPT_fguiding_decls: - case OPT_fhonor_std: - case OPT_fhuge_objects: - case OPT_flabels_ok: - case OPT_fname_mangling_version_: - case OPT_fnew_abi: - case OPT_fnonnull_objects: - case OPT_fsquangle: - case OPT_fstrict_prototype: - case OPT_fthis_is_variable: - case OPT_fvtable_thunks: - case OPT_fxref: - case OPT_fvtable_gc: warning (0, "switch %qs is no longer supported", option->opt_text); break; @@ -672,10 +649,6 @@ c_common_handle_option (size_t scode, co constant_string_class_name = arg; break; - case OPT_fdefault_inline: - /* Ignore. */ - break; - case OPT_fextended_identifiers: cpp_opts->extended_identifiers = value; break; @@ -684,11 +657,6 @@ c_common_handle_option (size_t scode, co flag_next_runtime = !value; break; - case OPT_fhandle_exceptions: - warning (0, "-fhandle-exceptions has been renamed -fexceptions (and is now on by default)"); - flag_exceptions = value; - break; - case OPT_fnext_runtime: flag_next_runtime = value; break; @@ -697,10 +665,6 @@ c_common_handle_option (size_t scode, co cpp_opts->operator_names = value; break; - case OPT_foptional_diags: - /* Ignore. */ - break; - case OPT_fpch_deps: cpp_opts->restore_pch_deps = value; break; diff -rupN --exclude=.svn gcc-mainline-0-alias/gcc/c-family/c.opt gcc-mainline/gcc/c-family/c.opt --- gcc-mainline-0-alias/gcc/c-family/c.opt 2010-08-31 17:46:51.000000000 -0700 +++ gcc-mainline/gcc/c-family/c.opt 2010-09-01 15:22:38.000000000 -0700 @@ -275,7 +275,7 @@ C ObjC Var(warn_implicit_int) Init(-1) W Warn when a declaration does not specify a type Wimport -C ObjC C++ ObjC++ Undocumented +C ObjC C++ ObjC++ Undocumented Ignore Wint-to-pointer-cast C ObjC C++ ObjC++ Var(warn_int_to_pointer_cast) Init(1) Warning @@ -534,10 +534,10 @@ C++ ObjC++ Var(flag_access_control) Init Enforce class member access control semantics fall-virtual -C++ ObjC++ +C++ ObjC++ Ignore Warn(switch %qs is no longer supported) falt-external-templates -C++ ObjC++ +C++ ObjC++ Ignore Warn(switch %qs is no longer supported) Change when template instances are emitted fasm @@ -572,7 +572,7 @@ C++ ObjC++ Var(flag_deduce_init_list) In -fno-deduce-init-list disable deduction of std::initializer_list for a template type parameter from a brace-enclosed initializer-list fdefault-inline -C++ ObjC++ +C++ ObjC++ Ignore Does nothing. Preserved for backward compatibility. fdirectives-only @@ -591,7 +591,7 @@ C++ ObjC++ Var(flag_enforce_eh_specs) In Generate code to check exception specifications fenum-int-equiv -C++ ObjC++ +C++ ObjC++ Ignore Warn(switch %qs is no longer supported) fexec-charset= C ObjC C++ ObjC++ Joined RejectNegative @@ -607,7 +607,7 @@ C ObjC C++ ObjC++ Joined RejectNegative fexternal-templates -C++ ObjC++ +C++ ObjC++ Ignore Warn(switch %qs is no longer supported) ffor-scope C++ ObjC++ Var(flag_new_for_scope) Init(1) @@ -630,20 +630,20 @@ C ObjC Var(flag_gnu89_inline) Init(-1) Use traditional GNU semantics for inline functions fguiding-decls -C++ ObjC++ +C++ ObjC++ Ignore Warn(switch %qs is no longer supported) fhandle-exceptions -C++ ObjC++ Optimization +C++ ObjC++ Optimization Alias(fexceptions) Warn({-fhandle-exceptions has been renamed -fexceptions (and is now on by default)}) fhonor-std -C++ ObjC++ +C++ ObjC++ Ignore Warn(switch %qs is no longer supported) fhosted C ObjC Assume normal C execution environment fhuge-objects -C++ ObjC++ +C++ ObjC++ Ignore Warn(switch %qs is no longer supported) Enable support for huge objects fimplement-inlines @@ -663,7 +663,7 @@ C++ ObjC++ Var(flag_friend_injection) Inject friend functions into enclosing namespace flabels-ok -C++ ObjC++ +C++ ObjC++ Ignore Warn(switch %qs is no longer supported) flax-vector-conversions C ObjC C++ ObjC++ Var(flag_lax_vector_conversions) @@ -674,10 +674,10 @@ C ObjC C++ ObjC++ Var(flag_ms_extensions Don't warn about uses of Microsoft extensions fname-mangling-version- -C++ ObjC++ Joined +C++ ObjC++ Joined Ignore Warn(switch %qs is no longer supported) fnew-abi -C++ ObjC++ +C++ ObjC++ Ignore Warn(switch %qs is no longer supported) fnext-runtime ObjC ObjC++ @@ -691,7 +691,7 @@ fnonansi-builtins C++ ObjC++ Var(flag_no_nonansi_builtin, 0) fnonnull-objects -C++ ObjC++ +C++ ObjC++ Ignore Warn(switch %qs is no longer supported) fnothrow-opt C++ ObjC++ Optimization Var(flag_nothrow_opt) @@ -731,7 +731,7 @@ C++ ObjC++ Recognize C++ keywords like \"compl\" and \"xor\" foptional-diags -C++ ObjC++ +C++ ObjC++ Ignore Does nothing. Preserved for backward compatibility. fpch-deps @@ -786,7 +786,7 @@ C ObjC C++ ObjC++ LTO Var(flag_signed_ch Make \"char\" signed by default fsquangle -C++ ObjC++ +C++ ObjC++ Ignore Warn(switch %qs is no longer supported) fstats C++ ObjC++ Var(flag_detailed_statistics) @@ -797,7 +797,7 @@ C++ ObjC++ Optimization Var(flag_strict_ Assume that values of enumeration type are always within the minimum range of that type fstrict-prototype -C++ ObjC++ +C++ ObjC++ Ignore Warn(switch %qs is no longer supported) ftabstop= C ObjC C++ ObjC++ Joined RejectNegative UInteger @@ -811,7 +811,7 @@ C++ ObjC++ Joined RejectNegative UIntege -ftemplate-depth=<number> Specify maximum template instantiation depth fthis-is-variable -C++ ObjC++ +C++ ObjC++ Ignore Warn(switch %qs is no longer supported) fthreadsafe-statics C++ ObjC++ Optimization Var(flag_threadsafe_statics) Init(1) @@ -842,11 +842,11 @@ C++ ObjC++ Var(flag_visibility_ms_compat Changes visibility to match Microsoft Visual Studio by default fvtable-gc -C++ ObjC++ +C++ ObjC++ Ignore Warn(switch %qs is no longer supported) Discard unused virtual functions fvtable-thunks -C++ ObjC++ +C++ ObjC++ Ignore Warn(switch %qs is no longer supported) Implement vtables using thunks fweak @@ -862,7 +862,7 @@ C ObjC C++ ObjC++ Var(flag_working_direc Generate a #line directive pointing at the current working directory fxref -C++ ObjC++ +C++ ObjC++ Ignore Warn(switch %qs is no longer supported) Emit cross referencing information fzero-link diff -rupN --exclude=.svn gcc-mainline-0-alias/gcc/common.opt gcc-mainline/gcc/common.opt --- gcc-mainline-0-alias/gcc/common.opt 2010-08-31 17:37:25.000000000 -0700 +++ gcc-mainline/gcc/common.opt 2010-09-01 15:13:14.000000000 -0700 @@ -248,7 +248,7 @@ Common Var(warn_uninitialized) Init(-1) Warn about uninitialized automatic variables Wunreachable-code -Common +Common Ignore Does nothing. Preserved for backward compatibility. Wunused @@ -387,19 +387,19 @@ falign-loops= Common RejectNegative Joined UInteger fargument-alias -Common +Common Ignore Does nothing. Preserved for backward compatibility. fargument-noalias -Common +Common Ignore Does nothing. Preserved for backward compatibility. fargument-noalias-global -Common +Common Ignore Does nothing. Preserved for backward compatibility. fargument-noalias-anything -Common +Common Ignore Does nothing. Preserved for backward compatibility. fasynchronous-unwind-tables @@ -490,7 +490,7 @@ Common Report Var(flag_cse_follow_jumps) When running CSE, follow jumps to their targets fcse-skip-blocks -Common +Common Ignore Does nothing. Preserved for backward compatibility. fcx-limited-range @@ -619,7 +619,7 @@ Common Report Var(flag_float_store) Opti Don't allocate floats and doubles in extended-precision registers fforce-addr -Common +Common Ignore Does nothing. Preserved for backward compatibility. fforward-propagate @@ -852,7 +852,7 @@ Common Report Var(flag_leading_underscor Give external symbols a leading underscore floop-optimize -Common +Common Ignore Does nothing. Preserved for backward compatibility. flto @@ -1098,7 +1098,7 @@ Common Report Var(flag_rerun_cse_after_l Add a common subexpression elimination pass after loop optimizations frerun-loop-opt -Common +Common Ignore Does nothing. Preserved for backward compatibility. frounding-math @@ -1134,7 +1134,7 @@ Common Report Var(flag_sched2_use_superb If scheduling post reload, do superblock scheduling fsched2-use-traces -Common +Common Ignore Does nothing. Preserved for backward compatibility. fschedule-insns @@ -1219,7 +1219,7 @@ Common Report Var(flag_section_anchors) Access data in the same section from shared anchor points fsee -Common +Common Ignore Does nothing. Preserved for backward compatibility. fzee @@ -1286,7 +1286,7 @@ Common RejectNegative Var(flag_stack_usa Output stack usage information on a per-function basis fstrength-reduce -Common +Common Ignore Does nothing. Preserved for backward compatibility. ; Nonzero if we should do (language-dependent) alias analysis. @@ -1349,7 +1349,7 @@ Common Report Var(flag_tree_bit_ccp) Opt Enable SSA-BIT-CCP optimization on trees ftree-store-ccp -Common +Common Ignore Does nothing. Preserved for backward compatibility. ftree-ch @@ -1365,7 +1365,7 @@ Common Report Var(flag_tree_copy_prop) O Enable copy propagation on trees ftree-store-copy-prop -Common +Common Ignore Does nothing. Preserved for backward compatibility. ftree-cselim @@ -1441,7 +1441,7 @@ Common Report Var(flag_tree_reassoc) Ini Enable reassociation on tree level ftree-salias -Common +Common Ignore Does nothing. Preserved for backward compatibility. ftree-sink diff -rupN --exclude=.svn gcc-mainline-0-alias/gcc/config/i386/i386.h gcc-mainline/gcc/config/i386/i386.h --- gcc-mainline-0-alias/gcc/config/i386/i386.h 2010-08-12 15:57:12.000000000 -0700 +++ gcc-mainline/gcc/config/i386/i386.h 2010-09-01 15:31:39.000000000 -0700 @@ -555,15 +555,8 @@ extern const char *host_detect_local_cpu #ifndef CC1_CPU_SPEC #define CC1_CPU_SPEC_1 "\ -%{mcpu=*:-mtune=%* \ -%n`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.\n} \ -%<mcpu=* \ -%{mintel-syntax:-masm=intel \ -%n`-mintel-syntax' is deprecated. Use `-masm=intel' instead.\n} \ %{msse5:-mavx \ -%n'-msse5' was removed.\n} \ -%{mno-intel-syntax:-masm=att \ -%n`-mno-intel-syntax' is deprecated. Use `-masm=att' instead.\n}" +%n'-msse5' was removed.\n}" #ifndef HAVE_LOCAL_CPU_DETECT #define CC1_CPU_SPEC CC1_CPU_SPEC_1 diff -rupN --exclude=.svn gcc-mainline-0-alias/gcc/config/i386/i386.opt gcc-mainline/gcc/config/i386/i386.opt --- gcc-mainline-0-alias/gcc/config/i386/i386.opt 2010-07-29 02:45:30.000000000 -0700 +++ gcc-mainline/gcc/config/i386/i386.opt 2010-09-01 15:32:34.000000000 -0700 @@ -1,6 +1,7 @@ ; Options for the IA-32 and AMD64 ports of the compiler. -; Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +; Copyright (C) 2005, 2006, 2007, 2008, 2009, +; 2010 Free Software Foundation, Inc. ; ; This file is part of GCC. ; @@ -112,6 +113,9 @@ mcmodel= Target RejectNegative Joined Var(ix86_cmodel_string) Use given x86-64 code model +mcpu= +Target RejectNegative Joined Undocumented Alias(mtune=) Warn(%<-mcpu=%> is deprecated; use %<-mtune=%> or %<-march=%> instead) + mfancy-math-387 Target RejectNegative Report InverseMask(NO_FANCY_MATH_387, USE_FANCY_MATH_387) Save Generate sin, cos, sqrt for FPU @@ -145,7 +149,7 @@ Target Report Mask(INLINE_STRINGOPS_DYNA Inline memset/memcpy string operations, but perform inline version only for small blocks mintel-syntax -Target Undocumented +Target Undocumented Alias(masm=, intel, att) Warn(%<-mintel-syntax%> and %<-mno-intel-syntax%> are deprecated; use %<-masm=intel%> and %<-masm=att%> instead) ;; Deprecated mms-bitfields diff -rupN --exclude=.svn gcc-mainline-0-alias/gcc/doc/options.texi gcc-mainline/gcc/doc/options.texi --- gcc-mainline-0-alias/gcc/doc/options.texi 2010-09-01 07:55:26.000000000 -0700 +++ gcc-mainline/gcc/doc/options.texi 2010-09-01 15:15:56.000000000 -0700 @@ -273,6 +273,19 @@ not need to handle it and no @samp{OPT_} for it; only the canonical form of the option will be seen in those places. +@item Ignore +This option is ignored apart from printing any warning specified using +@code{Warn}. The option will not be seen by specs and no @samp{OPT_} +enumeration value is defined for it. + +@item Warn(@var{message}) +If this option is used, output the warning @var{message}. +@var{message} is a format string, either taking a single operand with +a @samp{%qs} format which is the option name, or not taking any +operands, which is passed to the @samp{warning} function. If an alias +is marked @code{Warn}, the target of the alias must not also be marked +@code{Warn}. + @item Report The state of the option should be printed by @option{-fverbose-asm}. diff -rupN --exclude=.svn gcc-mainline-0-alias/gcc/opt-functions.awk gcc-mainline/gcc/opt-functions.awk --- gcc-mainline-0-alias/gcc/opt-functions.awk 2010-08-31 17:45:26.000000000 -0700 +++ gcc-mainline/gcc/opt-functions.awk 2010-09-01 15:45:34.000000000 -0700 @@ -114,7 +114,9 @@ function global_state_p(flags) # associated with it. function needs_state_p(flags) { - return flag_set_p("Target", flags) + return (flag_set_p("Target", flags) \ + && !flag_set_p("Alias.*", flags) \ + && !flag_set_p("Ignore", flags)) } # If FLAGS describes an option that needs a static state variable, diff -rupN --exclude=.svn gcc-mainline-0-alias/gcc/optc-gen.awk gcc-mainline/gcc/optc-gen.awk --- gcc-mainline-0-alias/gcc/optc-gen.awk 2010-08-31 17:35:49.000000000 -0700 +++ gcc-mainline/gcc/optc-gen.awk 2010-09-01 14:45:19.000000000 -0700 @@ -201,9 +201,19 @@ for (i = 0; i < n_opts; i++) { else missing_arg_error = quote missing_arg_error quote + + warn_message = opt_args("Warn", flags[i]) + if (warn_message == "") + warn_message = "0" + else + warn_message = quote warn_message quote + alias_arg = opt_args("Alias", flags[i]) if (alias_arg == "") { - alias_data = "NULL, NULL, N_OPTS" + if (flag_set_p("Ignore", flags[i])) + alias_data = "NULL, NULL, OPT_SPECIAL_ignore" + else + alias_data = "NULL, NULL, N_OPTS" } else { alias_opt = nth_arg(0, alias_arg) alias_posarg = nth_arg(1, alias_arg) @@ -246,8 +256,8 @@ for (i = 0; i < n_opts; i++) { } # Split the printf after %u to work around an ia64-hp-hpux11.23 # awk bug. - printf(" { %c-%s%c,\n %s,\n %s,\n %s, %s, %u,", - quote, opts[i], quote, hlp, missing_arg_error, + printf(" { %c-%s%c,\n %s,\n %s,\n %s,\n %s, %s, %u,", + quote, opts[i], quote, hlp, missing_arg_error, warn_message, alias_data, back_chain[i], len) printf(" %d,\n", idx) condition = opt_args("Condition", flags[i]) diff -rupN --exclude=.svn gcc-mainline-0-alias/gcc/opth-gen.awk gcc-mainline/gcc/opth-gen.awk --- gcc-mainline-0-alias/gcc/opth-gen.awk 2010-08-31 15:15:00.000000000 -0700 +++ gcc-mainline/gcc/opth-gen.awk 2010-09-01 14:45:57.000000000 -0700 @@ -369,6 +369,7 @@ for (i = 0; i < n_opts; i++) { print " N_OPTS," print " OPT_SPECIAL_unknown," +print " OPT_SPECIAL_ignore," print " OPT_SPECIAL_program_name," print " OPT_SPECIAL_input_file" print "};" diff -rupN --exclude=.svn gcc-mainline-0-alias/gcc/opts-common.c gcc-mainline/gcc/opts-common.c --- gcc-mainline-0-alias/gcc/opts-common.c 2010-09-01 07:53:00.000000000 -0700 +++ gcc-mainline/gcc/opts-common.c 2010-09-01 15:53:15.000000000 -0700 @@ -214,6 +214,7 @@ decode_cmdline_option (const char **argv char *p; const struct cl_option *option; int errors = 0; + const char *warn_message = NULL; bool separate_arg_flag; bool joined_arg_flag; @@ -254,6 +255,8 @@ decode_cmdline_option (const char **argv goto done; } + warn_message = option->warn_message; + /* Check to see if the option is disabled for this configuration. */ if (option->flags & CL_DISABLED) errors |= CL_ERR_DISABLED; @@ -300,55 +303,73 @@ decode_cmdline_option (const char **argv if (arg == NULL && (separate_arg_flag || joined_arg_flag)) errors |= CL_ERR_MISSING_ARG; - /* Is this option an alias? */ + /* Is this option an alias (or an ignored option, marked as an alias + of OPT_SPECIAL_ignore)? */ if (option->alias_target != N_OPTS) { size_t new_opt_index = option->alias_target; - const struct cl_option *new_option = &cl_options[new_opt_index]; - - /* The new option must not be an alias itself. */ - gcc_assert (new_option->alias_target == N_OPTS); - if (option->neg_alias_arg) + if (new_opt_index == OPT_SPECIAL_ignore) { - gcc_assert (option->alias_arg != NULL); - gcc_assert (arg == NULL); - if (value) - arg = option->alias_arg; - else - arg = option->neg_alias_arg; + gcc_assert (option->alias_arg == NULL); + gcc_assert (option->neg_alias_arg == NULL); + opt_index = new_opt_index; + arg = NULL; value = 1; } - else if (option->alias_arg) + else { - gcc_assert (value == 1); - gcc_assert (arg == NULL); - arg = option->alias_arg; - } + const struct cl_option *new_option = &cl_options[new_opt_index]; - opt_index = new_opt_index; - option = new_option; + /* The new option must not be an alias itself. */ + gcc_assert (new_option->alias_target == N_OPTS); - if (value == 0) - gcc_assert (!(option->flags & CL_REJECT_NEGATIVE)); + if (option->neg_alias_arg) + { + gcc_assert (option->alias_arg != NULL); + gcc_assert (arg == NULL); + if (value) + arg = option->alias_arg; + else + arg = option->neg_alias_arg; + value = 1; + } + else if (option->alias_arg) + { + gcc_assert (value == 1); + gcc_assert (arg == NULL); + arg = option->alias_arg; + } - /* Recompute what arguments are allowed. */ - separate_arg_flag = ((option->flags & CL_SEPARATE) - && !((option->flags & CL_NO_DRIVER_ARG) - && (lang_mask & CL_DRIVER))); - joined_arg_flag = (option->flags & CL_JOINED) != 0; + opt_index = new_opt_index; + option = new_option; - if (!(errors & CL_ERR_MISSING_ARG)) - { - if (separate_arg_flag || joined_arg_flag) - gcc_assert (arg != NULL); - else - gcc_assert (arg == NULL); - } + if (value == 0) + gcc_assert (!(option->flags & CL_REJECT_NEGATIVE)); + + /* Recompute what arguments are allowed. */ + separate_arg_flag = ((option->flags & CL_SEPARATE) + && !((option->flags & CL_NO_DRIVER_ARG) + && (lang_mask & CL_DRIVER))); + joined_arg_flag = (option->flags & CL_JOINED) != 0; + + if (!(errors & CL_ERR_MISSING_ARG)) + { + if (separate_arg_flag || joined_arg_flag) + gcc_assert (arg != NULL); + else + gcc_assert (arg == NULL); + } - /* Recheck for disabled options. */ - if (option->flags & CL_DISABLED) - errors |= CL_ERR_DISABLED; + /* Recheck for warnings and disabled options. */ + if (option->warn_message) + { + gcc_assert (warn_message == NULL); + warn_message = option->warn_message; + } + if (option->flags & CL_DISABLED) + errors |= CL_ERR_DISABLED; + } } /* Check if this is a switch for a different front end. */ @@ -370,6 +391,7 @@ decode_cmdline_option (const char **argv decoded->arg = arg; decoded->value = value; decoded->errors = errors; + decoded->warn_message = warn_message; if (opt_index == OPT_SPECIAL_unknown) { @@ -408,7 +430,7 @@ decode_cmdline_option (const char **argv else decoded->canonical_option[i] = NULL; } - if (opt_index != OPT_SPECIAL_unknown) + if (opt_index != OPT_SPECIAL_unknown && opt_index != OPT_SPECIAL_ignore) generate_canonical_option (opt_index, arg, value, decoded); decoded->orig_option_with_args_text = p = XNEWVEC (char, total_len); for (i = 0; i < result; i++) @@ -448,6 +470,7 @@ decode_cmdline_options_to_array (unsigne opt_array = XNEWVEC (struct cl_decoded_option, argc); opt_array[0].opt_index = OPT_SPECIAL_program_name; + opt_array[0].warn_message = NULL; opt_array[0].arg = argv[0]; opt_array[0].orig_option_with_args_text = argv[0]; opt_array[0].canonical_option_num_elements = 1; @@ -678,6 +701,7 @@ generate_option (size_t opt_index, const const struct cl_option *option = &cl_options[opt_index]; decoded->opt_index = opt_index; + decoded->warn_message = NULL; decoded->arg = arg; decoded->value = value; decoded->errors = (option_ok_for_language (option, lang_mask) @@ -709,6 +733,7 @@ generate_option_input_file (const char * struct cl_decoded_option *decoded) { decoded->opt_index = OPT_SPECIAL_input_file; + decoded->warn_message = NULL; decoded->arg = file; decoded->orig_option_with_args_text = file; decoded->canonical_option_num_elements = 1; @@ -729,7 +754,10 @@ read_cmdline_option (struct cl_decoded_o const struct cl_option_handlers *handlers) { const struct cl_option *option; - const char *opt; + const char *opt = decoded->orig_option_with_args_text; + + if (decoded->warn_message) + warning (0, decoded->warn_message, opt); if (decoded->opt_index == OPT_SPECIAL_unknown) { @@ -738,8 +766,10 @@ read_cmdline_option (struct cl_decoded_o return; } + if (decoded->opt_index == OPT_SPECIAL_ignore) + return; + option = &cl_options[decoded->opt_index]; - opt = decoded->orig_option_with_args_text; if (decoded->errors & CL_ERR_DISABLED) { diff -rupN --exclude=.svn gcc-mainline-0-alias/gcc/opts.c gcc-mainline/gcc/opts.c --- gcc-mainline-0-alias/gcc/opts.c 2010-08-31 17:52:40.000000000 -0700 +++ gcc-mainline/gcc/opts.c 2010-09-01 15:13:25.000000000 -0700 @@ -2077,24 +2077,6 @@ common_handle_option (const struct cl_de global_dc->inhibit_warnings = true; break; - case OPT_fsee: - case OPT_fcse_skip_blocks: - case OPT_floop_optimize: - case OPT_frerun_loop_opt: - case OPT_fsched2_use_traces: - case OPT_fstrength_reduce: - case OPT_ftree_store_copy_prop: - case OPT_fforce_addr: - case OPT_ftree_salias: - case OPT_ftree_store_ccp: - case OPT_Wunreachable_code: - case OPT_fargument_alias: - case OPT_fargument_noalias: - case OPT_fargument_noalias_anything: - case OPT_fargument_noalias_global: - /* These are no-ops, preserved for backward compatibility. */ - break; - case OPT_fuse_linker_plugin: /* No-op. Used by the driver and passed to us because it starts with f.*/ break; @@ -2359,6 +2341,8 @@ enable_warning_as_error (const char *arg if (option->alias_target != N_OPTS) option_index = option->alias_target; + if (option_index == OPT_SPECIAL_ignore) + return; diagnostic_classify_diagnostic (global_dc, option_index, kind, UNKNOWN_LOCATION); if (kind == DK_ERROR) diff -rupN --exclude=.svn gcc-mainline-0-alias/gcc/opts.h gcc-mainline/gcc/opts.h --- gcc-mainline-0-alias/gcc/opts.h 2010-08-31 14:55:19.000000000 -0700 +++ gcc-mainline/gcc/opts.h 2010-09-01 14:54:56.000000000 -0700 @@ -45,6 +45,7 @@ struct cl_option const char *opt_text; const char *help; const char *missing_argument_error; + const char *warn_message; const char *alias_arg; const char *neg_alias_arg; unsigned short alias_target; @@ -117,6 +118,9 @@ struct cl_decoded_option non-options and unknown options. */ size_t opt_index; + /* Any warning to give for use of this option, or NULL if none. */ + const char *warn_message; + /* The string argument, or NULL if none. For OPT_SPECIAL_* cases, the option or non-option command-line argument. */ const char *arg; diff -rupN --exclude=.svn gcc-mainline-0-alias/gcc/po/exgettext gcc-mainline/gcc/po/exgettext --- gcc-mainline-0-alias/gcc/po/exgettext 2010-07-27 05:02:03.000000000 -0700 +++ gcc-mainline/gcc/po/exgettext 2010-09-01 15:24:42.000000000 -0700 @@ -226,7 +226,22 @@ echo "scanning option files..." >&2 if ((field == 1) && /MissingArgError/) { line = $0 sub(".*MissingArgError\\(", "", line) - sub("\\).*", "", line) + if (line ~ "^{") { + sub("^{", "", line) + sub("}\\).*", "", line) + } else + sub("\\).*", "", line) + printf("#line %d \"%s\"\n", lineno, file) + printf("_(\"%s\")\n", line) + } + if ((field == 1) && /Warn/) { + line = $0 + sub(".*Warn\\(", "", line) + if (line ~ "^{") { + sub("^{", "", line) + sub("}\\).*", "", line) + } else + sub("\\).*", "", line) printf("#line %d \"%s\"\n", lineno, file) printf("_(\"%s\")\n", line) }