diff options
-rw-r--r-- | gcc/ChangeLog | 29 | ||||
-rw-r--r-- | gcc/c-family/ChangeLog | 13 | ||||
-rw-r--r-- | gcc/c-family/c-opts.c | 36 | ||||
-rw-r--r-- | gcc/c-family/c.opt | 42 | ||||
-rw-r--r-- | gcc/common.opt | 30 | ||||
-rw-r--r-- | gcc/config/i386/i386.h | 9 | ||||
-rw-r--r-- | gcc/config/i386/i386.opt | 8 | ||||
-rw-r--r-- | gcc/doc/options.texi | 13 | ||||
-rw-r--r-- | gcc/opt-functions.awk | 4 | ||||
-rw-r--r-- | gcc/optc-gen.awk | 16 | ||||
-rw-r--r-- | gcc/opth-gen.awk | 1 | ||||
-rw-r--r-- | gcc/opts-common.c | 108 | ||||
-rw-r--r-- | gcc/opts.c | 20 | ||||
-rw-r--r-- | gcc/opts.h | 4 | ||||
-rw-r--r-- | gcc/po/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/po/exgettext | 17 |
16 files changed, 211 insertions, 144 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3baa67ace25..fc2ceb19f2a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,34 @@ 2010-09-02 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. + +2010-09-02 Joseph Myers <joseph@codesourcery.com> + PR driver/44076 * opts.h (struct cl_option): Add alias_arg, neg_alias_arg and alias_target fields. diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index dac0bf4684e..56fef0b0694 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,5 +1,18 @@ 2010-09-02 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. + +2010-09-02 Joseph Myers <joseph@codesourcery.com> + * c.opt (Wcomments, Werror-implicit-function-declaration, ftemplate-depth-, std=c89, std=c9x, std=gnu89, std=gnu9x, std=iso9899:1990, std=iso9899:1999, std=iso9899:199x): Mark as diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c index d9b212c4e2b..e641ad029cb 100644 --- a/gcc/c-family/c-opts.c +++ b/gcc/c-family/c-opts.c @@ -537,10 +537,6 @@ c_common_handle_option (size_t scode, const char *arg, int value, 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, const char *arg, int value, 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, const char *arg, int value, 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, const char *arg, int value, 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, const char *arg, int value, cpp_opts->operator_names = value; break; - case OPT_foptional_diags: - /* Ignore. */ - break; - case OPT_fpch_deps: cpp_opts->restore_pch_deps = value; break; diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index 5cba0ded57a..f10cc48d756 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -275,7 +275,7 @@ C ObjC Var(warn_implicit_int) Init(-1) Warning 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(1) 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) Init(1) -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) Init(1) 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_char) 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_enums) 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 UInteger -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_directory) Init(-1) 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 --git a/gcc/common.opt b/gcc/common.opt index d30e41c8651..c5be49ea159 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -248,7 +248,7 @@ Common Var(warn_uninitialized) Init(-1) Warning 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) Optimization 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) Optimization 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_underscore) Init(-1) 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_loop) Init(2) Optimization 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_superblocks) Optimization 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) Optimization 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_usage) 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) Optimization 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) Optimization 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) Init(1) Optimization Enable reassociation on tree level ftree-salias -Common +Common Ignore Does nothing. Preserved for backward compatibility. ftree-sink diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index ea36c112ec2..5bd41539c4a 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -555,15 +555,8 @@ extern const char *host_detect_local_cpu (int argc, const char **argv); #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 --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt index 236082da492..8009830ebfe 100644 --- a/gcc/config/i386/i386.opt +++ b/gcc/config/i386/i386.opt @@ -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_DYNAMICALLY) Save 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 --git a/gcc/doc/options.texi b/gcc/doc/options.texi index 46610f03ad5..d7a18af7ef4 100644 --- a/gcc/doc/options.texi +++ b/gcc/doc/options.texi @@ -273,6 +273,19 @@ not need to handle it and no @samp{OPT_} enumeration value is defined 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 --git a/gcc/opt-functions.awk b/gcc/opt-functions.awk index c57a7694de3..94816a2d363 100644 --- a/gcc/opt-functions.awk +++ b/gcc/opt-functions.awk @@ -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 --git a/gcc/optc-gen.awk b/gcc/optc-gen.awk index 4376d72dedd..bee780c0b63 100644 --- a/gcc/optc-gen.awk +++ b/gcc/optc-gen.awk @@ -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 --git a/gcc/opth-gen.awk b/gcc/opth-gen.awk index cfeccfe47aa..9d3ea9e67b0 100644 --- a/gcc/opth-gen.awk +++ b/gcc/opth-gen.awk @@ -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 --git a/gcc/opts-common.c b/gcc/opts-common.c index 07758967e6d..40822a7bde1 100644 --- a/gcc/opts-common.c +++ b/gcc/opts-common.c @@ -214,6 +214,7 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask, 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, unsigned int lang_mask, 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, unsigned int lang_mask, 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, unsigned int lang_mask, 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, unsigned int lang_mask, 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 (unsigned int argc, const char **argv, 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 char *arg, int value, 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 *file, 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_option *decoded, 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_option *decoded, 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 --git a/gcc/opts.c b/gcc/opts.c index ab7b45d5244..e59332f68f8 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -2081,24 +2081,6 @@ common_handle_option (const struct cl_decoded_option *decoded, 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; @@ -2363,6 +2345,8 @@ enable_warning_as_error (const char *arg, int value, unsigned int lang_mask, 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 --git a/gcc/opts.h b/gcc/opts.h index f3e01440a08..09e305b225b 100644 --- a/gcc/opts.h +++ b/gcc/opts.h @@ -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 --git a/gcc/po/ChangeLog b/gcc/po/ChangeLog index 75200f86d36..66d0152edd0 100644 --- a/gcc/po/ChangeLog +++ b/gcc/po/ChangeLog @@ -1,3 +1,8 @@ +2010-09-02 Joseph Myers <joseph@codesourcery.com> + + * exgettext: Handle {} in operand of MissingArgError. Handle + Warn. + 2010-07-27 Joseph Myers <joseph@codesourcery.com> * exgettext: Also extract MissingArgError texts from .opt files. diff --git a/gcc/po/exgettext b/gcc/po/exgettext index c3d92448f98..6cc9156e58f 100644 --- a/gcc/po/exgettext +++ b/gcc/po/exgettext @@ -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) } |