common.opt (flag_excess_precision_cmdline, [...]): New Variable declarations.
authorJoseph Myers <joseph@codesourcery.com>
Wed, 10 Nov 2010 22:35:13 +0000 (22:35 +0000)
committerJoseph Myers <jsm28@gcc.gnu.org>
Wed, 10 Nov 2010 22:35:13 +0000 (22:35 +0000)
* common.opt (flag_excess_precision_cmdline, flag_generate_lto,
warn_larger_than, larger_than_size, warn_frame_larger_than,
frame_larger_than_size, flag_gen_aux_info, flag_shlib,
default_visibility, flag_tls_default): New Variable declarations.
(aux-info, auxbase, dumpbase, dumpdir, falign-functions=,
falign-jumps=, falign-labels=, falign-loops=, o, v): Use Var.
(v): Declare as Common and document here.
* flags.h (default_visibility, flag_generate_lto,
warn_larger_than, larger_than_size, warn_frame_larger_than,
frame_larger_than_size, flag_gen_aux_info, flag_pedantic_errors,
flag_shlib, flag_excess_precision_cmdline): Remove.
(set_Wstrict_aliasing): Update prototype.
* gcc.c (verbose_flag): Remove.
(driver_handle_option): Add diagnostic_context parameter.  Don't
handle OPT_v explicitly here.  Set verbose_flag to 1 rather than
incrementing it.
* opts-common.c (handle_option): Pass dc to handler.
* opts.c (warn_larger_than, larger_than_size,
warn_frame_larger_than, frame_larger_than_size,
default_visibility): Remove.
(common_handle_option): Add diagnostic_context parameter.
(set_fast_math_flags, set_unsafe_math_optimizations_flags): Add
gcc_options parameters.
(lang_handle_option, target_handle_option, read_cmdline_options,
decode_options): Add diagnostic_context parameters.
(finish_options): Access option state through opts pointer where
possible.
(common_handle_option): Access option state through opts pointer
where possible.  Do not set local static variable verbose.  Do not
explicitly handle OPT_v, OPT_Wstrict_aliasing_,
OPT_Wstrict_overflow_, OPT_Wunused, OPT_auxbase, OPT_dumpbase,
OPT_dumpdir, OPT_falign_functions_, OPT_falign_jumps_,
OPT_falign_labels_, OPT_falign_loops_, OPT_fira_verbose_, OPT_o or
OPT_fwhopr_.  Do not explicitly set .opt file variables for
OPT_aux_info or OPT_pedantic_errors.  Use dc for diagnostic
context.
(set_Wstrict_aliasing): Add gcc_options parameter.
* opts.h (struct cl_option_handler_func): Add diagnostic_context
parameter to handler.
(decode_options): Add diagnostic_context parameter.
* toplev.c (dump_base_name, dump_dir_name, aux_base_name,
asm_file_name, flag_generate_lto, flag_gen_aux_info,
aux_info_file_name, flag_shlib, flag_tls_default,
flag_excess_precision_cmdline, flag_pedantic_errors): Remove.
(toplev_main): Pass global_dc to decode_options.
* toplev.h (dump_base_name, dump_dir_name, aux_base_name,
aux_info_file_name, asm_file_name): Remove.
* tree.h (flag_tls_default): Remove.

c-family:
* c-common.c (parse_optimize_options): Pass global_dc to
decode_options.
* c-opts.c (c_common_handle_option): Pass &global_options to
set_Wstrict_aliasing.
* c.opt (v): Don't mark Common or document here.

fortran:
* cpp.c (asm_file_name): Don't declare here.

objc:
* objc-act.c (dump_base_name): Don't declare here.

From-SVN: r166565

18 files changed:
gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c-common.c
gcc/c-family/c-opts.c
gcc/c-family/c.opt
gcc/common.opt
gcc/flags.h
gcc/fortran/ChangeLog
gcc/fortran/cpp.c
gcc/gcc.c
gcc/objc/ChangeLog
gcc/objc/objc-act.c
gcc/opts-common.c
gcc/opts.c
gcc/opts.h
gcc/toplev.c
gcc/toplev.h
gcc/tree.h

index 037598e03e9e96e7296fb26bba763c9285a13e2f..bd6c0d776d02b51a1b6f6c706a7721a82f9d7a12 100644 (file)
@@ -1,3 +1,54 @@
+2010-11-10  Joseph Myers  <joseph@codesourcery.com>
+
+       * common.opt (flag_excess_precision_cmdline, flag_generate_lto,
+       warn_larger_than, larger_than_size, warn_frame_larger_than,
+       frame_larger_than_size, flag_gen_aux_info, flag_shlib,
+       default_visibility, flag_tls_default): New Variable declarations.
+       (aux-info, auxbase, dumpbase, dumpdir, falign-functions=,
+       falign-jumps=, falign-labels=, falign-loops=, o, v): Use Var.
+       (v): Declare as Common and document here.
+       * flags.h (default_visibility, flag_generate_lto,
+       warn_larger_than, larger_than_size, warn_frame_larger_than,
+       frame_larger_than_size, flag_gen_aux_info, flag_pedantic_errors,
+       flag_shlib, flag_excess_precision_cmdline): Remove.
+       (set_Wstrict_aliasing): Update prototype.
+       * gcc.c (verbose_flag): Remove.
+       (driver_handle_option): Add diagnostic_context parameter.  Don't
+       handle OPT_v explicitly here.  Set verbose_flag to 1 rather than
+       incrementing it.
+       * opts-common.c (handle_option): Pass dc to handler.
+       * opts.c (warn_larger_than, larger_than_size,
+       warn_frame_larger_than, frame_larger_than_size,
+       default_visibility): Remove.
+       (common_handle_option): Add diagnostic_context parameter.
+       (set_fast_math_flags, set_unsafe_math_optimizations_flags): Add
+       gcc_options parameters.
+       (lang_handle_option, target_handle_option, read_cmdline_options,
+       decode_options): Add diagnostic_context parameters.
+       (finish_options): Access option state through opts pointer where
+       possible.
+       (common_handle_option): Access option state through opts pointer
+       where possible.  Do not set local static variable verbose.  Do not
+       explicitly handle OPT_v, OPT_Wstrict_aliasing_,
+       OPT_Wstrict_overflow_, OPT_Wunused, OPT_auxbase, OPT_dumpbase,
+       OPT_dumpdir, OPT_falign_functions_, OPT_falign_jumps_,
+       OPT_falign_labels_, OPT_falign_loops_, OPT_fira_verbose_, OPT_o or
+       OPT_fwhopr_.  Do not explicitly set .opt file variables for
+       OPT_aux_info or OPT_pedantic_errors.  Use dc for diagnostic
+       context.
+       (set_Wstrict_aliasing): Add gcc_options parameter.
+       * opts.h (struct cl_option_handler_func): Add diagnostic_context
+       parameter to handler.
+       (decode_options): Add diagnostic_context parameter.
+       * toplev.c (dump_base_name, dump_dir_name, aux_base_name,
+       asm_file_name, flag_generate_lto, flag_gen_aux_info,
+       aux_info_file_name, flag_shlib, flag_tls_default,
+       flag_excess_precision_cmdline, flag_pedantic_errors): Remove.
+       (toplev_main): Pass global_dc to decode_options.
+       * toplev.h (dump_base_name, dump_dir_name, aux_base_name,
+       aux_info_file_name, asm_file_name): Remove.
+       * tree.h (flag_tls_default): Remove.
+
 2010-11-10  Eric Botcazou  <ebotcazou@adacore.com>
 
        * config/sparc/sparc.c (sparc_delegitimize_address): New function.
