diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 41 | ||||
-rw-r--r-- | gcc/Makefile.in | 37 | ||||
-rw-r--r-- | gcc/ada/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/Make-lang.in | 2 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/misc.c | 2 | ||||
-rw-r--r-- | gcc/c-family/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/c-family/c-common.c | 3 | ||||
-rw-r--r-- | gcc/c-family/c-common.h | 2 | ||||
-rw-r--r-- | gcc/c-family/c-opts.c | 12 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/Make-lang.in | 2 | ||||
-rw-r--r-- | gcc/fortran/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fortran/Make-lang.in | 2 | ||||
-rw-r--r-- | gcc/fortran/gfortran.h | 2 | ||||
-rw-r--r-- | gcc/fortran/options.c | 2 | ||||
-rw-r--r-- | gcc/gcc.c | 10 | ||||
-rw-r--r-- | gcc/java/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/java/Make-lang.in | 4 | ||||
-rw-r--r-- | gcc/java/lang.c | 4 | ||||
-rw-r--r-- | gcc/langhooks-def.h | 2 | ||||
-rw-r--r-- | gcc/langhooks.c | 1 | ||||
-rw-r--r-- | gcc/langhooks.h | 4 | ||||
-rw-r--r-- | gcc/lto-opts.c | 2 | ||||
-rw-r--r-- | gcc/lto/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/lto/Make-lang.in | 2 | ||||
-rw-r--r-- | gcc/lto/lto-lang.c | 1 | ||||
-rw-r--r-- | gcc/opts-common.c | 65 | ||||
-rw-r--r-- | gcc/opts.c | 76 | ||||
-rw-r--r-- | gcc/opts.h | 20 | ||||
-rw-r--r-- | gcc/toplev.c | 2 |
30 files changed, 216 insertions, 118 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0a60deb..6839f84 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,44 @@ +2010-11-12 Joseph Myers <joseph@codesourcery.com> + + * Makefile.in (OPTS_H): Define. + (c-decl.o, c-family/c-common.o, c-family/c-opts.o, + c-family/c-pch.o, c-family/c-pragma.o, gcc.o, gccspec.o, + cppspec.o, options.o, gcc-options.o, lto-opts.o, opts.o, + opts-common.o, toplev.o, passes.o, matrix-reorg.o, + ipa-struct-reorg.o, PLUGIN_HEADERS): Use $(OPTS_H). + * gcc.c (driver_handle_option): Take location_t parameter. + (process_command, do_self_spec): Update calls to + read_cmdline_option. + * langhooks-def.h (lhd_handle_option): Take location_t parameter. + * langhooks.c (lhd_handle_option): Take location_t parameter. + * langhooks.h (handle_option): Take location_t parameter. + * lto-opts.c (lto_reissue_options): Update call to set_option. + * opts-common.c (handle_option): Make static. Take location_t + parameter and pass it to other functions. + (handle_generated_option): Take location_t parameter and pass it + to other functions. + (read_cmdline_option): Take location_t parameter and pass it to + other functions. Use warning_at and error_at. + (set_option): Take location_t parameter and pass it to other + functions. + * opts.c (common_handle_option): Take location_t parameter and + pass it to other functions. + (enable_warning_as_error): Make static. Take location_t parameter + and pass it to other functions. + (lang_handle_option): Take location_t parameter and pass it to + other functions. + (target_handle_option): Take location_t parameter. + (read_cmdline_options, maybe_default_option, + maybe_default_options, default_options_optimization, + decode_options): Take location_t parameter and pass it to other + functions. + * opts.h: Include input.h. + (struct cl_option_handler_func, decode_options, set_option, + handle_generated_option, read_cmdline_option): Take location_t + parameters. + (handle_option, enable_warning_as_error): Remove. + * toplev.c (toplev_main): Update call to decode_options. + 2010-11-12 Tobias Grosser <grosser@fim.uni-passau.de> * graphite-cloog-util.c (oppose_constraint, diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 8367a71..ce71b41b 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -932,6 +932,7 @@ PREDICT_H = predict.h predict.def CPPLIB_H = $(srcdir)/../libcpp/include/line-map.h \ $(srcdir)/../libcpp/include/cpplib.h INPUT_H = $(srcdir)/../libcpp/include/line-map.h input.h +OPTS_H = $(INPUT_H) opts.h DECNUM_H = $(DECNUM)/decContext.h $(DECNUM)/decDPD.h $(DECNUM)/decNumber.h \ $(DECNUMFMT)/decimal32.h $(DECNUMFMT)/decimal64.h \ $(DECNUMFMT)/decimal128.h $(DECNUMFMT)/decimal128Local.h @@ -2005,7 +2006,7 @@ c-convert.o : c-convert.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ c-decl.o : c-decl.c c-lang.h $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(TREE_H) $(C_TREE_H) $(GGC_H) $(TARGET_H) $(FLAGS_H) $(FUNCTION_H) \ output.h debug.h $(TOPLEV_H) intl.h $(TM_P_H) $(TREE_INLINE_H) \ - $(TIMEVAR_H) opts.h $(C_PRAGMA_H) gt-c-decl.h $(CGRAPH_H) \ + $(TIMEVAR_H) $(OPTS_H) $(C_PRAGMA_H) gt-c-decl.h $(CGRAPH_H) \ $(HASHTAB_H) $(LIBFUNCS_H) $(EXCEPT_H) $(LANGHOOKS_DEF_H) \ $(TREE_DUMP_H) $(C_COMMON_H) $(CPPLIB_H) $(DIAGNOSTIC_CORE_H) \ $(INPUT_H) langhooks.h tree-mudflap.h pointer-set.h tree-iterator.h \ @@ -2081,7 +2082,7 @@ c-family/c-common.o : c-family/c-common.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(GGC_H) builtin-types.def builtin-attrs.def \ $(DIAGNOSTIC_H) langhooks.h \ $(TARGET_H) tree-iterator.h langhooks.h tree-mudflap.h \ - intl.h opts.h $(CPPLIB_H) $(TREE_INLINE_H) $(HASHTAB_H) \ + intl.h $(OPTS_H) $(CPPLIB_H) $(TREE_INLINE_H) $(HASHTAB_H) \ $(BUILTINS_DEF) $(CGRAPH_H) $(BASIC_BLOCK_H) $(TARGET_DEF_H) \ $(LIBFUNCS_H) \ gt-c-family-c-common.h @@ -2118,14 +2119,14 @@ c-family/c-omp.o : c-family/c-omp.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ c-family/c-opts.o : c-family/c-opts.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(TREE_H) $(C_PRAGMA_H) $(FLAGS_H) $(TOPLEV_H) langhooks.h \ $(DIAGNOSTIC_H) intl.h debug.h $(C_COMMON_H) \ - opts.h $(OPTIONS_H) $(MKDEPS_H) incpath.h cppdefault.h + $(OPTS_H) $(OPTIONS_H) $(MKDEPS_H) incpath.h cppdefault.h $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \ $< $(OUTPUT_OPTION) @TARGET_SYSTEM_ROOT_DEFINE@ c-family/c-pch.o : c-family/c-pch.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(CPPLIB_H) $(TREE_H) $(C_COMMON_H) output.h $(TOPLEV_H) $(C_PRAGMA_H) \ $(GGC_H) debug.h langhooks.h $(FLAGS_H) hosthooks.h version.h \ - $(TARGET_H) opts.h $(TIMEVAR_H) + $(TARGET_H) $(OPTS_H) $(TIMEVAR_H) $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \ -DHOST_MACHINE=\"$(host)\" -DTARGET_MACHINE=\"$(target)\" \ $< $(OUTPUT_OPTION) @@ -2137,7 +2138,7 @@ c-family/c-ppoutput.o : c-family/c-ppoutput.c $(CONFIG_H) $(SYSTEM_H) \ c-family/c-pragma.o: c-family/c-pragma.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(TM_H) $(TREE_H) $(FUNCTION_H) $(C_PRAGMA_H) $(TOPLEV_H) output.h \ $(TM_P_H) $(C_COMMON_H) $(TARGET_H) $(CPPLIB_H) $(FLAGS_H) \ - $(DIAGNOSTIC_H) opts.h $(PLUGINS_H) \ + $(DIAGNOSTIC_H) $(OPTS_H) $(PLUGINS_H) \ gt-c-family-c-pragma.h c-family/c-pretty-print.o : c-family/c-pretty-print.c $(C_PRETTY_PRINT_H) \ @@ -2190,21 +2191,21 @@ DRIVER_DEFINES = \ gcc.o: gcc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) intl.h multilib.h \ Makefile $(lang_specs_files) specs.h prefix.h $(GCC_H) $(FLAGS_H) \ - configargs.h $(OBSTACK_H) opts.h $(DIAGNOSTIC_H) + configargs.h $(OBSTACK_H) $(OPTS_H) $(DIAGNOSTIC_H) (SHLIB_LINK='$(SHLIB_LINK)'; \ $(COMPILER) $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \ $(DRIVER_DEFINES) \ -c $(srcdir)/gcc.c $(OUTPUT_OPTION)) gccspec.o: gccspec.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(GCC_H) \ - opts.h + $(OPTS_H) (SHLIB_LINK='$(SHLIB_LINK)'; \ $(COMPILER) $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \ $(DRIVER_DEFINES) \ -c $(srcdir)/gccspec.c $(OUTPUT_OPTION)) cppspec.o: cppspec.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(GCC_H) \ - opts.h + $(OPTS_H) specs.h : s-specs ; @true s-specs : Makefile @@ -2232,9 +2233,9 @@ s-options-h: optionlist $(srcdir)/opt-functions.awk $(srcdir)/opth-gen.awk $(STAMP) $@ options.o: options.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TARGET_H) $(FLAGS_H) \ - $(TM_H) opts.h intl.h + $(TM_H) $(OPTS_H) intl.h -gcc-options.o: options.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) opts.h intl.h +gcc-options.o: options.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(OPTS_H) intl.h $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(OUTPUT_OPTION) \ -DGCC_DRIVER options.c @@ -2315,7 +2316,7 @@ lto-symtab.o: lto-symtab.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ toplev.h $(TREE_H) $(GIMPLE_H) $(GGC_H) $(LAMBDA_H) $(HASHTAB_H) \ $(LTO_STREAMER_H) $(LINKER_PLUGIN_API_H) gt-lto-symtab.h lto-opts.o: lto-opts.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \ - $(HASHTAB_H) $(GGC_H) $(BITMAP_H) $(FLAGS_H) opts.h $(OPTIONS_H) \ + $(HASHTAB_H) $(GGC_H) $(BITMAP_H) $(FLAGS_H) $(OPTS_H) $(OPTIONS_H) \ $(TARGET_H) $(TOPLEV_H) $(DIAGNOSTIC_H) $(LTO_STREAMER_H) lto-streamer.o: lto-streamer.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(TM_H) $(TREE_H) $(GIMPLE_H) $(BITMAP_H) $(LTO_STREAMER_H) $(FLAGS_H) \ @@ -2807,12 +2808,12 @@ fold-const.o : fold-const.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(GIMPLE_H) realmpfr.h $(TREE_FLOW_H) diagnostic.o : diagnostic.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ version.h $(INPUT_H) intl.h $(DIAGNOSTIC_H) diagnostic.def -opts.o : opts.c opts.h $(OPTIONS_H) $(TOPLEV_H) $(DIAGNOSTIC_CORE_H) $(CONFIG_H) $(SYSTEM_H) \ +opts.o : opts.c $(OPTS_H) $(OPTIONS_H) $(TOPLEV_H) $(DIAGNOSTIC_CORE_H) $(CONFIG_H) $(SYSTEM_H) \ coretypes.h $(TREE_H) $(TM_H) langhooks.h $(GGC_H) $(EXPR_H) $(RTL_H) \ output.h $(DIAGNOSTIC_H) $(TM_P_H) $(INSN_ATTR_H) intl.h $(TARGET_H) \ $(FLAGS_H) $(PARAMS_H) $(TREE_PASS_H) $(DBGCNT_H) debug.h \ $(PLUGIN_H) $(EXCEPT_H) $(LTO_STREAMER_H) opts-diagnostic.h -opts-common.o : opts-common.c opts.h $(FLAGS_H) $(CONFIG_H) $(SYSTEM_H) \ +opts-common.o : opts-common.c $(OPTS_H) $(FLAGS_H) $(CONFIG_H) $(SYSTEM_H) \ coretypes.h intl.h $(DIAGNOSTIC_H) $(TM_H) targhooks.o : targhooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \ $(EXPR_H) $(TM_H) $(RTL_H) $(TM_P_H) $(FUNCTION_H) output.h $(TOPLEV_H) $(DIAGNOSTIC_CORE_H) \ @@ -2837,7 +2838,7 @@ toplev.o : toplev.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ value-prof.h $(PARAMS_H) $(TM_P_H) reload.h ira.h dwarf2asm.h $(TARGET_H) \ langhooks.h insn-flags.h $(CFGLAYOUT_H) $(CFGLOOP_H) hosthooks.h \ $(CGRAPH_H) $(COVERAGE_H) alloc-pool.h $(GGC_H) $(INTEGRATE_H) \ - opts.h params.def tree-mudflap.h $(TREE_PASS_H) $(GIMPLE_H) \ + $(OPTS_H) params.def tree-mudflap.h $(TREE_PASS_H) $(GIMPLE_H) \ tree-ssa-alias.h $(PLUGIN_H) realmpfr.h tree-diagnostic.h \ tree-pretty-print.h opts-diagnostic.h $(COMPILER) $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \ @@ -2852,7 +2853,7 @@ passes.o : passes.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ $(PARAMS_H) $(TM_P_H) reload.h dwarf2asm.h $(TARGET_H) \ langhooks.h insn-flags.h $(CFGLAYOUT_H) $(CFGLOOP_H) \ hosthooks.h $(CGRAPH_H) $(COVERAGE_H) $(TREE_PASS_H) $(TREE_DUMP_H) \ - $(GGC_H) $(INTEGRATE_H) $(CPPLIB_H) opts.h $(TREE_FLOW_H) $(TREE_INLINE_H) \ + $(GGC_H) $(INTEGRATE_H) $(CPPLIB_H) $(OPTS_H) $(TREE_FLOW_H) $(TREE_INLINE_H) \ gt-passes.h $(DF_H) $(PREDICT_H) $(LTO_HEADER_H) $(LTO_SECTION_OUT_H) \ $(PLUGIN_H) @@ -3032,7 +3033,7 @@ matrix-reorg.o : matrix-reorg.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ tree-flow-inline.h langhooks.h $(HASHTAB_H) $(TOPLEV_H) $(DIAGNOSTIC_CORE_H) $(FLAGS_H) $(GGC_H) \ debug.h $(TARGET_H) $(CGRAPH_H) $(DIAGNOSTIC_CORE_H) $(TIMEVAR_H) \ $(PARAMS_H) $(FIBHEAP_H) intl.h $(FUNCTION_H) $(BASIC_BLOCK_H) \ - $(CFGLOOP_H) tree-iterator.h $(TREE_PASS_H) opts.h $(TREE_DATA_REF_H) \ + $(CFGLOOP_H) tree-iterator.h $(TREE_PASS_H) $(OPTS_H) $(TREE_DATA_REF_H) \ tree-ssa-sccvn.h ipa-inline.o : ipa-inline.c gt-ipa-inline.h $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(TREE_H) langhooks.h $(TREE_INLINE_H) $(FLAGS_H) $(CGRAPH_H) intl.h \ @@ -3064,7 +3065,7 @@ ipa-struct-reorg.o: ipa-struct-reorg.c ipa-struct-reorg.h $(CONFIG_H) $(SYSTEM_H $(TREE_FLOW_H) langhooks.h pointer-set.h $(HASHTAB_H) $(TOPLEV_H) $(DIAGNOSTIC_CORE_H) \ $(FLAGS_H) debug.h $(TARGET_H) $(CGRAPH_H) $(DIAGNOSTIC_H) $(TIMEVAR_H) \ $(PARAMS_H) $(FIBHEAP_H) intl.h $(FUNCTION_H) $(BASIC_BLOCK_H) tree-iterator.h \ - $(TREE_PASS_H) opts.h $(IPA_TYPE_ESCAPE_H) $(TREE_DUMP_H) \ + $(TREE_PASS_H) $(OPTS_H) $(IPA_TYPE_ESCAPE_H) $(TREE_DUMP_H) \ $(GIMPLE_H) tree-pretty-print.h gimple-pretty-print.h coverage.o : coverage.c $(GCOV_IO_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h \ @@ -4498,7 +4499,7 @@ installdirs: PLUGIN_HEADERS = $(TREE_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(TOPLEV_H) $(DIAGNOSTIC_CORE_H) $(BASIC_BLOCK_H) $(GIMPLE_H) $(TREE_PASS_H) $(GCC_PLUGIN_H) \ - $(GGC_H) $(TREE_DUMP_H) $(PRETTY_PRINT_H) opts.h $(PARAMS_H) plugin.def \ + $(GGC_H) $(TREE_DUMP_H) $(PRETTY_PRINT_H) $(OPTS_H) $(PARAMS_H) plugin.def \ $(tm_file_list) $(tm_include_list) $(tm_p_file_list) $(tm_p_include_list) \ $(host_xm_file_list) $(host_xm_include_list) $(xm_include_list) \ intl.h $(PLUGIN_VERSION_H) $(DIAGNOSTIC_H) $(C_COMMON_H) $(C_PRETTY_PRINT_H) \ diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index ca0ffe9..d764fb6 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2010-11-12 Joseph Myers <joseph@codesourcery.com> + + * gcc-interface/Make-lang.in (ada/misc.o): Use $(OPTS_H). + * gcc-interface/misc.c (gnat_handle_option): Take location_t + parameter. + 2010-11-10 Eric Botcazou <ebotcazou@adacore.com> * gcc-interface/trans.c (gigi): Don't set 'pure' flag on SJLJ routines. diff --git a/gcc/ada/gcc-interface/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in index 6fdae61..b320e43 100644 --- a/gcc/ada/gcc-interface/Make-lang.in +++ b/gcc/ada/gcc-interface/Make-lang.in @@ -1231,7 +1231,7 @@ ada/decl.o : ada/gcc-interface/decl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ ada/misc.o : ada/gcc-interface/misc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(TM_H) $(TREE_H) $(DIAGNOSTIC_H) $(TARGET_H) $(FUNCTION_H) \ $(FLAGS_H) debug.h toplev.h langhooks.h \ - $(LANGHOOKS_DEF_H) opts.h $(OPTIONS_H) $(TREE_INLINE_H) $(PLUGIN_H) \ + $(LANGHOOKS_DEF_H) $(OPTS_H) $(OPTIONS_H) $(TREE_INLINE_H) $(PLUGIN_H) \ ada/gcc-interface/ada.h ada/adadecode.h ada/types.h ada/atree.h \ ada/elists.h ada/namet.h ada/nlists.h ada/stringt.h ada/uintp.h ada/fe.h \ ada/sinfo.h ada/einfo.h $(ADA_TREE_H) ada/gcc-interface/gigi.h \ diff --git a/gcc/ada/gcc-interface/misc.c b/gcc/ada/gcc-interface/misc.c index a1b2490..40f0db8 100644 --- a/gcc/ada/gcc-interface/misc.c +++ b/gcc/ada/gcc-interface/misc.c @@ -102,7 +102,7 @@ gnat_parse_file (int set_yydebug ATTRIBUTE_UNUSED) static bool gnat_handle_option (size_t scode, const char *arg ATTRIBUTE_UNUSED, int value, - int kind ATTRIBUTE_UNUSED, + int kind ATTRIBUTE_UNUSED, location_t loc ATTRIBUTE_UNUSED, const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED) { enum opt_code code = (enum opt_code) scode; diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index a9a55b3..1bbb957 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,11 @@ +2010-11-12 Joseph Myers <joseph@codesourcery.com> + + * c-common.c (parse_optimize_options): Update call to + decode_options. + * c-common.h (c_common_handle_option): Update prototype. + * c-opts.c (c_common_handle_option): Take location_t parameter and + pass it to other functions. + 2010-11-11 Joseph Myers <joseph@codesourcery.com> * c-opts.c (warning_as_error_callback): Remove. diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 154b6c9..7e71640 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -7804,7 +7804,8 @@ parse_optimize_options (tree args, bool attr_p) &decoded_options, &decoded_options_count); decode_options (&global_options, &global_options_set, - decoded_options, decoded_options_count, global_dc); + decoded_options, decoded_options_count, + input_location, global_dc); targetm.override_options_after_change(); diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h index 58d3a32..eb6cf26 100644 --- a/gcc/c-family/c-common.h +++ b/gcc/c-family/c-common.h @@ -696,7 +696,7 @@ extern void set_Wformat (int); extern tree handle_format_attribute (tree *, tree, tree, int, bool *); extern tree handle_format_arg_attribute (tree *, tree, tree, int, bool *); extern bool attribute_takes_identifier_p (const_tree); -extern bool c_common_handle_option (size_t, const char *, int, int, +extern bool c_common_handle_option (size_t, const char *, int, int, location_t, const struct cl_option_handlers *); extern tree c_common_type_for_mode (enum machine_mode, int); extern tree c_common_type_for_size (unsigned int, int); diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c index 1a281c8..7ddb754 100644 --- a/gcc/c-family/c-opts.c +++ b/gcc/c-family/c-opts.c @@ -241,7 +241,8 @@ c_common_init_options (unsigned int decoded_options_count, invalid, true if valid. Use HANDLERS in recursive handle_option calls. */ bool c_common_handle_option (size_t scode, const char *arg, int value, - int kind, const struct cl_option_handlers *handlers) + int kind, location_t loc, + const struct cl_option_handlers *handlers) { const struct cl_option *option = &cl_options[scode]; enum opt_code code = (enum opt_code) scode; @@ -357,7 +358,8 @@ c_common_handle_option (size_t scode, const char *arg, int value, set_Wformat (value); handle_generated_option (&global_options, &global_options_set, OPT_Wimplicit, NULL, value, - c_family_lang_mask, kind, handlers, global_dc); + c_family_lang_mask, kind, loc, + handlers, global_dc); warn_char_subscripts = value; warn_missing_braces = value; warn_parentheses = value; @@ -452,13 +454,13 @@ c_common_handle_option (size_t scode, const char *arg, int value, if (warn_implicit_int == -1) handle_generated_option (&global_options, &global_options_set, OPT_Wimplicit_int, NULL, value, - c_family_lang_mask, kind, handlers, + c_family_lang_mask, kind, loc, handlers, global_dc); if (warn_implicit_function_declaration == -1) handle_generated_option (&global_options, &global_options_set, OPT_Wimplicit_function_declaration, NULL, - value, c_family_lang_mask, kind, handlers, - global_dc); + value, c_family_lang_mask, kind, loc, + handlers, global_dc); break; case OPT_Winvalid_pch: diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index aace801..192f35a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2010-11-12 Joseph Myers <joseph@codesourcery.com> + + * Make-lang.in (g++spec.o): Use $(OPTS_H). + 2010-11-13 Ville Voutilainen <ville.voutilainen@gmail.com> <ville.voutilainen@symbio.com> Core 1135, 1136, 1145, 1149 diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in index fcf2119..69f9d64 100644 --- a/gcc/cp/Make-lang.in +++ b/gcc/cp/Make-lang.in @@ -54,7 +54,7 @@ c++: cc1plus$(exeext) .PHONY: c++ g++spec.o: $(srcdir)/cp/g++spec.c $(SYSTEM_H) coretypes.h $(TM_H) $(GCC_H) \ - $(CONFIG_H) opts.h + $(CONFIG_H) $(OPTS_H) (SHLIB_LINK='$(SHLIB_LINK)'; \ $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \ $(INCLUDES) $(srcdir)/cp/g++spec.c) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index b45d072..7d7a079 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2010-11-12 Joseph Myers <joseph@codesourcery.com> + + * Make-lang.in (gfortranspec.o): Use $(OPTS_H). + * gfortran.h (gfc_handle_option): Take location_t parameter. + * options.c (gfc_handle_option): Take location_t parameter. + 2010-11-12 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/45794 diff --git a/gcc/fortran/Make-lang.in b/gcc/fortran/Make-lang.in index c92c5da..318064a 100644 --- a/gcc/fortran/Make-lang.in +++ b/gcc/fortran/Make-lang.in @@ -78,7 +78,7 @@ fortran: f951$(exeext) .PHONY: fortran gfortranspec.o: $(srcdir)/fortran/gfortranspec.c $(SYSTEM_H) $(TM_H) $(GCC_H) \ - $(CONFIG_H) coretypes.h intl.h opts.h + $(CONFIG_H) coretypes.h intl.h $(OPTS_H) (SHLIB_LINK='$(SHLIB_LINK)'; \ $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \ $(INCLUDES) $(srcdir)/fortran/gfortranspec.c) diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index 13dbbc6..19e15ab 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -2395,7 +2395,7 @@ unsigned int gfc_option_lang_mask (void); void gfc_init_options_struct (struct gcc_options *); void gfc_init_options (unsigned int, struct cl_decoded_option *); -bool gfc_handle_option (size_t, const char *, int, int, +bool gfc_handle_option (size_t, const char *, int, int, location_t, const struct cl_option_handlers *); bool gfc_post_options (const char **); char *gfc_get_option_string (void); diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c index dd54a7d..5381fde 100644 --- a/gcc/fortran/options.c +++ b/gcc/fortran/options.c @@ -552,7 +552,7 @@ gfc_handle_runtime_check_option (const char *arg) bool gfc_handle_option (size_t scode, const char *arg, int value, - int kind ATTRIBUTE_UNUSED, + int kind ATTRIBUTE_UNUSED, location_t loc ATTRIBUTE_UNUSED, const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED) { bool result = true; @@ -3141,6 +3141,7 @@ driver_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, const struct cl_decoded_option *decoded, unsigned int lang_mask ATTRIBUTE_UNUSED, int kind, + location_t loc, const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED, diagnostic_context *dc) { @@ -3154,6 +3155,7 @@ driver_handle_option (struct gcc_options *opts, gcc_assert (opts == &global_options); gcc_assert (opts_set == &global_options_set); gcc_assert (kind == DK_UNSPECIFIED); + gcc_assert (loc == UNKNOWN_LOCATION); gcc_assert (dc == global_dc); switch (opt_index) @@ -3799,8 +3801,8 @@ process_command (unsigned int decoded_options_count, } read_cmdline_option (&global_options, &global_options_set, - decoded_options + j, CL_DRIVER, &handlers, - global_dc); + decoded_options + j, UNKNOWN_LOCATION, + CL_DRIVER, &handlers, global_dc); } /* If -save-temps=obj and -o name, create the prefix to use for %b. @@ -4300,8 +4302,8 @@ do_self_spec (const char *spec) default: read_cmdline_option (&global_options, &global_options_set, - decoded_options + j, CL_DRIVER, &handlers, - global_dc); + decoded_options + j, UNKNOWN_LOCATION, + CL_DRIVER, &handlers, global_dc); break; } } diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index a635c1e..8932913 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,8 @@ +2010-11-12 Joseph Myers <joseph@codesourcery.com> + + * Make-lang.in (jvspec.o, java/lang.o): Use $(OPTS_H). + * lang.c (java_handle_option): Take location_t parameter. + 2010-11-10 Joseph Myers <joseph@codesourcery.com> * expr.c (expand_java_field_op): Use %' in diagnostic. diff --git a/gcc/java/Make-lang.in b/gcc/java/Make-lang.in index 7b7ed93..beff30c 100644 --- a/gcc/java/Make-lang.in +++ b/gcc/java/Make-lang.in @@ -57,7 +57,7 @@ JAVA_TARGET_INDEPENDENT_BIN_TOOLS = jcf-dump .PHONY: java jvspec.o: $(srcdir)/java/jvspec.c $(SYSTEM_H) coretypes.h $(TM_H) \ - $(GCC_H) $(CONFIG_H) java/jcf.h java/javaop.h opts.h + $(GCC_H) $(CONFIG_H) java/jcf.h java/javaop.h $(OPTS_H) (SHLIB_LINK='$(SHLIB_LINK)'; \ $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \ $(INCLUDES) $(srcdir)/java/jvspec.c $(OUTPUT_OPTION)) @@ -302,7 +302,7 @@ java/jvgenmain.o: java/jvgenmain.c $(CONFIG_H) $(JAVA_TREE_H) $(SYSTEM_H) \ coretypes.h $(TM_H) intl.h java/lang.o: java/lang.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h input.h \ toplev.h $(SYSTEM_H) coretypes.h $(TM_H) $(DIAGNOSTIC_H) \ - langhooks.h $(LANGHOOKS_DEF_H) gt-java-lang.h opts.h $(OPTIONS_H) \ + langhooks.h $(LANGHOOKS_DEF_H) gt-java-lang.h $(OPTS_H) $(OPTIONS_H) \ $(TARGET_H) java/mangle.o: java/mangle.c $(CONFIG_H) java/jcf.h $(JAVA_TREE_H) $(SYSTEM_H) \ coretypes.h $(TM_H) toplev.h $(GGC_H) gt-java-mangle.h $(LANGHOOKS_DEF_H) diff --git a/gcc/java/lang.c b/gcc/java/lang.c index 8065efa..7a17978 100644 --- a/gcc/java/lang.c +++ b/gcc/java/lang.c @@ -52,7 +52,7 @@ static void java_init_options_struct (struct gcc_options *); static void java_init_options (unsigned int, struct cl_decoded_option *); static bool java_post_options (const char **); -static bool java_handle_option (size_t, const char *, int, int, +static bool java_handle_option (size_t, const char *, int, int, location_t, const struct cl_option_handlers *); static void put_decl_string (const char *, int); static void put_decl_node (tree, int); @@ -183,7 +183,7 @@ struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; */ static bool java_handle_option (size_t scode, const char *arg, int value, - int kind ATTRIBUTE_UNUSED, + int kind ATTRIBUTE_UNUSED, location_t loc ATTRIBUTE_UNUSED, const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED) { enum opt_code code = (enum opt_code) scode; diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h index ceff0b9..822925f 100644 --- a/gcc/langhooks-def.h +++ b/gcc/langhooks-def.h @@ -68,7 +68,7 @@ extern void lhd_initialize_diagnostics (diagnostic_context *); extern void lhd_init_options (unsigned int, struct cl_decoded_option *); extern bool lhd_complain_wrong_lang_p (const struct cl_option *); -extern bool lhd_handle_option (size_t, const char *, int, int, +extern bool lhd_handle_option (size_t, const char *, int, int, location_t, const struct cl_option_handlers *); extern tree lhd_callgraph_analyze_expr (tree *, int *); diff --git a/gcc/langhooks.c b/gcc/langhooks.c index 76c066b..1f656fe 100644 --- a/gcc/langhooks.c +++ b/gcc/langhooks.c @@ -356,6 +356,7 @@ bool lhd_handle_option (size_t code ATTRIBUTE_UNUSED, const char *arg ATTRIBUTE_UNUSED, int value ATTRIBUTE_UNUSED, int kind ATTRIBUTE_UNUSED, + location_t loc ATTRIBUTE_UNUSED, const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED) { return false; diff --git a/gcc/langhooks.h b/gcc/langhooks.h index 1af12be..87a8b2c 100644 --- a/gcc/langhooks.h +++ b/gcc/langhooks.h @@ -291,10 +291,12 @@ struct lang_hooks checking whether ARG is NULL, which indicates that no argument was in fact supplied. For -f and -W switches, VALUE is 1 or 0 for the positive and negative forms respectively. HANDLERS should - be passed to any recursive handle_option calls. + be passed to any recursive handle_option calls. LOC is the + location of the option. Return true if the switch is valid, false if invalid. */ bool (*handle_option) (size_t code, const char *arg, int value, int kind, + location_t loc, const struct cl_option_handlers *handlers); /* Called when all command line options have been parsed to allow diff --git a/gcc/lto-opts.c b/gcc/lto-opts.c index 66010c6..eeb41e9 100644 --- a/gcc/lto-opts.c +++ b/gcc/lto-opts.c @@ -404,7 +404,7 @@ lto_reissue_options (void) if (flag_var) set_option (&global_options, &global_options_set, o->code, o->value, o->arg, - DK_UNSPECIFIED, global_dc); + DK_UNSPECIFIED, UNKNOWN_LOCATION, global_dc); if (o->type == CL_TARGET) targetm.handle_option (o->code, o->arg, o->value); diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index 0de4a97..21bbeff 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,8 @@ +2010-11-12 Joseph Myers <joseph@codesourcery.com> + + * Make-lang.in (lto/lto.o): Use $(OPTS_H). + * lto-lang.c (lto_handle_option): Take location_t parameter. + 2010-11-10 Joseph Myers <joseph@codesourcery.com> * lto.c (lto_resolution_read): Start diagnostics with lowercase diff --git a/gcc/lto/Make-lang.in b/gcc/lto/Make-lang.in index 0c63865..e988cc9 100644 --- a/gcc/lto/Make-lang.in +++ b/gcc/lto/Make-lang.in @@ -80,7 +80,7 @@ lto/lto-lang.o: lto/lto-lang.c $(CONFIG_H) coretypes.h debug.h \ flags.h $(GGC_H) langhooks.h $(LANGHOOKS_DEF_H) $(SYSTEM_H) \ $(TARGET_H) $(LTO_H) $(GIMPLE_H) gtype-lto.h gt-lto-lto-lang.h \ $(EXPR_H) -lto/lto.o: lto/lto.c $(CONFIG_H) $(SYSTEM_H) coretypes.h opts.h \ +lto/lto.o: lto/lto.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(OPTS_H) \ toplev.h $(TREE_H) $(DIAGNOSTIC_CORE_H) $(TM_H) \ $(CGRAPH_H) $(GGC_H) tree-ssa-operands.h $(TREE_PASS_H) \ langhooks.h $(VEC_H) $(BITMAP_H) pointer-set.h $(IPA_PROP_H) \ diff --git a/gcc/lto/lto-lang.c b/gcc/lto/lto-lang.c index eeebe05..c7ca949 100644 --- a/gcc/lto/lto-lang.c +++ b/gcc/lto/lto-lang.c @@ -657,6 +657,7 @@ const char *resolution_file_name; static bool lto_handle_option (size_t scode, const char *arg, int value ATTRIBUTE_UNUSED, int kind ATTRIBUTE_UNUSED, + location_t loc ATTRIBUTE_UNUSED, const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED) { enum opt_code code = (enum opt_code) scode; diff --git a/gcc/opts-common.c b/gcc/opts-common.c index af5d1b4..c114d4e 100644 --- a/gcc/opts-common.c +++ b/gcc/opts-common.c @@ -722,17 +722,19 @@ keep: /* Handle option DECODED for the language indicated by LANG_MASK, using the handlers in HANDLERS and setting fields in OPTS and OPTS_SET. KIND is the diagnostic_t if this is a diagnostics - option, DK_UNSPECIFIED otherwise. GENERATED_P is true for an - option generated as part of processing another option or otherwise - generated internally, false for one explicitly passed by the user. - Returns false if the switch was invalid. DC is the diagnostic - context for options affecting diagnostics state, or NULL. */ + option, DK_UNSPECIFIED otherwise, and LOC is the location of the + option for options from the source file, UNKNOWN_LOCATION + otherwise. GENERATED_P is true for an option generated as part of + processing another option or otherwise generated internally, false + for one explicitly passed by the user. Returns false if the switch + was invalid. DC is the diagnostic context for options affecting + diagnostics state, or NULL. */ -bool +static bool handle_option (struct gcc_options *opts, struct gcc_options *opts_set, const struct cl_decoded_option *decoded, - unsigned int lang_mask, int kind, + unsigned int lang_mask, int kind, location_t loc, const struct cl_option_handlers *handlers, bool generated_p, diagnostic_context *dc) { @@ -745,13 +747,14 @@ handle_option (struct gcc_options *opts, if (flag_var) set_option (opts, (generated_p ? NULL : opts_set), - opt_index, value, arg, kind, dc); + opt_index, value, arg, kind, loc, dc); for (i = 0; i < handlers->num_handlers; i++) if (option->flags & handlers->handlers[i].mask) { if (!handlers->handlers[i].handler (opts, opts_set, decoded, - lang_mask, kind, handlers, dc)) + lang_mask, kind, loc, + handlers, dc)) return false; else handlers->post_handling_callback (decoded, @@ -770,15 +773,15 @@ bool handle_generated_option (struct gcc_options *opts, struct gcc_options *opts_set, size_t opt_index, const char *arg, int value, - unsigned int lang_mask, int kind, + unsigned int lang_mask, int kind, location_t loc, const struct cl_option_handlers *handlers, diagnostic_context *dc) { struct cl_decoded_option decoded; generate_option (opt_index, arg, value, lang_mask, &decoded); - return handle_option (opts, opts_set, &decoded, lang_mask, kind, handlers, - true, dc); + return handle_option (opts, opts_set, &decoded, lang_mask, kind, loc, + handlers, true, dc); } /* Fill in *DECODED with an option described by OPT_INDEX, ARG and @@ -836,15 +839,16 @@ generate_option_input_file (const char *file, decoded->errors = 0; } -/* Handle the switch DECODED for the language indicated by LANG_MASK, - using the handlers in *HANDLERS and setting fields in OPTS and - OPTS_SET and using diagnostic context DC (if not NULL) for +/* Handle the switch DECODED (location LOC) for the language indicated + by LANG_MASK, using the handlers in *HANDLERS and setting fields in + OPTS and OPTS_SET and using diagnostic context DC (if not NULL) for diagnostic options. */ void read_cmdline_option (struct gcc_options *opts, struct gcc_options *opts_set, struct cl_decoded_option *decoded, + location_t loc, unsigned int lang_mask, const struct cl_option_handlers *handlers, diagnostic_context *dc) @@ -853,12 +857,12 @@ read_cmdline_option (struct gcc_options *opts, const char *opt = decoded->orig_option_with_args_text; if (decoded->warn_message) - warning (0, decoded->warn_message, opt); + warning_at (loc, 0, decoded->warn_message, opt); if (decoded->opt_index == OPT_SPECIAL_unknown) { if (handlers->unknown_option_callback (decoded)) - error ("unrecognized command line option %qs", decoded->arg); + error_at (loc, "unrecognized command line option %qs", decoded->arg); return; } @@ -869,8 +873,8 @@ read_cmdline_option (struct gcc_options *opts, if (decoded->errors & CL_ERR_DISABLED) { - error ("command line option %qs" - " is not supported by this configuration", opt); + error_at (loc, "command line option %qs" + " is not supported by this configuration", opt); return; } @@ -883,35 +887,35 @@ read_cmdline_option (struct gcc_options *opts, if (decoded->errors & CL_ERR_MISSING_ARG) { if (option->missing_argument_error) - error (option->missing_argument_error, opt); + error_at (loc, option->missing_argument_error, opt); else - error ("missing argument to %qs", opt); + error_at (loc, "missing argument to %qs", opt); return; } if (decoded->errors & CL_ERR_UINT_ARG) { - error ("argument to %qs should be a non-negative integer", - option->opt_text); + error_at (loc, "argument to %qs should be a non-negative integer", + option->opt_text); return; } gcc_assert (!decoded->errors); if (!handle_option (opts, opts_set, decoded, lang_mask, DK_UNSPECIFIED, - handlers, false, dc)) - error ("unrecognized command line option %qs", opt); + loc, handlers, false, dc)) + error_at (loc, "unrecognized command line option %qs", opt); } /* Set any field in OPTS, and OPTS_SET if not NULL, for option - OPT_INDEX according to VALUE and ARG, diagnostic kind KIND, using - diagnostic context DC if not NULL for diagnostic - classification. */ + OPT_INDEX according to VALUE and ARG, diagnostic kind KIND, + location LOC, using diagnostic context DC if not NULL for + diagnostic classification. */ void set_option (struct gcc_options *opts, struct gcc_options *opts_set, int opt_index, int value, const char *arg, int kind, - diagnostic_context *dc) + location_t loc, diagnostic_context *dc) { const struct cl_option *option = &cl_options[opt_index]; void *flag_var = option_flag_var (opt_index, opts); @@ -958,8 +962,7 @@ set_option (struct gcc_options *opts, struct gcc_options *opts_set, if ((diagnostic_t) kind != DK_UNSPECIFIED && dc != NULL) - diagnostic_classify_diagnostic (dc, opt_index, (diagnostic_t) kind, - UNKNOWN_LOCATION); + diagnostic_classify_diagnostic (dc, opt_index, (diagnostic_t) kind, loc); } /* Return the address of the flag variable for option OPT_INDEX in @@ -347,6 +347,7 @@ static bool common_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, const struct cl_decoded_option *decoded, unsigned int lang_mask, int kind, + location_t loc, const struct cl_option_handlers *handlers, diagnostic_context *dc); static void handle_param (struct gcc_options *opts, @@ -359,6 +360,11 @@ static void set_debug_level (enum debug_info_type type, int extended, static void set_fast_math_flags (struct gcc_options *opts, int set); static void set_unsafe_math_optimizations_flags (struct gcc_options *opts, int set); +static void enable_warning_as_error (const char *arg, int value, + unsigned int lang_mask, + const struct cl_option_handlers *handlers, + location_t loc, + diagnostic_context *dc); /* Return a malloced slash-separated list of languages in MASK. */ static char * @@ -493,6 +499,7 @@ lang_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, const struct cl_decoded_option *decoded, unsigned int lang_mask ATTRIBUTE_UNUSED, int kind, + location_t loc, const struct cl_option_handlers *handlers, diagnostic_context *dc) { @@ -501,7 +508,7 @@ lang_handle_option (struct gcc_options *opts, gcc_assert (dc == global_dc); gcc_assert (decoded->canonical_option_num_elements <= 2); return lang_hooks.handle_option (decoded->opt_index, decoded->arg, - decoded->value, kind, handlers); + decoded->value, kind, loc, handlers); } /* Handle a back-end option; arguments and return value as for @@ -512,6 +519,7 @@ target_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, const struct cl_decoded_option *decoded, unsigned int lang_mask ATTRIBUTE_UNUSED, int kind, + location_t loc, const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED, diagnostic_context *dc) { @@ -520,6 +528,7 @@ target_handle_option (struct gcc_options *opts, gcc_assert (dc == global_dc); gcc_assert (decoded->canonical_option_num_elements <= 2); gcc_assert (kind == DK_UNSPECIFIED); + gcc_assert (loc == UNKNOWN_LOCATION); return targetm.handle_option (decoded->opt_index, decoded->arg, decoded->value); } @@ -605,15 +614,16 @@ flag_instrument_functions_exclude_p (tree fndecl) } -/* Handle the vector of command line options, storing the results of - processing DECODED_OPTIONS and DECODED_OPTIONS_COUNT in OPTS and - OPTS_SET and using DC for diagnostic state. LANG_MASK contains has - a single bit set representing the current language. HANDLERS - describes what functions to call for the options. */ +/* Handle the vector of command line options (located at LOC), storing + the results of processing DECODED_OPTIONS and DECODED_OPTIONS_COUNT + in OPTS and OPTS_SET and using DC for diagnostic state. LANG_MASK + contains has a single bit set representing the current language. + HANDLERS describes what functions to call for the options. */ static void read_cmdline_options (struct gcc_options *opts, struct gcc_options *opts_set, struct cl_decoded_option *decoded_options, unsigned int decoded_options_count, + location_t loc, unsigned int lang_mask, const struct cl_option_handlers *handlers, diagnostic_context *dc) @@ -640,7 +650,7 @@ read_cmdline_options (struct gcc_options *opts, struct gcc_options *opts_set, } read_cmdline_option (opts, opts_set, - decoded_options + i, lang_mask, handlers, + decoded_options + i, loc, lang_mask, handlers, dc); } } @@ -712,8 +722,8 @@ decode_cmdline_options_to_array_default_mask (unsigned int argc, /* If indicated by the optimization level LEVEL (-Os if SIZE is set, -Ofast if FAST is set), apply the option DEFAULT_OPT to OPTS and - OPTS_SET, diagnostic context DC, with language mask LANG_MASK and - option handlers HANDLERS. */ + OPTS_SET, diagnostic context DC, location LOC, with language mask + LANG_MASK and option handlers HANDLERS. */ static void maybe_default_option (struct gcc_options *opts, @@ -722,6 +732,7 @@ maybe_default_option (struct gcc_options *opts, int level, bool size, bool fast, unsigned int lang_mask, const struct cl_option_handlers *handlers, + location_t loc, diagnostic_context *dc) { const struct cl_option *option = &cl_options[default_opt->opt_index]; @@ -782,18 +793,20 @@ maybe_default_option (struct gcc_options *opts, if (enabled) handle_generated_option (opts, opts_set, default_opt->opt_index, default_opt->arg, default_opt->value, - lang_mask, DK_UNSPECIFIED, handlers, dc); + lang_mask, DK_UNSPECIFIED, loc, + handlers, dc); else if (default_opt->arg == NULL && !(option->flags & CL_REJECT_NEGATIVE)) handle_generated_option (opts, opts_set, default_opt->opt_index, default_opt->arg, !default_opt->value, - lang_mask, DK_UNSPECIFIED, handlers, dc); + lang_mask, DK_UNSPECIFIED, loc, + handlers, dc); } /* As indicated by the optimization level LEVEL (-Os if SIZE is set, -Ofast if FAST is set), apply the options in array DEFAULT_OPTS to - OPTS and OPTS_SET, diagnostic context DC, with language mask - LANG_MASK and option handlers HANDLERS. */ + OPTS and OPTS_SET, diagnostic context DC, location LOC, with + language mask LANG_MASK and option handlers HANDLERS. */ static void maybe_default_options (struct gcc_options *opts, @@ -802,13 +815,14 @@ maybe_default_options (struct gcc_options *opts, int level, bool size, bool fast, unsigned int lang_mask, const struct cl_option_handlers *handlers, + location_t loc, diagnostic_context *dc) { size_t i; for (i = 0; default_opts[i].levels != OPT_LEVELS_NONE; i++) maybe_default_option (opts, opts_set, &default_opts[i], - level, size, fast, lang_mask, handlers, dc); + level, size, fast, lang_mask, handlers, loc, dc); } /* Table of options enabled by default at different levels. */ @@ -902,6 +916,7 @@ default_options_optimization (struct gcc_options *opts, struct gcc_options *opts_set, struct cl_decoded_option *decoded_options, unsigned int decoded_options_count, + location_t loc, unsigned int lang_mask, const struct cl_option_handlers *handlers, diagnostic_context *dc) @@ -964,7 +979,7 @@ default_options_optimization (struct gcc_options *opts, maybe_default_options (opts, opts_set, default_options_table, opts->x_optimize, opts->x_optimize_size, - ofast, lang_mask, handlers, dc); + ofast, lang_mask, handlers, loc, dc); /* -O2 param settings. */ opt2 = (opts->x_optimize >= 2); @@ -994,19 +1009,20 @@ default_options_optimization (struct gcc_options *opts, maybe_default_options (opts, opts_set, targetm.target_option.optimization_table, opts->x_optimize, opts->x_optimize_size, - ofast, lang_mask, handlers, dc); + ofast, lang_mask, handlers, loc, dc); } static void finish_options (struct gcc_options *, struct gcc_options *); /* Parse command line options and set default flag values. Do minimal options processing. The decoded options are in *DECODED_OPTIONS - and *DECODED_OPTIONS_COUNT; settings go in OPTS, OPTS_SET and DC. */ + and *DECODED_OPTIONS_COUNT; settings go in OPTS, OPTS_SET and DC; + the options are located at LOC. */ void decode_options (struct gcc_options *opts, struct gcc_options *opts_set, struct cl_decoded_option *decoded_options, unsigned int decoded_options_count, - diagnostic_context *dc) + location_t loc, diagnostic_context *dc) { struct cl_option_handlers handlers; @@ -1027,11 +1043,11 @@ decode_options (struct gcc_options *opts, struct gcc_options *opts_set, /* Enable -Werror=coverage-mismatch by default */ enable_warning_as_error ("coverage-mismatch", 1, lang_mask, &handlers, - dc); + loc, dc); default_options_optimization (opts, opts_set, decoded_options, decoded_options_count, - lang_mask, &handlers, dc); + loc, lang_mask, &handlers, dc); #ifdef ENABLE_LTO /* Clear any options currently held for LTO. */ @@ -1039,7 +1055,8 @@ decode_options (struct gcc_options *opts, struct gcc_options *opts_set, #endif read_cmdline_options (opts, opts_set, - decoded_options, decoded_options_count, lang_mask, + decoded_options, decoded_options_count, + loc, lang_mask, &handlers, dc); finish_options (opts, opts_set); @@ -1580,6 +1597,7 @@ common_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, const struct cl_decoded_option *decoded, unsigned int lang_mask, int kind ATTRIBUTE_UNUSED, + location_t loc, const struct cl_option_handlers *handlers, diagnostic_context *dc) { @@ -1760,7 +1778,7 @@ common_handle_option (struct gcc_options *opts, break; case OPT_Werror_: - enable_warning_as_error (arg, value, lang_mask, handlers, dc); + enable_warning_as_error (arg, value, lang_mask, handlers, loc, dc); break; case OPT_Wlarger_than_: @@ -2394,13 +2412,13 @@ get_option_state (struct gcc_options *opts, int option, /* Enable (or disable if VALUE is 0) a warning option ARG (language mask LANG_MASK, option handlers HANDLERS) as an error for - diagnostic context DC (possibly NULL). This is used by - -Werror=. */ + diagnostic context DC (possibly NULL), location LOC. This is used + by -Werror=. */ -void +static void enable_warning_as_error (const char *arg, int value, unsigned int lang_mask, const struct cl_option_handlers *handlers, - diagnostic_context *dc) + location_t loc, diagnostic_context *dc) { char *new_option; int option_index; @@ -2423,8 +2441,7 @@ enable_warning_as_error (const char *arg, int value, unsigned int lang_mask, if (option_index == OPT_SPECIAL_ignore) return; if (dc) - diagnostic_classify_diagnostic (dc, option_index, kind, - UNKNOWN_LOCATION); + diagnostic_classify_diagnostic (dc, option_index, kind, loc); if (kind == DK_ERROR) { const struct cl_option * const option = cl_options + option_index; @@ -2433,8 +2450,7 @@ enable_warning_as_error (const char *arg, int value, unsigned int lang_mask, if (option->var_type == CLVC_BOOLEAN) handle_generated_option (&global_options, &global_options_set, option_index, NULL, value, lang_mask, - (int)kind, handlers, - dc); + (int)kind, loc, handlers, dc); } } free (new_option); @@ -21,6 +21,8 @@ along with GCC; see the file COPYING3. If not see #ifndef GCC_OPTS_H #define GCC_OPTS_H +#include "input.h" + /* Specifies how a switch's VAR_VALUE relates to its FLAG_VAR. */ enum cl_var_type { /* The switch is enabled when FLAG_VAR is nonzero. */ @@ -164,7 +166,7 @@ struct cl_option_handler_func bool (*handler) (struct gcc_options *opts, struct gcc_options *opts_set, const struct cl_decoded_option *decoded, - unsigned int lang_mask, int kind, + unsigned int lang_mask, int kind, location_t loc, const struct cl_option_handlers *handlers, diagnostic_context *dc); @@ -225,6 +227,7 @@ extern void decode_options (struct gcc_options *opts, struct gcc_options *opts_set, struct cl_decoded_option *decoded_options, unsigned int decoded_options_count, + location_t loc, diagnostic_context *dc); extern int option_enabled (int opt_idx, void *opts); extern bool get_option_state (struct gcc_options *, int, @@ -232,18 +235,12 @@ extern bool get_option_state (struct gcc_options *, int, extern void set_option (struct gcc_options *opts, struct gcc_options *opts_set, int opt_index, int value, const char *arg, int kind, - diagnostic_context *dc); + location_t loc, diagnostic_context *dc); extern void *option_flag_var (int opt_index, struct gcc_options *opts); -bool handle_option (struct gcc_options *opts, - struct gcc_options *opts_set, - const struct cl_decoded_option *decoded, - unsigned int lang_mask, int kind, - const struct cl_option_handlers *handlers, - bool generated_p, diagnostic_context *dc); bool handle_generated_option (struct gcc_options *opts, struct gcc_options *opts_set, size_t opt_index, const char *arg, int value, - unsigned int lang_mask, int kind, + unsigned int lang_mask, int kind, location_t loc, const struct cl_option_handlers *handlers, diagnostic_context *dc); void generate_option (size_t opt_index, const char *arg, int value, @@ -254,12 +251,9 @@ void generate_option_input_file (const char *file, extern void read_cmdline_option (struct gcc_options *opts, struct gcc_options *opts_set, struct cl_decoded_option *decoded, + location_t loc, unsigned int lang_mask, const struct cl_option_handlers *handlers, diagnostic_context *dc); -extern void enable_warning_as_error (const char *arg, int value, - unsigned int lang_mask, - const struct cl_option_handlers *handlers, - diagnostic_context *dc); extern void print_ignored_options (void); #endif diff --git a/gcc/toplev.c b/gcc/toplev.c index b125c43..1b25485 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -2357,7 +2357,7 @@ toplev_main (int argc, char **argv) enough to default flags appropriately. */ decode_options (&global_options, &global_options_set, save_decoded_options, save_decoded_options_count, - global_dc); + UNKNOWN_LOCATION, global_dc); init_local_tick (); |