index 1164d919d0eb249c2e79f4ba1073db6035a689da..aa5539f952648e40501d2366f7aff6a8c416d82f 100644 (file)
@@ -1,3 +1,11 @@
+2010-11-10  Joseph Myers  <joseph@codesourcery.com>
+
+       * c-common.c (parse_optimize_options): Pass global_dc to
+       decode_options.
+       * c-opts.c (c_common_handle_option): Pass &global_options to
+       set_Wstrict_aliasing.
+       * c.opt (v): Don't mark Common or document here.
+
 2010-11-06  Iain Sandoe  <iains@gcc.gnu.org>
 
        PR target/44981
index ab050ab2e68ef0070de830fbfe33f9e876d3cfdc..d4b5da1128a01a26e68638a7779235462bd1ae4a 100644 (file)
@@ -7804,7 +7804,7 @@ 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);
+                 decoded_options, decoded_options_count, global_dc);
 
   targetm.override_options_after_change();
 
index 8f60834aa48411dc2fde228c1a74c488745bc91c..dc5c777d3e972ca853beef9861014b4740d15c04 100644 (file)
@@ -451,7 +451,7 @@ c_common_handle_option (size_t scode, const char *arg, int value,
       warn_sequence_point = value;     /* Was C only.  */
       warn_switch = value;
       if (warn_strict_aliasing == -1)
-       set_Wstrict_aliasing (value);
+       set_Wstrict_aliasing (&global_options, value);
       warn_address = value;
       if (warn_strict_overflow == -1)
        warn_strict_overflow = value;
index 01ce661aa72fe1692e991ea94d88360175537f33..b25ecd6789a58f43e3f260c2ce78e2bba7f1a191 100644 (file)
@@ -1213,8 +1213,8 @@ C ObjC C++ ObjC++ Var(flag_undef)
 Do not predefine system-specific and GCC-specific macros
 
 v
-Common C ObjC C++ ObjC++
-Enable verbose output
+C ObjC C++ ObjC++
+; Documented in common.opt
 
 w
 C ObjC C++ ObjC++
index 551c3358f75e008663435e6d0383c6d78534830c..71f45783b80a3bdaa6a6494f77e6c5b757772e5b 100644 (file)
@@ -62,6 +62,49 @@ int *param_values
 Variable
 enum fp_contract_mode flag_fp_contract_mode = FP_CONTRACT_FAST
 
+; The excess precision specified on the command line, or defaulted by
+; the front end.
+Variable
+enum excess_precision flag_excess_precision_cmdline = EXCESS_PRECISION_DEFAULT
+
+; Nonzero if we should write GIMPLE bytecode for link-time optimization.
+Variable
+int flag_generate_lto
+
+; True to warn about any objects definitions whose size is larger
+; than N bytes.  Also want about function definitions whose returned
+; values are larger than N bytes, where N is 'larger_than_size'.
+Variable
+bool warn_larger_than
+
+Variable
+HOST_WIDE_INT larger_than_size
+
+; True to warn about any function whose frame size is larger
+; than N bytes.
+Variable
+bool warn_frame_larger_than
+
+Variable
+HOST_WIDE_INT frame_larger_than_size
+
+; Nonzero means we should be saving declaration info into a .X file.
+Variable
+int flag_gen_aux_info = 0
+
+; Nonzero if we are compiling code for a shared library, zero for
+; executable.
+Variable
+int flag_shlib
+
+; The default visibility for all symbols (unless overridden).
+Variable
+enum symbol_visibility default_visibility = VISIBILITY_DEFAULT
+
+; Set to the default thread-local storage (tls) model to use.
+Variable
+enum tls_model flag_tls_default = TLS_MODEL_GLOBAL_DYNAMIC
+
 ###
 Driver
 
@@ -522,14 +565,14 @@ Xpreprocessor
 Driver Separate
 
 aux-info
-Common Separate
+Common Separate Var(aux_info_file_name)
 -aux-info <file>       Emit declaration information into <file>
 
 aux-info=
 Common Joined Alias(aux-info)
 
 auxbase
-Common Separate RejectDriver
+Common Separate RejectDriver Var(aux_base_name)
 
 auxbase-strip
 Common Separate RejectDriver
@@ -545,11 +588,11 @@ Common Joined
 -d<letters>    Enable dumps from specific passes of the compiler
 
 dumpbase
-Common Separate
+Common Separate Var(dump_base_name)
 -dumpbase <file>       Set the file basename to be used for dumps
 
 dumpdir
-Common Separate
+Common Separate Var(dump_dir_name)
 -dumpdir <dir> Set the directory name to be used for dumps
 
 dumpmachine
@@ -591,28 +634,28 @@ Common Report Var(align_functions,0) Optimization UInteger
 Align the start of functions
 
 falign-functions=
-Common RejectNegative Joined UInteger
+Common RejectNegative Joined UInteger Var(align_functions)
 
 falign-jumps
 Common Report Var(align_jumps,0) Optimization UInteger
 Align labels which are only reached by jumping
 
 falign-jumps=
-Common RejectNegative Joined UInteger
+Common RejectNegative Joined UInteger Var(align_jumps)
 
 falign-labels
 Common Report Var(align_labels,0) Optimization UInteger
 Align all labels
 
 falign-labels=
-Common RejectNegative Joined UInteger
+Common RejectNegative Joined UInteger Var(align_labels)
 
 falign-loops
 Common Report Var(align_loops,0) Optimization UInteger
 Align the start of loops
 
 falign-loops=
-Common RejectNegative Joined UInteger
+Common RejectNegative Joined UInteger Var(align_loops)
 
 fargument-alias
 Common Ignore
@@ -1928,7 +1971,7 @@ nostdlib
 Driver
 
 o
-Common Driver Joined Separate MissingArgError(missing filename after %qs)
+Common Driver Joined Separate Var(asm_file_name) MissingArgError(missing filename after %qs)
 -o <file>      Place output into <file>
 
 p
@@ -1943,7 +1986,7 @@ Common Var(pedantic)
 Issue warnings needed for strict compliance to the standard
 
 pedantic-errors
-Common
+Common Var(flag_pedantic_errors)
 Like -pedantic but issue them as errors
 
 pg
@@ -2003,7 +2046,8 @@ Driver
 ; C option, but driver must not handle as "-u ndef".
 
 v
-Driver
+Common Driver Var(verbose_flag)
+Enable verbose output
 
 version
 Common Var(version_flag) RejectDriver
index 1125440ea3f26ec2573d7f9853f6faae4bf82b98..7aa9ff14be3b1606565629e4ae95a3da2de07531 100644 (file)
@@ -49,9 +49,6 @@ extern bool use_gnu_debug_info_extensions;
    an actual variable not a macro.  */
 extern int flag_compare_debug;
 
-/* The default visibility for all symbols (unless overridden).  */
-extern enum symbol_visibility default_visibility;
-
 /* Global visibility options.  */
 extern struct visibility_flags visibility_options;
 
@@ -62,31 +59,14 @@ extern struct visibility_flags visibility_options;
 
 extern bool in_lto_p;
 
-/* Nonzero if we should write GIMPLE bytecode for link-time optimization.  */
-
-extern int flag_generate_lto;
-
-/* Used to set the level of -Wstrict-aliasing, when no level is specified.
-   The external way to set the default level is to use
+/* Used to set the level of -Wstrict-aliasing in OPTS, when no level
+   is specified.  The external way to set the default level is to use
    -Wstrict-aliasing=level.
    ONOFF is assumed to take value 1 when -Wstrict-aliasing is specified,
    and 0 otherwise.  After calling this function, wstrict_aliasing will be
    set to the default value of -Wstrict_aliasing=level.  */
 
-extern void set_Wstrict_aliasing (int onoff);
-
-/* Nonzero means warn about any objects definitions whose size is larger
-   than N bytes.  Also want about function definitions whose returned
-   values are larger than N bytes. The value N is in `larger_than_size'.  */
-
-extern bool warn_larger_than;
-extern HOST_WIDE_INT larger_than_size;
-
-/* Nonzero means warn about any function whose frame size is larger
-   than N bytes. */
-
-extern bool warn_frame_larger_than;
-extern HOST_WIDE_INT frame_larger_than_size;
+extern void set_Wstrict_aliasing (struct gcc_options *opts, int onoff);
 
 /* Nonzero for -dp: annotate the assembly with a comment describing the
    pattern and alternative used.  */
@@ -99,28 +79,14 @@ extern int flag_print_asm_name;
 
 extern int rtl_dump_and_exit;
 
-/* Nonzero means we should save auxiliary info into a .X file.  */
-
-extern int flag_gen_aux_info;
-
 /* True if printing into -fdump-final-insns= dump.  */
 
 extern bool final_insns_dump_p;
 
-/* Nonzero means change certain warnings into errors.
-   Usually these are warnings about failure to conform to some standard.  */
-
-extern int flag_pedantic_errors;
-
 /* Nonzero means make permerror produce warnings instead of errors.  */
 
 extern int flag_permissive;
 
-/* Nonzero if we are compiling code for a shared library, zero for
-   executable.  */
-
-extern int flag_shlib;
-
 /* -dA causes debug information to be produced in
    the generated assembly code (to make it more readable).  This option
    is generally only of use to those who actually need to read the
@@ -135,10 +101,6 @@ extern int flag_debug_asm;
 extern int flag_next_runtime;
 
 extern int flag_dump_rtl_in_asm;
-
-/* The excess precision specified on the command line, or defaulted by
-   the front end.  */
-extern enum excess_precision flag_excess_precision_cmdline;
 \f
 /* Other basic status info about current function.  */
 
index fe335a99272c5d276bbaf775ed1e843d230e7baa..48a2e4f77c4be9d95a21e9a0a6b3336e43ebb1ce 100644 (file)
@@ -1,3 +1,7 @@
+2010-11-10  Joseph Myers  <joseph@codesourcery.com>
+
+       * cpp.c (asm_file_name): Don't declare here.
+
 2010-11-10  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/46411
index ca6d34c6be9d734776789d70d7dfc8001c9d723d..4c1307c84968bb80f82a94d7392564d15089b990 100644 (file)
@@ -115,12 +115,6 @@ gfc_cpp_option;
 static cpp_options *cpp_option = NULL;
 static cpp_reader *cpp_in = NULL;
 
-/* Defined in toplev.c.  */
-extern const char *asm_file_name;
-
-
-
-
 /* Encapsulates state used to convert a stream of cpp-tokens into
    a text file.  */
 static struct
index c016a5c3d22ec64b62c7d54db03e6fc4546dd8d2..5884f381772e038c5db239b9a09cd9d26779d517 100644 (file)
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -114,10 +114,6 @@ static int print_help_list;
 
 static int print_version;
 
-/* Flag indicating whether we should print the command and arguments */
-
-static int verbose_flag;
-
 /* Flag indicating whether we should ONLY print the command and
    arguments (like verbose_flag) without executing the command.
    Displayed arguments are quoted so that the generated command
@@ -3145,7 +3141,8 @@ 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,
-                     const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED)
+                     const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED,
+                     diagnostic_context *dc)
 {
   size_t opt_index = decoded->opt_index;
   const char *arg = decoded->arg;
@@ -3157,6 +3154,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 (dc == global_dc);
 
   switch (opt_index)
     {
@@ -3421,7 +3419,7 @@ driver_handle_option (struct gcc_options *opts,
         is intended for use in shell scripts to capture the
         driver-generated command line.  */
       verbose_only_flag++;
-      verbose_flag++;
+      verbose_flag = 1;
       do_save = false;
       break;
 
@@ -3456,10 +3454,6 @@ driver_handle_option (struct gcc_options *opts,
       validated = true;
       break;
 
-    case OPT_v:        /* Print our subcommands and print versions.  */
-      verbose_flag++;
-      break;
-
     case OPT_x:
       spec_lang = arg;
       if (!strcmp (spec_lang, "none"))
index 8fec03f9fc7a71cc7fa1dd985abf15fe040a5766..3c814c6ae4858db85426098b5ce0441c2da16c76 100644 (file)
@@ -1,3 +1,7 @@
+2010-11-10  Joseph Myers  <joseph@codesourcery.com>
+
+       * objc-act.c (dump_base_name): Don't declare here.
+
 2010-11-08  Nicola Pero  <nicola.pero@meta-innovation.com>
 
        * objc-act.c (objc_add_dynamic_declaration_for_property): Do not
index eee98e40ac64b09253cb5c91d96197baf9219689..bc6cc029ff7d6c2627abf876f01a899fc45c887c 100644 (file)
@@ -414,9 +414,6 @@ static char *errbuf;        /* Buffer for error diagnostics */
 
 extern enum debug_info_type write_symbols;
 
-/* Data imported from toplev.c.  */
-
-extern const char *dump_base_name;
 \f
 static int flag_typed_selectors;
 
index 94fa8299f6e8d52e0fd7950ca8f643021ee4b017..349d1bf4a8be7956de8335ebb5e086ea80305581 100644 (file)
@@ -751,7 +751,7 @@ handle_option (struct gcc_options *opts,
     if (option->flags & handlers->handlers[i].mask)
       {
        if (!handlers->handlers[i].handler (opts, opts_set, decoded,
-                                           lang_mask, kind, handlers))
+                                           lang_mask, kind, handlers, dc))
          return false;
        else
          handlers->post_handling_callback (decoded,
index b2019c67a38cc39213a1fd377d00ad880342078d..7b1d265bc84aab50efaf2e52222b7bf3371d9dbc 100644 (file)
@@ -49,17 +49,6 @@ along with GCC; see the file COPYING3.  If not see
 /* True if we should exit after parsing options.  */
 bool exit_after_options;
 
-/* True to warn about any objects definitions whose size is larger
-   than N bytes.  Also want about function definitions whose returned
-   values are larger than N bytes, where N is `larger_than_size'.  */
-bool warn_larger_than;
-HOST_WIDE_INT larger_than_size;
-
-/* True to warn about any function whose frame size is larger
-   than N bytes. */
-bool warn_frame_larger_than;
-HOST_WIDE_INT frame_larger_than_size;
-
 /* Type(s) of debugging information we are producing (if any).  See
    flags.h for the definitions of the different possible types of
    debugging information.  */
@@ -329,9 +318,6 @@ should_emit_struct_debug (tree type, enum debug_info_usage usage)
    write_symbols is set to DBX_DEBUG, XCOFF_DEBUG, or DWARF_DEBUG.  */
 bool use_gnu_debug_info_extensions;
 
-/* The default visibility for all symbols (unless overridden) */
-enum symbol_visibility default_visibility = VISIBILITY_DEFAULT;
-
 /* Global visibility options.  */
 struct visibility_flags visibility_options;
 
@@ -361,7 +347,8 @@ 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,
-                                 const struct cl_option_handlers *handlers);
+                                 const struct cl_option_handlers *handlers,
+                                 diagnostic_context *dc);
 static void handle_param (struct gcc_options *opts,
                          struct gcc_options *opts_set, const char *carg);
 static char *write_langs (unsigned int lang_mask);
@@ -369,8 +356,9 @@ static void complain_wrong_lang (const struct cl_decoded_option *,
                                 unsigned int lang_mask);
 static void set_debug_level (enum debug_info_type type, int extended,
                             const char *arg);
-static void set_fast_math_flags (int set);
-static void set_unsafe_math_optimizations_flags (int set);
+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);
 
 /* Return a malloced slash-separated list of languages in MASK.  */
 static char *
@@ -505,10 +493,12 @@ 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,
-                   const struct cl_option_handlers *handlers)
+                   const struct cl_option_handlers *handlers,
+                   diagnostic_context *dc)
 {
   gcc_assert (opts == &global_options);
   gcc_assert (opts_set == &global_options_set);
+  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);
@@ -522,10 +512,12 @@ 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,
-                     const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED)
+                     const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED,
+                     diagnostic_context *dc)
 {
   gcc_assert (opts == &global_options);
   gcc_assert (opts_set == &global_options_set);
+  gcc_assert (dc == global_dc);
   gcc_assert (decoded->canonical_option_num_elements <= 2);
   gcc_assert (kind == DK_UNSPECIFIED);
   return targetm.handle_option (decoded->opt_index, decoded->arg,
@@ -615,15 +607,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.  LANG_MASK contains has a single bit set representing the
-   current language.  HANDLERS describes what functions to call for
-   the options.  */
+   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,
                      unsigned int lang_mask,
-                     const struct cl_option_handlers *handlers)
+                     const struct cl_option_handlers *handlers,
+                     diagnostic_context *dc)
 {
   unsigned int i;
 
@@ -648,7 +641,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,
-                          global_dc);
+                          dc);
     }
 }
 
@@ -1008,11 +1001,12 @@ 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.  */
+   and *DECODED_OPTIONS_COUNT; settings go in OPTS, OPTS_SET and DC.  */
 void
 decode_options (struct gcc_options *opts, struct gcc_options *opts_set,
                struct cl_decoded_option *decoded_options,
-               unsigned int decoded_options_count)
+               unsigned int decoded_options_count,
+               diagnostic_context *dc)
 {
   struct cl_option_handlers handlers;
 
@@ -1033,11 +1027,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,
-                          global_dc);
+                          dc);
 
   default_options_optimization (opts, opts_set,
                                decoded_options, decoded_options_count,
-                               lang_mask, &handlers, global_dc);
+                               lang_mask, &handlers, dc);
 
 #ifdef ENABLE_LTO
   /* Clear any options currently held for LTO.  */
@@ -1046,7 +1040,7 @@ decode_options (struct gcc_options *opts, struct gcc_options *opts_set,
 
   read_cmdline_options (opts, opts_set,
                        decoded_options, decoded_options_count, lang_mask,
-                       &handlers);
+                       &handlers, dc);
 
   finish_options (opts, opts_set);
 }
@@ -1063,76 +1057,78 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set)
   gcc_assert (opts == &global_options);
   gcc_assert (opts_set = &global_options_set);
 
-  if (dump_base_name && ! IS_ABSOLUTE_PATH (dump_base_name))
+  if (opts->x_dump_base_name && ! IS_ABSOLUTE_PATH (opts->x_dump_base_name))
     {
-      /* First try to make DUMP_BASE_NAME relative to the DUMP_DIR_NAME
-        directory.  Then try to make DUMP_BASE_NAME relative to the
-        AUX_BASE_NAME directory, typically the directory to contain
-        the object file.  */
-      if (dump_dir_name)
-       dump_base_name = concat (dump_dir_name, dump_base_name, NULL);
-      else if (aux_base_name)
+      /* First try to make OPTS->X_DUMP_BASE_NAME relative to the
+        OPTS->X_DUMP_DIR_NAME directory.  Then try to make
+        OPTS->X_DUMP_BASE_NAME relative to the OPTS->X_AUX_BASE_NAME
+        directory, typically the directory to contain the object
+        file.  */
+      if (opts->x_dump_dir_name)
+       opts->x_dump_base_name = concat (opts->x_dump_dir_name,
+                                        opts->x_dump_base_name, NULL);
+      else if (opts->x_aux_base_name)
        {
          const char *aux_base;
 
-         base_of_path (aux_base_name, &aux_base);
-         if (aux_base_name != aux_base)
+         base_of_path (opts->x_aux_base_name, &aux_base);
+         if (opts->x_aux_base_name != aux_base)
            {
-             int dir_len = aux_base - aux_base_name;
+             int dir_len = aux_base - opts->x_aux_base_name;
              char *new_dump_base_name =
-               XNEWVEC (char, strlen(dump_base_name) + dir_len + 1);
+               XNEWVEC (char, strlen (opts->x_dump_base_name) + dir_len + 1);
 
-             /* Copy directory component from AUX_BASE_NAME.  */
-             memcpy (new_dump_base_name, aux_base_name, dir_len);
-             /* Append existing DUMP_BASE_NAME.  */
-             strcpy (new_dump_base_name + dir_len, dump_base_name);
-             dump_base_name = new_dump_base_name;
+             /* Copy directory component from OPTS->X_AUX_BASE_NAME.  */
+             memcpy (new_dump_base_name, opts->x_aux_base_name, dir_len);
+             /* Append existing OPTS->X_DUMP_BASE_NAME.  */
+             strcpy (new_dump_base_name + dir_len, opts->x_dump_base_name);
+             opts->x_dump_base_name = new_dump_base_name;
            }
        }
     }
 
   /* Handle related options for unit-at-a-time, toplevel-reorder, and
      section-anchors.  */
-  if (!flag_unit_at_a_time)
+  if (!opts->x_flag_unit_at_a_time)
     {
-      if (flag_section_anchors && opts_set->x_flag_section_anchors)
+      if (opts->x_flag_section_anchors && opts_set->x_flag_section_anchors)
        error ("Section anchors must be disabled when unit-at-a-time "
               "is disabled.");
-      flag_section_anchors = 0;
-      if (flag_toplevel_reorder == 1)
+      opts->x_flag_section_anchors = 0;
+      if (opts->x_flag_toplevel_reorder == 1)
        error ("Toplevel reorder must be disabled when unit-at-a-time "
               "is disabled.");
-      flag_toplevel_reorder = 0;
+      opts->x_flag_toplevel_reorder = 0;
     }
 
   /* -Wmissing-noreturn is alias for -Wsuggest-attribute=noreturn.  */
-  if (warn_missing_noreturn)
-    warn_suggest_attribute_noreturn = true;
+  if (opts->x_warn_missing_noreturn)
+    opts->x_warn_suggest_attribute_noreturn = true;
     
   /* Unless the user has asked for section anchors, we disable toplevel
      reordering at -O0 to disable transformations that might be surprising
      to end users and to get -fno-toplevel-reorder tested.  */
   if (!optimize
-      && flag_toplevel_reorder == 2
-      && !(flag_section_anchors && opts_set->x_flag_section_anchors))
+      && opts->x_flag_toplevel_reorder == 2
+      && !(opts->x_flag_section_anchors && opts_set->x_flag_section_anchors))
     {
-      flag_toplevel_reorder = 0;
-      flag_section_anchors = 0;
+      opts->x_flag_toplevel_reorder = 0;
+      opts->x_flag_section_anchors = 0;
     }
-  if (!flag_toplevel_reorder)
+  if (!opts->x_flag_toplevel_reorder)
     {
-      if (flag_section_anchors && opts_set->x_flag_section_anchors)
+      if (opts->x_flag_section_anchors && opts_set->x_flag_section_anchors)
        error ("section anchors must be disabled when toplevel reorder"
               " is disabled");
-      flag_section_anchors = 0;
+      opts->x_flag_section_anchors = 0;
     }
 
   if (first_time_p)
     {
-      if (flag_pie)
-       flag_pic = flag_pie;
-      if (flag_pic && !flag_pie)
-       flag_shlib = 1;
+      if (opts->x_flag_pie)
+       opts->x_flag_pic = opts->x_flag_pie;
+      if (opts->x_flag_pic && !opts->x_flag_pie)
+       opts->x_flag_shlib = 1;
       first_time_p = false;
     }
 
@@ -1140,125 +1136,126 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set)
     {
       /* Inlining does not work if not optimizing,
         so force it not to be done.  */
-      warn_inline = 0;
-      flag_no_inline = 1;
+      opts->x_warn_inline = 0;
+      opts->x_flag_no_inline = 1;
     }
 
   /* The optimization to partition hot and cold basic blocks into separate
      sections of the .o and executable files does not work (currently)
      with exception handling.  This is because there is no support for
-     generating unwind info.  If flag_exceptions is turned on we need to
-     turn off the partitioning optimization.  */
+     generating unwind info.  If opts->x_flag_exceptions is turned on
+     we need to turn off the partitioning optimization.  */
 
   ui_except = targetm.except_unwind_info ();
 
-  if (flag_exceptions
-      && flag_reorder_blocks_and_partition
+  if (opts->x_flag_exceptions
+      && opts->x_flag_reorder_blocks_and_partition
       && (ui_except == UI_SJLJ || ui_except == UI_TARGET))
     {
       inform (input_location,
              "-freorder-blocks-and-partition does not work "
              "with exceptions on this architecture");
-      flag_reorder_blocks_and_partition = 0;
-      flag_reorder_blocks = 1;
+      opts->x_flag_reorder_blocks_and_partition = 0;
+      opts->x_flag_reorder_blocks = 1;
     }
 
   /* If user requested unwind info, then turn off the partitioning
      optimization.  */
 
-  if (flag_unwind_tables
+  if (opts->x_flag_unwind_tables
       && !targetm.unwind_tables_default
-      && flag_reorder_blocks_and_partition
+      && opts->x_flag_reorder_blocks_and_partition
       && (ui_except == UI_SJLJ || ui_except == UI_TARGET))
     {
       inform (input_location,
              "-freorder-blocks-and-partition does not support "
              "unwind info on this architecture");
-      flag_reorder_blocks_and_partition = 0;
-      flag_reorder_blocks = 1;
+      opts->x_flag_reorder_blocks_and_partition = 0;
+      opts->x_flag_reorder_blocks = 1;
     }
 
   /* If the target requested unwind info, then turn off the partitioning
      optimization with a different message.  Likewise, if the target does not
      support named sections.  */
 
-  if (flag_reorder_blocks_and_partition
+  if (opts->x_flag_reorder_blocks_and_partition
       && (!targetm.have_named_sections
-         || (flag_unwind_tables
+         || (opts->x_flag_unwind_tables
              && targetm.unwind_tables_default
              && (ui_except == UI_SJLJ || ui_except == UI_TARGET))))
     {
       inform (input_location,
              "-freorder-blocks-and-partition does not work "
              "on this architecture");
-      flag_reorder_blocks_and_partition = 0;
-      flag_reorder_blocks = 1;
+      opts->x_flag_reorder_blocks_and_partition = 0;
+      opts->x_flag_reorder_blocks = 1;
     }
 
   /* Pipelining of outer loops is only possible when general pipelining
      capabilities are requested.  */
-  if (!flag_sel_sched_pipelining)
-    flag_sel_sched_pipelining_outer_loops = 0;
+  if (!opts->x_flag_sel_sched_pipelining)
+    opts->x_flag_sel_sched_pipelining_outer_loops = 0;
 
   if (!targetm.ira_cover_classes
-      && flag_ira_algorithm == IRA_ALGORITHM_CB)
+      && opts->x_flag_ira_algorithm == IRA_ALGORITHM_CB)
     {
       inform (input_location,
              "-fira-algorithm=CB does not work on this architecture");
-      flag_ira_algorithm = IRA_ALGORITHM_PRIORITY;
+      opts->x_flag_ira_algorithm = IRA_ALGORITHM_PRIORITY;
     }
 
-  if (flag_conserve_stack)
+  if (opts->x_flag_conserve_stack)
     {
       maybe_set_param_value (PARAM_LARGE_STACK_FRAME, 100,
                             opts->x_param_values, opts_set->x_param_values);
       maybe_set_param_value (PARAM_STACK_FRAME_GROWTH, 40,
                             opts->x_param_values, opts_set->x_param_values);
     }
-  if (flag_wpa || flag_ltrans)
+  if (opts->x_flag_wpa || opts->x_flag_ltrans)
     {
       /* These passes are not WHOPR compatible yet.  */
-      flag_ipa_pta = 0;
-      flag_ipa_struct_reorg = 0;
+      opts->x_flag_ipa_pta = 0;
+      opts->x_flag_ipa_struct_reorg = 0;
     }
 
-  if (flag_lto || flag_whopr)
+  if (opts->x_flag_lto || opts->x_flag_whopr)
     {
 #ifdef ENABLE_LTO
-      flag_generate_lto = 1;
+      opts->x_flag_generate_lto = 1;
 
       /* When generating IL, do not operate in whole-program mode.
         Otherwise, symbols will be privatized too early, causing link
         errors later.  */
-      flag_whole_program = 0;
+      opts->x_flag_whole_program = 0;
 #else
       error ("LTO support has not been enabled in this configuration");
 #endif
     }
-  if (flag_lto_partition_balanced || flag_lto_partition_1to1)
+  if (opts->x_flag_lto_partition_balanced || opts->x_flag_lto_partition_1to1)
     {
-      if (flag_lto_partition_balanced && flag_lto_partition_1to1)
+      if (opts->x_flag_lto_partition_balanced
+         && opts->x_flag_lto_partition_1to1)
        error ("Only one -flto-partitoin value can be specified");
-      if (!flag_whopr && !flag_wpa && !flag_ltrans)
+      if (!opts->x_flag_whopr && !opts->x_flag_wpa && !opts->x_flag_ltrans)
        error ("-flto-partition has no effect without -fwhopr");
     }
 
   /* Reconcile -flto and -fwhopr.  Set additional flags as appropriate and
      check option consistency.  */
-  if (flag_lto && flag_whopr)
+  if (opts->x_flag_lto && opts->x_flag_whopr)
     error ("-flto and -fwhopr are mutually exclusive");
 
-  /* We initialize flag_split_stack to -1 so that targets can set a
+  /* We initialize opts->x_flag_split_stack to -1 so that targets can set a
      default value if they choose based on other options.  */
-  if (flag_split_stack == -1)
-    flag_split_stack = 0;
-  else if (flag_split_stack)
+  if (opts->x_flag_split_stack == -1)
+    opts->x_flag_split_stack = 0;
+  else if (opts->x_flag_split_stack)
     {
       if (!targetm.supports_split_stack (true))
        {
          error ("%<-fsplit-stack%> is not supported by "
                 "this compiler configuration");
-         flag_split_stack = 0;
+         opts->x_flag_split_stack = 0;
        }
     }
 }
@@ -1588,16 +1585,17 @@ 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,
-                     const struct cl_option_handlers *handlers)
+                     const struct cl_option_handlers *handlers,
+                     diagnostic_context *dc)
 {
   size_t scode = decoded->opt_index;
   const char *arg = decoded->arg;
   int value = decoded->value;
-  static bool verbose = false;
   enum opt_code code = (enum opt_code) scode;
 
   gcc_assert (opts == &global_options);
   gcc_assert (opts_set == &global_options_set);
+  gcc_assert (dc == global_dc);
   gcc_assert (decoded->canonical_option_num_elements <= 2);
 
   switch (code)
@@ -1606,17 +1604,15 @@ common_handle_option (struct gcc_options *opts,
       handle_param (opts, opts_set, arg);
       break;
 
-    case OPT_v:
-      verbose = true;
-      break;
-
     case OPT__help:
       {
        unsigned int all_langs_mask = (1U << cl_lang_count) - 1;
        unsigned int undoc_mask;
        unsigned int i;
 
-       undoc_mask = (verbose | extra_warnings) ? 0 : CL_UNDOCUMENTED;
+       undoc_mask = ((opts->x_verbose_flag | opts->x_extra_warnings)
+                     ? 0
+                     : CL_UNDOCUMENTED);
        /* First display any single language specific options.  */
        for (i = 0; i < cl_lang_count; i++)
          print_specific_help
@@ -1769,56 +1765,39 @@ common_handle_option (struct gcc_options *opts,
       break;
 
     case OPT_Werror_:
-      enable_warning_as_error (arg, value, lang_mask, handlers, global_dc);
+      enable_warning_as_error (arg, value, lang_mask, handlers, dc);
       break;
 
     case OPT_Wlarger_than_:
-      larger_than_size = value;
-      warn_larger_than = value != -1;
+      opts->x_larger_than_size = value;
+      opts->x_warn_larger_than = value != -1;
       break;
 
     case OPT_Wfatal_errors:
-      global_dc->fatal_errors = value;
+      dc->fatal_errors = value;
       break;
 
     case OPT_Wframe_larger_than_:
-      frame_larger_than_size = value;
-      warn_frame_larger_than = value != -1;
+      opts->x_frame_larger_than_size = value;
+      opts->x_warn_frame_larger_than = value != -1;
       break;
 
     case OPT_Wstrict_aliasing:
-      set_Wstrict_aliasing (value);
-      break;
-
-    case OPT_Wstrict_aliasing_:
-      warn_strict_aliasing = value;
+      set_Wstrict_aliasing (opts, value);
       break;
 
     case OPT_Wstrict_overflow:
-      warn_strict_overflow = (value
-                             ? (int) WARN_STRICT_OVERFLOW_CONDITIONAL
-                             : 0);
-      break;
-
-    case OPT_Wstrict_overflow_:
-      warn_strict_overflow = value;
+      opts->x_warn_strict_overflow = (value
+                                     ? (int) WARN_STRICT_OVERFLOW_CONDITIONAL
+                                     : 0);
       break;
 
     case OPT_Wsystem_headers:
-      global_dc->dc_warn_system_headers = value;
-      break;
-
-    case OPT_Wunused:
-      warn_unused = value;
+      dc->dc_warn_system_headers = value;
       break;
 
     case OPT_aux_info:
-      aux_info_file_name = arg;
-      flag_gen_aux_info = 1;
-      break;
-
-    case OPT_auxbase:
-      aux_base_name = arg;
+      opts->x_flag_gen_aux_info = 1;
       break;
 
     case OPT_auxbase_strip:
@@ -1826,7 +1805,7 @@ common_handle_option (struct gcc_options *opts,
        char *tmp = xstrdup (arg);
        strip_off_ending (tmp, strlen (tmp));
        if (tmp[0])
-         aux_base_name = tmp;
+         opts->x_aux_base_name = tmp;
       }
       break;
 
@@ -1834,30 +1813,6 @@ common_handle_option (struct gcc_options *opts,
       decode_d_option (arg);
       break;
 
-    case OPT_dumpbase:
-      dump_base_name = arg;
-      break;
-
-    case OPT_dumpdir:
-      dump_dir_name = arg;
-      break;
-
-    case OPT_falign_functions_:
-      align_functions = value;
-      break;
-
-    case OPT_falign_jumps_:
-      align_jumps = value;
-      break;
-
-    case OPT_falign_labels_:
-      align_labels = value;
-      break;
-
-    case OPT_falign_loops_:
-      align_loops = value;
-      break;
-
     case OPT_fcall_used_:
       fix_register (arg, 0, 1);
       break;
@@ -1884,16 +1839,16 @@ common_handle_option (struct gcc_options *opts,
 
     case OPT_fdiagnostics_show_location_:
       if (!strcmp (arg, "once"))
-       diagnostic_prefixing_rule (global_dc) = DIAGNOSTICS_SHOW_PREFIX_ONCE;
+       diagnostic_prefixing_rule (dc) = DIAGNOSTICS_SHOW_PREFIX_ONCE;
       else if (!strcmp (arg, "every-line"))
-       diagnostic_prefixing_rule (global_dc)
+       diagnostic_prefixing_rule (dc)
          = DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE;
       else
        return false;
       break;
 
     case OPT_fdiagnostics_show_option:
-      global_dc->show_option_requested = value;
+      dc->show_option_requested = value;
       break;
 
     case OPT_fdump_:
@@ -1904,30 +1859,30 @@ common_handle_option (struct gcc_options *opts,
     case OPT_ffp_contract_:
       if (!strcmp (arg, "on"))
        /* Not implemented, fall back to conservative FP_CONTRACT_OFF.  */
-       flag_fp_contract_mode = FP_CONTRACT_OFF;
+       opts->x_flag_fp_contract_mode = FP_CONTRACT_OFF;
       else if (!strcmp (arg, "off"))
-       flag_fp_contract_mode = FP_CONTRACT_OFF;
+       opts->x_flag_fp_contract_mode = FP_CONTRACT_OFF;
       else if (!strcmp (arg, "fast"))
-       flag_fp_contract_mode = FP_CONTRACT_FAST;
+       opts->x_flag_fp_contract_mode = FP_CONTRACT_FAST;
       else
        error ("unknown floating point contraction style \"%s\"", arg);
       break;
 
     case OPT_fexcess_precision_:
       if (!strcmp (arg, "fast"))
-       flag_excess_precision_cmdline = EXCESS_PRECISION_FAST;
+       opts->x_flag_excess_precision_cmdline = EXCESS_PRECISION_FAST;
       else if (!strcmp (arg, "standard"))
-       flag_excess_precision_cmdline = EXCESS_PRECISION_STANDARD;
+       opts->x_flag_excess_precision_cmdline = EXCESS_PRECISION_STANDARD;
       else
        error ("unknown excess precision style \"%s\"", arg);
       break;
 
     case OPT_ffast_math:
-      set_fast_math_flags (value);
+      set_fast_math_flags (opts, value);
       break;
 
     case OPT_funsafe_math_optimizations:
-      set_unsafe_math_optimizations_flags (value);
+      set_unsafe_math_optimizations_flags (opts, value);
       break;
 
     case OPT_ffixed_:
@@ -1952,7 +1907,7 @@ common_handle_option (struct gcc_options *opts,
       break;
 
     case OPT_fmessage_length_:
-      pp_set_line_maximum_length (global_dc->printer, value);
+      pp_set_line_maximum_length (dc->printer, value);
       break;
 
     case OPT_fpack_struct_:
@@ -1987,35 +1942,35 @@ common_handle_option (struct gcc_options *opts,
 
     case OPT_fprofile_use_:
       profile_data_prefix = xstrdup (arg);
-      flag_profile_use = true;
+      opts->x_flag_profile_use = true;
       value = true;
       /* No break here - do -fprofile-use processing. */
     case OPT_fprofile_use:
       if (!opts_set->x_flag_branch_probabilities)
-        flag_branch_probabilities = value;
+       opts->x_flag_branch_probabilities = value;
       if (!opts_set->x_flag_profile_values)
-        flag_profile_values = value;
+       opts->x_flag_profile_values = value;
       if (!opts_set->x_flag_unroll_loops)
-        flag_unroll_loops = value;
+       opts->x_flag_unroll_loops = value;
       if (!opts_set->x_flag_peel_loops)
-        flag_peel_loops = value;
+       opts->x_flag_peel_loops = value;
       if (!opts_set->x_flag_tracer)
-        flag_tracer = value;
+       opts->x_flag_tracer = value;
       if (!opts_set->x_flag_value_profile_transformations)
-        flag_value_profile_transformations = value;
+       opts->x_flag_value_profile_transformations = value;
       if (!opts_set->x_flag_inline_functions)
-        flag_inline_functions = value;
+       opts->x_flag_inline_functions = value;
       if (!opts_set->x_flag_ipa_cp)
-        flag_ipa_cp = value;
+       opts->x_flag_ipa_cp = value;
       if (!opts_set->x_flag_ipa_cp_clone
-         && value && flag_ipa_cp)
-       flag_ipa_cp_clone = value;
+         && value && opts->x_flag_ipa_cp)
+       opts->x_flag_ipa_cp_clone = value;
       if (!opts_set->x_flag_predictive_commoning)
-       flag_predictive_commoning = value;
+       opts->x_flag_predictive_commoning = value;
       if (!opts_set->x_flag_unswitch_loops)
-       flag_unswitch_loops = value;
+       opts->x_flag_unswitch_loops = value;
       if (!opts_set->x_flag_gcse_after_reload)
-       flag_gcse_after_reload = value;
+       opts->x_flag_gcse_after_reload = value;
       break;
 
     case OPT_fprofile_generate_:
@@ -2024,29 +1979,29 @@ common_handle_option (struct gcc_options *opts,
       /* No break here - do -fprofile-generate processing. */
     case OPT_fprofile_generate:
       if (!opts_set->x_profile_arc_flag)
-        profile_arc_flag = value;
+       opts->x_profile_arc_flag = value;
       if (!opts_set->x_flag_profile_values)
-        flag_profile_values = value;
+       opts->x_flag_profile_values = value;
       if (!opts_set->x_flag_value_profile_transformations)
-        flag_value_profile_transformations = value;
+       opts->x_flag_value_profile_transformations = value;
       if (!opts_set->x_flag_inline_functions)
-        flag_inline_functions = value;
+       opts->x_flag_inline_functions = value;
       break;
 
     case OPT_fshow_column:
-      global_dc->show_column = value;
+      dc->show_column = value;
       break;
 
     case OPT_fvisibility_:
       {
         if (!strcmp(arg, "default"))
-          default_visibility = VISIBILITY_DEFAULT;
+          opts->x_default_visibility = VISIBILITY_DEFAULT;
         else if (!strcmp(arg, "internal"))
-          default_visibility = VISIBILITY_INTERNAL;
+          opts->x_default_visibility = VISIBILITY_INTERNAL;
         else if (!strcmp(arg, "hidden"))
-          default_visibility = VISIBILITY_HIDDEN;
+          opts->x_default_visibility = VISIBILITY_HIDDEN;
         else if (!strcmp(arg, "protected"))
-          default_visibility = VISIBILITY_PROTECTED;
+          opts->x_default_visibility = VISIBILITY_PROTECTED;
         else
           error ("unrecognized visibility value \"%s\"", arg);
       }
@@ -2072,13 +2027,13 @@ common_handle_option (struct gcc_options *opts,
 #endif
 
     case OPT_fsched_stalled_insns_:
-      flag_sched_stalled_insns = value;
-      if (flag_sched_stalled_insns == 0)
-       flag_sched_stalled_insns = -1;
+      opts->x_flag_sched_stalled_insns = value;
+      if (opts->x_flag_sched_stalled_insns == 0)
+       opts->x_flag_sched_stalled_insns = -1;
       break;
 
     case OPT_fsched_stalled_insns_dep_:
-      flag_sched_stalled_insns_dep = value;
+      opts->x_flag_sched_stalled_insns_dep = value;
       break;
 
     case OPT_fstack_check_:
@@ -2127,41 +2082,37 @@ common_handle_option (struct gcc_options *opts,
 
     case OPT_ftls_model_:
       if (!strcmp (arg, "global-dynamic"))
-       flag_tls_default = TLS_MODEL_GLOBAL_DYNAMIC;
+       opts->x_flag_tls_default = TLS_MODEL_GLOBAL_DYNAMIC;
       else if (!strcmp (arg, "local-dynamic"))
-       flag_tls_default = TLS_MODEL_LOCAL_DYNAMIC;
+       opts->x_flag_tls_default = TLS_MODEL_LOCAL_DYNAMIC;
       else if (!strcmp (arg, "initial-exec"))
-       flag_tls_default = TLS_MODEL_INITIAL_EXEC;
+       opts->x_flag_tls_default = TLS_MODEL_INITIAL_EXEC;
       else if (!strcmp (arg, "local-exec"))
-       flag_tls_default = TLS_MODEL_LOCAL_EXEC;
+       opts->x_flag_tls_default = TLS_MODEL_LOCAL_EXEC;
       else
        warning (0, "unknown tls-model \"%s\"", arg);
       break;
 
     case OPT_fira_algorithm_:
       if (!strcmp (arg, "CB"))
-       flag_ira_algorithm = IRA_ALGORITHM_CB;
+       opts->x_flag_ira_algorithm = IRA_ALGORITHM_CB;
       else if (!strcmp (arg, "priority"))
-       flag_ira_algorithm = IRA_ALGORITHM_PRIORITY;
+       opts->x_flag_ira_algorithm = IRA_ALGORITHM_PRIORITY;
       else
        warning (0, "unknown ira algorithm \"%s\"", arg);
       break;
 
     case OPT_fira_region_:
       if (!strcmp (arg, "one"))
-       flag_ira_region = IRA_REGION_ONE;
+       opts->x_flag_ira_region = IRA_REGION_ONE;
       else if (!strcmp (arg, "all"))
-       flag_ira_region = IRA_REGION_ALL;
+       opts->x_flag_ira_region = IRA_REGION_ALL;
       else if (!strcmp (arg, "mixed"))
-       flag_ira_region = IRA_REGION_MIXED;
+       opts->x_flag_ira_region = IRA_REGION_MIXED;
       else
        warning (0, "unknown ira region \"%s\"", arg);
       break;
 
-    case OPT_fira_verbose_:
-      flag_ira_verbose = value;
-      break;
-
     case OPT_g:
       set_debug_level (NO_DEBUG, DEFAULT_GDB_EXTENSIONS, arg);
       break;
@@ -2196,25 +2147,17 @@ common_handle_option (struct gcc_options *opts,
       set_debug_level (XCOFF_DEBUG, code == OPT_gxcoff_, arg);
       break;
 
-    case OPT_o:
-      asm_file_name = arg;
-      break;
-
     case OPT_pedantic_errors:
-      flag_pedantic_errors = pedantic = 1;
-      global_dc->pedantic_errors = 1;
-      break;
-
-    case OPT_fwhopr_:
-      flag_whopr = arg;
+      opts->x_pedantic = 1;
+      dc->pedantic_errors = 1;
       break;
 
     case OPT_fwhopr:
-      flag_whopr = "";
+      opts->x_flag_whopr = "";
       break;
 
     case OPT_w:
-      global_dc->dc_inhibit_warnings = true;
+      dc->dc_inhibit_warnings = true;
       break;
 
     case OPT_fuse_linker_plugin:
@@ -2259,48 +2202,48 @@ handle_param (struct gcc_options *opts, struct gcc_options *opts_set,
   free (arg);
 }
 
-/* Used to set the level of strict aliasing warnings,
+/* Used to set the level of strict aliasing warnings in OPTS,
    when no level is specified (i.e., when -Wstrict-aliasing, and not
    -Wstrict-aliasing=level was given).
    ONOFF is assumed to take value 1 when -Wstrict-aliasing is specified,
    and 0 otherwise.  After calling this function, wstrict_aliasing will be
    set to the default value of -Wstrict_aliasing=level, currently 3.  */
 void
-set_Wstrict_aliasing (int onoff)
+set_Wstrict_aliasing (struct gcc_options *opts, int onoff)
 {
   gcc_assert (onoff == 0 || onoff == 1);
   if (onoff != 0)
-    warn_strict_aliasing = 3;
+    opts->x_warn_strict_aliasing = 3;
   else
-    warn_strict_aliasing = 0;
+    opts->x_warn_strict_aliasing = 0;
 }
 
 /* The following routines are useful in setting all the flags that
    -ffast-math and -fno-fast-math imply.  */
 static void
-set_fast_math_flags (int set)
+set_fast_math_flags (struct gcc_options *opts, int set)
 {
-  flag_unsafe_math_optimizations = set;
-  set_unsafe_math_optimizations_flags (set);
-  flag_finite_math_only = set;
-  flag_errno_math = !set;
+  opts->x_flag_unsafe_math_optimizations = set;
+  set_unsafe_math_optimizations_flags (opts, set);
+  opts->x_flag_finite_math_only = set;
+  opts->x_flag_errno_math = !set;
   if (set)
     {
-      flag_signaling_nans = 0;
-      flag_rounding_math = 0;
-      flag_cx_limited_range = 1;
+      opts->x_flag_signaling_nans = 0;
+      opts->x_flag_rounding_math = 0;
+      opts->x_flag_cx_limited_range = 1;
     }
 }
 
 /* When -funsafe-math-optimizations is set the following
    flags are set as well.  */
 static void
-set_unsafe_math_optimizations_flags (int set)
+set_unsafe_math_optimizations_flags (struct gcc_options *opts, int set)
 {
-  flag_trapping_math = !set;
-  flag_signed_zeros = !set;
-  flag_associative_math = set;
-  flag_reciprocal_math = set;
+  opts->x_flag_trapping_math = !set;
+  opts->x_flag_signed_zeros = !set;
+  opts->x_flag_associative_math = set;
+  opts->x_flag_reciprocal_math = set;
 }
 
 /* Return true iff flags are set as if -ffast-math.  */
index 2643c37070cf7d89de5aa9e6d943dd983e63272c..ec9fbc7ba4e7df26ffcac3818a929a344ffd0d1e 100644 (file)
@@ -165,7 +165,8 @@ struct cl_option_handler_func
                   struct gcc_options *opts_set,
                   const struct cl_decoded_option *decoded,
                   unsigned int lang_mask, int kind,
-                  const struct cl_option_handlers *handlers);
+                  const struct cl_option_handlers *handlers,
+                  diagnostic_context *dc);
 
   /* The mask that must have some bit in common with the flags for the
      option for this particular handler to be used.  */
@@ -223,7 +224,8 @@ extern void decode_cmdline_options_to_array_default_mask (unsigned int argc,
 extern void decode_options (struct gcc_options *opts,
                            struct gcc_options *opts_set,
                            struct cl_decoded_option *decoded_options,
-                           unsigned int decoded_options_count);
+                           unsigned int decoded_options_count,
+                           diagnostic_context *dc);
 extern int option_enabled (int opt_idx, void *opts);
 extern bool get_option_state (struct gcc_options *, int,
                              struct cl_option_state *);
index 596fb89832e3ee53aa8685394ad6acae255b8cbd..0a41c02d08558ec673a7d2e1fea8a4ddaa9792d7 100644 (file)
@@ -140,18 +140,6 @@ const char *main_input_filename;
    to optimize in process_options ().  */
 #define AUTODETECT_VALUE 2
 
-/* Name to use as base of names for dump output files.  */
-
-const char *dump_base_name;
-
-/* Directory used for dump output files.  */
-
-const char *dump_dir_name;
-
-/* Name to use as a base for auxiliary output files.  */
-
-const char *aux_base_name;
-
 /* Prefix for profile data files */
 const char *profile_data_prefix;
 
@@ -165,10 +153,6 @@ int rtl_dump_and_exit;
 int flag_print_asm_name;
 enum graph_dump_types graph_dump_format;
 
-/* Name for output file of assembly code, specified with -o.  */
-
-const char *asm_file_name;
-
 /* True if this is the lto front end.  This is used to disable
    gimple generation and lowering passes that are normally run on the
    output of a front end.  These passes must be bypassed for lto since
@@ -176,10 +160,6 @@ const char *asm_file_name;
 
 bool in_lto_p = false;
 
-/* Nonzero if we should write GIMPLE bytecode for link-time optimization.  */
-
-int flag_generate_lto;
-
 /* The FUNCTION_DECL for the function currently being compiled,
    or 0 if between functions.  */
 tree current_function_decl;
@@ -198,19 +178,6 @@ unsigned local_tick;
 
 /* -f flags.  */
 
-/* Nonzero means we should be saving declaration info into a .X file.  */
-
-int flag_gen_aux_info = 0;
-
-/* Specified name of aux-info file.  */
-
-const char *aux_info_file_name;
-
-/* Nonzero if we are compiling code for a shared library, zero for
-   executable.  */
-
-int flag_shlib;
-
 /* Generate code for GNU or NeXT Objective-C runtime environment.  */
 
 #ifdef NEXT_OBJC_RUNTIME
@@ -219,19 +186,6 @@ int flag_next_runtime = 1;
 int flag_next_runtime = 0;
 #endif
 
-/* Set to the default thread-local storage (tls) model to use.  */
-
-enum tls_model flag_tls_default = TLS_MODEL_GLOBAL_DYNAMIC;
-
-/* Set the default for excess precision.  */
-
-enum excess_precision flag_excess_precision_cmdline = EXCESS_PRECISION_DEFAULT;
-
-/* Nonzero means change certain warnings into errors.
-   Usually these are warnings about failure to conform to some standard.  */
-
-int flag_pedantic_errors = 0;
-
 /* Nonzero means make permerror produce warnings instead of errors.  */
 
 int flag_permissive = 0;
@@ -2402,7 +2356,8 @@ toplev_main (int argc, char **argv)
   /* Parse the options and do minimal processing; basically just
      enough to default flags appropriately.  */
   decode_options (&global_options, &global_options_set,
-                 save_decoded_options, save_decoded_options_count);
+                 save_decoded_options, save_decoded_options_count,
+                 global_dc);
 
   init_local_tick ();
 
index d38d4ebdd16a02a2207ebb0205f0b3018cc5cdf0..0f6c0216c2e7dc6636648915c4358e444b41c083 100644 (file)
@@ -74,12 +74,7 @@ extern unsigned local_tick;
 /* Top-level source file.  */
 extern const char *main_input_filename;
 
-extern const char *dump_base_name;
-extern const char *dump_dir_name;
-extern const char *aux_base_name;
-extern const char *aux_info_file_name;
 extern const char *profile_data_prefix;
-extern const char *asm_file_name;
 extern bool exit_after_options;
 
 /* True if the user has tagged the function with the 'section'
index c50870d1c67a3ff66c02cf99678dc9eaf6496e61..d4827a63f1de563689f01514d90e88d50f65838c 100644 (file)
@@ -3886,11 +3886,6 @@ extern GTY(()) tree integer_types[itk_none];
 #define long_long_unsigned_type_node   integer_types[itk_unsigned_long_long]
 #define int128_integer_type_node       integer_types[itk_int128]
 #define int128_unsigned_type_node      integer_types[itk_unsigned_int128]
-\f
-/* Set to the default thread-local storage (tls) model to use.  */
-
-extern enum tls_model flag_tls_default;
-
 \f
 /* A pointer-to-function member type looks like: