Makefile.in (TM_H): Include $(FLAGS_H) instead of options.h.
authorJoseph Myers <joseph@codesourcery.com>
Fri, 8 Oct 2010 15:17:32 +0000 (16:17 +0100)
committerJoseph Myers <jsm28@gcc.gnu.org>
Fri, 8 Oct 2010 15:17:32 +0000 (16:17 +0100)
* Makefile.in (TM_H): Include $(FLAGS_H) instead of options.h.
(TREE_H): Include $(FLAGS_H) instead of options.h.
(opts-common.o): Depend on $(FLAGS_H) instead of options.h.
* c-objc-common.h (LANG_HOOKS_INIT_OPTIONS_STRUCT): Define.
* common.opt (flag_complex_method, flag_evaluation_order,
flag_ira_algorithm, flag_ira_region, flag_warn_unused_result): New
Variable declarations.
* configure.ac (tm_include_list): Include flags.h instead of
options.h.
* configure: Regenerate.
* flags.h: Condition out contents for target libraries.  Include
options.h at end of file.
(flag_complex_method, flag_ira_algorithm, flag_ira_region,
flag_evaluation_order, flag_warn_unused_result): Remove.
* gcc.c (main): Intialize global_options with global_options_init.
* langhooks-def.h (lhd_init_options_struct): Declare.
(LANG_HOOKS_INIT_OPTIONS_STRUCT): Define.
(LANG_HOOKS_INITIALIZER): Include LANG_HOOKS_INIT_OPTIONS_STRUCT.
* langhooks.c (lhd_init_options_struct): New.
* langhooks.h (struct lang_hooks): Add init_options_struct.
Update comment on init_options.
* optc-gen.awk: Generate initializer for global_options_init, not
global_options.
* opth-gen.awk: Condition out structure declarations for target
libraries.  Declare global_options_init.
* opts-common.c: Include flags.h instead of options.h.
* opts.c (flag_warn_unused_result): Remove.
(read_cmdline_options): Take gcc_options parameters.  Pass them to
read_cmdline_option.
(initial_lang_mask, initial_min_crossjump_insns,
initial_max_fields_for_field_sensitive,
initial_loop_invariant_max_bbs_in_loop): Define at file scope.
(init_options_once): New.  Split out of decode_options.
(init_options_struct): New.  Split out of decode_options.
(decode_cmdline_options_to_array_default_mask): New.
(default_options_optimization): New.  Split out of decode_options.
(decode_options): Move most code to other functions.  Update call
to read_cmdline_options.
(finish_options): New.  Split out of decode_options.
* opts.h (decode_options): Add gcc_options parameters.
(init_options_once, init_options_struct,
decode_cmdline_options_to_array_default_mask): New.
* toplev.c (flag_complex_method, flag_ira_algorithm,
flag_ira_region, flag_evaluation_order): Remove.
(general_init): Use global_options_init for initial flag values
for global_dc.
(toplev_main): Call init_options_once, init_options_struct,
lang_hooks.init_options_struct,
decode_cmdline_options_to_array_default_mask and
lang_hooks.init_option before decode_options.  Update arguments to
decode_options.
* tree.h: Include flags.h instead of options.h.

ada:
* gcc-interface/misc.c (gnat_init_options_struct): New.  Split out
from gnat_init_options.
(LANG_HOOKS_INIT_OPTIONS_STRUCT): Define.

c-family:
* c-common.c (parse_optimize_options): Call
decode_cmdline_options_to_array_default_mask before
decode_options.  Update arguments to decode_options.
* c-common.h (c_common_init_options_struct): Declare.
* c-opts.c (c_common_init_options_struct): New.  Split out from
c_common_init_options.

cp:
* cp-objcp-common.h (LANG_HOOKS_INIT_OPTIONS_STRUCT): Define.

fortran:
* f95-lang.c (LANG_HOOKS_INIT_OPTIONS_STRUCT): Define.
* gfortran.h (gfc_init_options_struct): Declare.
* options.c (gfc_init_options_struct): New.  Split out from
gfc_init_options.

java:
* lang.c (java_init_options_struct): New.  Split out from
java_init_options.
(LANG_HOOKS_INIT_OPTIONS_STRUCT): Define.

lto:
* lto-lang.c (lto_init_options): Change to
lto_init_options_struct.  Update parameters.
(LANG_HOOKS_INIT_OPTIONS): Don't define.
(LANG_HOOKS_INIT_OPTIONS_STRUCT): Define.

From-SVN: r165189

34 files changed:
gcc/ChangeLog
gcc/Makefile.in
gcc/ada/ChangeLog
gcc/ada/gcc-interface/misc.c
gcc/c-family/ChangeLog
gcc/c-family/c-common.c
gcc/c-family/c-common.h
gcc/c-family/c-opts.c
gcc/c-objc-common.h
gcc/common.opt
gcc/configure
gcc/configure.ac
gcc/cp/ChangeLog
gcc/cp/cp-objcp-common.h
gcc/flags.h
gcc/fortran/ChangeLog
gcc/fortran/f95-lang.c
gcc/fortran/gfortran.h
gcc/fortran/options.c
gcc/gcc.c
gcc/java/ChangeLog
gcc/java/lang.c
gcc/langhooks-def.h
gcc/langhooks.c
gcc/langhooks.h
gcc/lto/ChangeLog
gcc/lto/lto-lang.c
gcc/optc-gen.awk
gcc/opth-gen.awk
gcc/opts-common.c
gcc/opts.c
gcc/opts.h
gcc/toplev.c
gcc/tree.h

index e027dfa35fab7fa97a6ed79048a49dc698ccdd62..12eb6d7d7604139d424857f014b7107fa17e6c53 100644 (file)
@@ -1,3 +1,58 @@
+2010-10-08  Joseph Myers  <joseph@codesourcery.com>
+
+       * Makefile.in (TM_H): Include $(FLAGS_H) instead of options.h.
+       (TREE_H): Include $(FLAGS_H) instead of options.h.
+       (opts-common.o): Depend on $(FLAGS_H) instead of options.h.
+       * c-objc-common.h (LANG_HOOKS_INIT_OPTIONS_STRUCT): Define.
+       * common.opt (flag_complex_method, flag_evaluation_order,
+       flag_ira_algorithm, flag_ira_region, flag_warn_unused_result): New
+       Variable declarations.
+       * configure.ac (tm_include_list): Include flags.h instead of
+       options.h.
+       * configure: Regenerate.
+       * flags.h: Condition out contents for target libraries.  Include
+       options.h at end of file.
+       (flag_complex_method, flag_ira_algorithm, flag_ira_region,
+       flag_evaluation_order, flag_warn_unused_result): Remove.
+       * gcc.c (main): Intialize global_options with global_options_init.
+       * langhooks-def.h (lhd_init_options_struct): Declare.
+       (LANG_HOOKS_INIT_OPTIONS_STRUCT): Define.
+       (LANG_HOOKS_INITIALIZER): Include LANG_HOOKS_INIT_OPTIONS_STRUCT.
+       * langhooks.c (lhd_init_options_struct): New.
+       * langhooks.h (struct lang_hooks): Add init_options_struct.
+       Update comment on init_options.
+       * optc-gen.awk: Generate initializer for global_options_init, not
+       global_options.
+       * opth-gen.awk: Condition out structure declarations for target
+       libraries.  Declare global_options_init.
+       * opts-common.c: Include flags.h instead of options.h.
+       * opts.c (flag_warn_unused_result): Remove.
+       (read_cmdline_options): Take gcc_options parameters.  Pass them to
+       read_cmdline_option.
+       (initial_lang_mask, initial_min_crossjump_insns,
+       initial_max_fields_for_field_sensitive,
+       initial_loop_invariant_max_bbs_in_loop): Define at file scope.
+       (init_options_once): New.  Split out of decode_options.
+       (init_options_struct): New.  Split out of decode_options.
+       (decode_cmdline_options_to_array_default_mask): New.
+       (default_options_optimization): New.  Split out of decode_options.
+       (decode_options): Move most code to other functions.  Update call
+       to read_cmdline_options.
+       (finish_options): New.  Split out of decode_options.
+       * opts.h (decode_options): Add gcc_options parameters.
+       (init_options_once, init_options_struct,
+       decode_cmdline_options_to_array_default_mask): New.
+       * toplev.c (flag_complex_method, flag_ira_algorithm,
+       flag_ira_region, flag_evaluation_order): Remove.
+       (general_init): Use global_options_init for initial flag values
+       for global_dc.
+       (toplev_main): Call init_options_once, init_options_struct,
+       lang_hooks.init_options_struct,
+       decode_cmdline_options_to_array_default_mask and
+       lang_hooks.init_option before decode_options.  Update arguments to
+       decode_options.
+       * tree.h: Include flags.h instead of options.h.
+
 2010-10-08  Nathan Froyd  <froydnj@codesourcery.com>
 
        * config/rx/rx.c (TARGET_EXCEPT_UNWIND_INFO): Define.
index 3d936f6678703a5288427c90a55b554a45a0d807..9f157b7848055ef9121dac5c7e2959cdcd841cac 100644 (file)
@@ -823,7 +823,7 @@ CONFIG_H  = config.h  $(host_xm_file_list)
 TCONFIG_H = tconfig.h $(xm_file_list)
 TM_P_H    = tm_p.h    $(tm_p_file_list)
 GTM_H     = tm.h      $(tm_file_list) insn-constants.h
-TM_H      = $(GTM_H) insn-flags.h options.h
+TM_H      = $(GTM_H) insn-flags.h $(FLAGS_H)
 
 # Variables for version information.
 BASEVER     := $(srcdir)/BASE-VER  # 4.x.y
@@ -884,7 +884,7 @@ BUILTINS_DEF = builtins.def sync-builtins.def omp-builtins.def
 TREE_H = tree.h all-tree.def tree.def c-family/c-common.def \
        $(lang_tree_files) $(MACHMODE_H) tree-check.h $(BUILTINS_DEF) \
        $(INPUT_H) statistics.h $(VEC_H) treestruct.def $(HASHTAB_H) \
-       double-int.h alias.h $(SYMTAB_H) options.h vecir.h \
+       double-int.h alias.h $(SYMTAB_H) $(FLAGS_H) vecir.h \
        $(REAL_H) $(FIXED_VALUE_H)
 REGSET_H = regset.h $(BITMAP_H) hard-reg-set.h
 BASIC_BLOCK_H = basic-block.h $(PREDICT_H) $(VEC_H) $(FUNCTION_H) cfghooks.h
@@ -2821,7 +2821,7 @@ opts.o : opts.c opts.h options.h $(TOPLEV_H) $(DIAGNOSTIC_CORE_H) $(CONFIG_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 options.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) \
index 4543c69ad7bcdc7d16d8e9de7f8d89a82feb5eb0..3001f2e01c3835b6c4e10ba4f0ceb164f9223678 100644 (file)
@@ -1,3 +1,9 @@
+2010-10-08  Joseph Myers  <joseph@codesourcery.com>
+
+       * gcc-interface/misc.c (gnat_init_options_struct): New.  Split out
+       from gnat_init_options.
+       (LANG_HOOKS_INIT_OPTIONS_STRUCT): Define.
+
 2010-10-08  Ed Schonberg  <schonberg@adacore.com>
 
        * sem_aux.adb: Cleanup Is_Immutably_Limited_Type.
index a991fba528e9e83b62242355ccf940c80a101ef9..4bb0e6194bafba17aab0c355e0404610524635f3 100644 (file)
@@ -62,6 +62,7 @@
 
 static bool gnat_init                  (void);
 static unsigned int gnat_option_lang_mask (void);
+static void gnat_init_options_struct   (struct gcc_options *);
 static void gnat_init_options          (unsigned int,
                                         struct cl_decoded_option *);
 static bool gnat_handle_option         (size_t, const char *, int, int,
@@ -91,6 +92,8 @@ static tree gnat_eh_personality               (void);
 #define LANG_HOOKS_INIT                        gnat_init
 #undef  LANG_HOOKS_OPTION_LANG_MASK
 #define LANG_HOOKS_OPTION_LANG_MASK    gnat_option_lang_mask
+#undef  LANG_HOOKS_INIT_OPTIONS_STRUCT
+#define LANG_HOOKS_INIT_OPTIONS_STRUCT gnat_init_options_struct
 #undef  LANG_HOOKS_INIT_OPTIONS
 #define LANG_HOOKS_INIT_OPTIONS                gnat_init_options
 #undef  LANG_HOOKS_HANDLE_OPTION
@@ -256,6 +259,15 @@ gnat_option_lang_mask (void)
   return CL_Ada;
 }
 
+/* Initialize options structure OPTS.  */
+
+static void
+gnat_init_options_struct (struct gcc_options *opts)
+{
+  /* Uninitialized really means uninitialized in Ada.  */
+  opts->x_flag_zero_initialized_in_bss = 0;
+}
+
 /* Initialize for option processing.  */
 
 static void
@@ -298,9 +310,6 @@ gnat_init_options (unsigned int decoded_options_count,
   gnat_argv = (char **) xmalloc (sizeof (save_argv[0]));
   gnat_argv[0] = xstrdup (save_argv[0]);     /* name of the command */
   gnat_argc = 1;
-
-  /* Uninitialized really means uninitialized in Ada.  */
-  flag_zero_initialized_in_bss = 0;
 }
 
 /* Ada code requires variables for these settings rather than elements
index c601968aac1049073d1cc2bc04d245e13fcb282f..77908955dfb30c21515bc74eaf778e13f635fb88 100644 (file)
@@ -1,3 +1,12 @@
+2010-10-08  Joseph Myers  <joseph@codesourcery.com>
+
+       * c-common.c (parse_optimize_options): Call
+       decode_cmdline_options_to_array_default_mask before
+       decode_options.  Update arguments to decode_options.
+       * c-common.h (c_common_init_options_struct): Declare.
+       * c-opts.c (c_common_init_options_struct): New.  Split out from
+       c_common_init_options.
+
 2010-10-06  Nicola Pero  <nicola.pero@meta-innovation.com>
 
        Implemented fast enumeration for Objective-C.
index ddac821e8c564714a2e6b6c712de94d7ab8bf362..ff3526b03c307508d7f413393b0e77992e8d77ae 100644 (file)
@@ -7802,8 +7802,11 @@ parse_optimize_options (tree args, bool attr_p)
   saved_flag_strict_aliasing = flag_strict_aliasing;
 
   /* Now parse the options.  */
-  decode_options (opt_argc, opt_argv, &decoded_options,
-                 &decoded_options_count);
+  decode_cmdline_options_to_array_default_mask (opt_argc, opt_argv,
+                                               &decoded_options,
+                                               &decoded_options_count);
+  decode_options (&global_options, &global_options_set,
+                 decoded_options, decoded_options_count);
 
   targetm.override_options_after_change();
 
index 5c35465b1cb8d5dbd298f0b126d60360955c44c7..3236e856a09bffc1d1e186fe7e4522de5a9fa35c 100644 (file)
@@ -743,6 +743,7 @@ extern tree build_va_arg (location_t, tree, tree);
 extern unsigned int c_common_option_lang_mask (void);
 extern void c_common_initialize_diagnostics (diagnostic_context *);
 extern bool c_common_complain_wrong_lang_p (const struct cl_option *);
+extern void c_common_init_options_struct (struct gcc_options *);
 extern void c_common_init_options (unsigned int, struct cl_decoded_option *);
 extern bool c_common_post_options (const char **);
 extern bool c_common_init (void);
index b7bf295f80cc4195dd88e08f060665c64b789703..3df0492788e9924eb90c3fe0c2f7ee922a6f062e 100644 (file)
@@ -273,6 +273,19 @@ c_common_complain_wrong_lang_p (const struct cl_option *option)
   return true;
 }
 
+/* Initialize options structure OPTS.  */
+void
+c_common_init_options_struct (struct gcc_options *opts)
+{
+  opts->x_flag_exceptions = c_dialect_cxx ();
+  opts->x_warn_pointer_arith = c_dialect_cxx ();
+  opts->x_warn_write_strings = c_dialect_cxx ();
+  opts->x_flag_warn_unused_result = true;
+
+  /* By default, C99-like requirements for complex multiply and divide.  */
+  opts->x_flag_complex_method = 2;
+}
+
 /* Common initialization before calling option handlers.  */
 void
 c_common_init_options (unsigned int decoded_options_count,
@@ -294,14 +307,6 @@ c_common_init_options (unsigned int decoded_options_count,
      before passing on command-line options to cpplib.  */
   cpp_opts->warn_dollars = 0;
 
-  flag_exceptions = c_dialect_cxx ();
-  warn_pointer_arith = c_dialect_cxx ();
-  warn_write_strings = c_dialect_cxx();
-  flag_warn_unused_result = true;
-
-  /* By default, C99-like requirements for complex multiply and divide.  */
-  flag_complex_method = 2;
-
   deferred_opts = XNEWVEC (struct deferred_opt, decoded_options_count);
 
   if (c_language == clk_c)
index 4bc5bb38a2acb410840728bba32f1ecc631d4263..dbbd50a729de296a32057e69601120c029134cce 100644 (file)
@@ -33,6 +33,8 @@ along with GCC; see the file COPYING3.  If not see
 #define LANG_HOOKS_OPTION_LANG_MASK c_common_option_lang_mask
 #undef LANG_HOOKS_COMPLAIN_WRONG_LANG_P
 #define LANG_HOOKS_COMPLAIN_WRONG_LANG_P c_common_complain_wrong_lang_p
+#undef LANG_HOOKS_INIT_OPTIONS_STRUCT
+#define LANG_HOOKS_INIT_OPTIONS_STRUCT c_common_init_options_struct
 #undef LANG_HOOKS_INIT_OPTIONS
 #define LANG_HOOKS_INIT_OPTIONS c_common_init_options
 #undef LANG_HOOKS_INITIALIZE_DIAGNOSTICS
index 4bb648d44773879e06d7f2a81202ec597f9b0f50..b0e40c15f5d890872f736ca7849f4df5c8e1e903 100644 (file)
@@ -32,6 +32,29 @@ int optimize
 Variable
 int optimize_size
 
+; 0 means straightforward implementation of complex divide acceptable.
+; 1 means wide ranges of inputs must work for complex divide.
+; 2 means C99-like requirements for complex multiply and divide.
+Variable
+int flag_complex_method = 1
+
+; Nonzero if subexpressions must be evaluated from left-to-right.
+Variable
+int flag_evaluation_order = 0
+
+; Set the default region and algorithm for the integrated register
+; allocator.
+
+Variable
+enum ira_algorithm flag_ira_algorithm = IRA_ALGORITHM_CB
+
+Variable
+enum ira_region flag_ira_region = IRA_REGION_MIXED
+
+; Language specific warning pass for unused results.
+Variable
+bool flag_warn_unused_result = false
+
 ###
 Driver
 
index 68cb29e2eefdbb7d643a163d055af9b0d269d643..27962d5402f3a35044e686a1af5039caa6f10824 100755 (executable)
@@ -10843,7 +10843,7 @@ tmake_file="${tmake_file_}"
 out_object_file=`basename $out_file .c`.o
 
 tm_file_list="options.h"
-tm_include_list="options.h insn-constants.h"
+tm_include_list="flags.h insn-constants.h"
 for f in $tm_file; do
   case $f in
     ./* )
index 9dd9c5d086ac7013f096f096e96957d8c46b7da3..1534f7ff149bedf5a1ed7f50a8c195bcb6498fd5 100644 (file)
@@ -1609,7 +1609,7 @@ tmake_file="${tmake_file_}"
 out_object_file=`basename $out_file .c`.o
 
 tm_file_list="options.h"
-tm_include_list="options.h insn-constants.h"
+tm_include_list="flags.h insn-constants.h"
 for f in $tm_file; do
   case $f in
     ./* )
index b243c5a46892b2dcdbb94bbbba5a75753a4bf8f1..c3beeaf0ece69be38366664010327bd7471b342c 100644 (file)
@@ -1,3 +1,7 @@
+2010-10-08  Joseph Myers  <joseph@codesourcery.com>
+
+       * cp-objcp-common.h (LANG_HOOKS_INIT_OPTIONS_STRUCT): Define.
+
 2010-10-07  Nicola Pero  <nicola.pero@meta-innovation.com>
 
        * cp-tree.def: Changed type of AT_ENCODE_EXPR from tcc_unary to
index 2391faf2239e5f3c25656ec66364f92e98336d74..6566a28b0edecb82d1fbc977d2bba9a56c69f5ec 100644 (file)
@@ -45,6 +45,8 @@ extern bool cp_function_decl_explicit_p (tree decl);
 #define LANG_HOOKS_OPTION_LANG_MASK c_common_option_lang_mask
 #undef LANG_HOOKS_COMPLAIN_WRONG_LANG_P
 #define LANG_HOOKS_COMPLAIN_WRONG_LANG_P c_common_complain_wrong_lang_p
+#undef LANG_HOOKS_INIT_OPTIONS_STRUCT
+#define LANG_HOOKS_INIT_OPTIONS_STRUCT c_common_init_options_struct
 #undef LANG_HOOKS_INIT_OPTIONS
 #define LANG_HOOKS_INIT_OPTIONS c_common_init_options
 #undef LANG_HOOKS_INITIALIZE_DIAGNOSTICS
index 6e7e112e45bea0378f7b501efa59167683b3357a..99b69812e8d1ca11ca90366bd1a03b58fd6d533e 100644 (file)
@@ -23,7 +23,8 @@ along with GCC; see the file COPYING3.  If not see
 #define GCC_FLAGS_H
 
 #include "coretypes.h"
-#include "options.h"
+
+#if !defined(IN_LIBGCC2) && !defined(IN_TARGET_LIBS) && !defined(IN_RTS)
 
 enum debug_info_type
 {
@@ -147,12 +148,6 @@ extern int flag_print_asm_name;
 \f
 /* Now the symbols that are set with `-f' switches.  */
 
-/* 0 means straightforward implementation of complex divide acceptable.
-   1 means wide ranges of inputs must work for complex divide.
-   2 means C99-like requirements for complex multiply and divide.  */
-
-extern int flag_complex_method;
-
 /* Nonzero if we are only using compiler to check syntax errors.  */
 
 extern int rtl_dump_and_exit;
@@ -201,8 +196,6 @@ enum ira_algorithm
   IRA_ALGORITHM_PRIORITY
 };
 
-extern enum ira_algorithm flag_ira_algorithm;
-
 /* The regions used for the integrated register allocator (IRA).  */
 enum ira_region
 {
@@ -211,8 +204,6 @@ enum ira_region
   IRA_REGION_MIXED
 };
 
-extern enum ira_region flag_ira_region;
-
 /* The options for excess precision.  */
 enum excess_precision
 {
@@ -269,12 +260,6 @@ extern struct target_flag_state *this_target_flag_state;
 #define flag_excess_precision \
   (this_target_flag_state->x_flag_excess_precision)
 
-/* Nonzero if subexpressions must be evaluated from left-to-right.  */
-extern int flag_evaluation_order;
-
-/* Whether to run the warn_unused_result attribute pass.  */
-extern bool flag_warn_unused_result;
-
 /* Nonzero if we dump in VCG format, not plain text.  */
 extern int dump_for_graph;
 
@@ -369,4 +354,10 @@ enum warn_strict_overflow_code
 /* Whether to emit an overflow warning whose code is C.  */
 #define issue_strict_overflow_warning(c) (warn_strict_overflow >= (int) (c))
 
+#endif
+
+/* This is included last because options may use types declared
+   above.  */
+#include "options.h"
+
 #endif /* ! GCC_FLAGS_H */
index 641807fac3e977982d7c5776f7fc037a309c351a..3a2af6704b14b916e66527b99131d2907cf4411c 100644 (file)
@@ -1,3 +1,10 @@
+2010-10-08  Joseph Myers  <joseph@codesourcery.com>
+
+       * f95-lang.c (LANG_HOOKS_INIT_OPTIONS_STRUCT): Define.
+       * gfortran.h (gfc_init_options_struct): Declare.
+       * options.c (gfc_init_options_struct): New.  Split out from
+       gfc_init_options.
+
 2010-10-07  Janus Weil  <janus@gcc.gnu.org>
 
        PR fortran/45933
index f20e42211ee36ce02d5f7a499abb4ceb82d72030..57696e5a2b74428e8b0a3adabbb1d61600d3d90e 100644 (file)
@@ -102,6 +102,7 @@ static void gfc_init_ts (void);
 #undef LANG_HOOKS_FINISH
 #undef LANG_HOOKS_WRITE_GLOBALS
 #undef LANG_HOOKS_OPTION_LANG_MASK
+#undef LANG_HOOKS_INIT_OPTIONS_STRUCT
 #undef LANG_HOOKS_INIT_OPTIONS
 #undef LANG_HOOKS_HANDLE_OPTION
 #undef LANG_HOOKS_POST_OPTIONS
@@ -132,6 +133,7 @@ static void gfc_init_ts (void);
 #define LANG_HOOKS_FINISH               gfc_finish
 #define LANG_HOOKS_WRITE_GLOBALS       gfc_write_global_declarations
 #define LANG_HOOKS_OPTION_LANG_MASK    gfc_option_lang_mask
+#define LANG_HOOKS_INIT_OPTIONS_STRUCT  gfc_init_options_struct
 #define LANG_HOOKS_INIT_OPTIONS         gfc_init_options
 #define LANG_HOOKS_HANDLE_OPTION        gfc_handle_option
 #define LANG_HOOKS_POST_OPTIONS                gfc_post_options
index a2287a5ca1e4d18f0c474c1cb998f5d1a055db49..8a415f40196d32d7cdd04c5757cba3806fe69a83 100644 (file)
@@ -2398,6 +2398,7 @@ int get_c_kind (const char *, CInteropKind_t *);
 
 /* options.c */
 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,
index b36dd7283ecc839b38fb911c262be686680bb34d..a65a63ab48cbd4ca4b5207d263d44568abb6ff82 100644 (file)
@@ -62,6 +62,14 @@ gfc_option_lang_mask (void)
   return CL_Fortran;
 }
 
+/* Initialize options structure OPTS.  */
+
+void
+gfc_init_options_struct (struct gcc_options *opts)
+{
+  opts->x_flag_errno_math = 0;
+  opts->x_flag_associative_math = -1;
+}
 
 /* Get ready for options handling. Keep in sync with
    libgfortran/runtime/compile_options.c (init_compile_options). */
@@ -145,14 +153,8 @@ gfc_init_options (unsigned int decoded_options_count,
   gfc_option.rtcheck = 0;
   gfc_option.coarray = GFC_FCOARRAY_NONE;
 
-  flag_errno_math = 0;
-  flag_associative_math = -1;
-
   set_default_std_flags ();
 
-  /* -fshort-enums can be default on some targets.  */
-  flag_short_enums = targetm.default_short_enums ();
-
   /* Initialize cpp-related options.  */
   gfc_cpp_init_options (decoded_options_count, decoded_options);
 }
index 7005c5c59aa7120c536cc3dc644bcee0219bf7be..cde61aff9ab83dd6cdcc75ae55289b2a99ba0f51 100644 (file)
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -6135,6 +6135,8 @@ main (int argc, char **argv)
   if (argv != old_argv)
     at_file_supplied = true;
 
+  global_options = global_options_init;
+
   decode_cmdline_options_to_array (argc, CONST_CAST2 (const char **, char **,
                                                      argv),
                                   CL_DRIVER,
index 0d155a8b1c5226583fcafa835d36e9982147c393..1c737c641803df5a6ff6e395dc7fd3076279ca20 100644 (file)
@@ -1,3 +1,9 @@
+2010-10-08  Joseph Myers  <joseph@codesourcery.com>
+
+       * lang.c (java_init_options_struct): New.  Split out from
+       java_init_options.
+       (LANG_HOOKS_INIT_OPTIONS_STRUCT): Define.
+
 2010-10-04  Andi Kleen <ak@linux.intel.com>
 
        * Make-lang.in (xgcj, jc1, jcf-dump, jvgenmain):
index 78f9715bb826c09aeb8cc6f38be603a3507892c4..fbe25ad2e5e224903b1115ac4b9bc6632a1897f9 100644 (file)
@@ -48,6 +48,7 @@ The Free Software Foundation is independent of Sun Microsystems, Inc.  */
 static bool java_init (void);
 static void java_finish (void);
 static unsigned int java_option_lang_mask (void);
+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 **);
 
@@ -126,6 +127,8 @@ struct GTY(()) language_function {
 #define LANG_HOOKS_FINISH java_finish
 #undef LANG_HOOKS_OPTION_LANG_MASK
 #define LANG_HOOKS_OPTION_LANG_MASK java_option_lang_mask
+#undef LANG_HOOKS_INIT_OPTIONS_STRUCT
+#define LANG_HOOKS_INIT_OPTIONS_STRUCT java_init_options_struct
 #undef LANG_HOOKS_INIT_OPTIONS
 #define LANG_HOOKS_INIT_OPTIONS java_init_options
 #undef LANG_HOOKS_HANDLE_OPTION
@@ -535,23 +538,29 @@ java_option_lang_mask (void)
   return CL_Java;
 }
 
+/* Initialize options structure OPTS.  */
+
 static void
-java_init_options (unsigned int decoded_options_count ATTRIBUTE_UNUSED,
-                  struct cl_decoded_option *decoded_options ATTRIBUTE_UNUSED)
+java_init_options_struct (struct gcc_options *opts)
 {
-  flag_bounds_check = 1;
-  flag_exceptions = 1;
-  flag_non_call_exceptions = 1;
+  opts->x_flag_bounds_check = 1;
+  opts->x_flag_exceptions = 1;
+  opts->x_flag_non_call_exceptions = 1;
 
   /* In Java floating point operations never trap.  */
-  flag_trapping_math = 0;
+  opts->x_flag_trapping_math = 0;
 
   /* In Java arithmetic overflow always wraps around.  */
-  flag_wrapv = 1;
+  opts->x_flag_wrapv = 1;
 
   /* Java requires left-to-right evaluation of subexpressions.  */
-  flag_evaluation_order = 1;
+  opts->x_flag_evaluation_order = 1;
+}
 
+static void
+java_init_options (unsigned int decoded_options_count ATTRIBUTE_UNUSED,
+                  struct cl_decoded_option *decoded_options ATTRIBUTE_UNUSED)
+{
   jcf_path_init ();
 }
 
index fa18eed9fb7fcf1041a3b4b3c0732917198d4a42..469cc46cbce0bf4d715db4057f9ff1f15ccc7833 100644 (file)
@@ -65,6 +65,7 @@ extern tree lhd_builtin_function (tree);
 
 /* Declarations of default tree inlining hooks.  */
 extern void lhd_initialize_diagnostics (diagnostic_context *);
+extern void lhd_init_options_struct (struct gcc_options *);
 extern void lhd_init_options (unsigned int,
                              struct cl_decoded_option *);
 extern bool lhd_complain_wrong_lang_p (const struct cl_option *);
@@ -87,6 +88,7 @@ extern void lhd_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *,
 #define LANG_HOOKS_FINISH              lhd_do_nothing
 #define LANG_HOOKS_PARSE_FILE          lhd_do_nothing_i
 #define LANG_HOOKS_OPTION_LANG_MASK    hook_uint_void_0
+#define LANG_HOOKS_INIT_OPTIONS_STRUCT lhd_init_options_struct
 #define LANG_HOOKS_INIT_OPTIONS                lhd_init_options
 #define LANG_HOOKS_INITIALIZE_DIAGNOSTICS lhd_initialize_diagnostics
 #define LANG_HOOKS_COMPLAIN_WRONG_LANG_P lhd_complain_wrong_lang_p
@@ -262,6 +264,7 @@ extern void lhd_end_section (void);
   LANG_HOOKS_FREE_LANG_DATA, \
   LANG_HOOKS_TREE_SIZE, \
   LANG_HOOKS_OPTION_LANG_MASK, \
+  LANG_HOOKS_INIT_OPTIONS_STRUCT, \
   LANG_HOOKS_INIT_OPTIONS, \
   LANG_HOOKS_INITIALIZE_DIAGNOSTICS, \
   LANG_HOOKS_COMPLAIN_WRONG_LANG_P, \
index 76c066bfaa3793ec1044e7ce50fadc3353e32c44..2217a248a738eeef5b7a694c98136df83a8c2c6a 100644 (file)
@@ -337,6 +337,12 @@ lhd_initialize_diagnostics (diagnostic_context *ctx ATTRIBUTE_UNUSED)
 {
 }
 
+/* Called to perform language-specific options initialization of OPTS.  */
+void
+lhd_init_options_struct (struct gcc_options *opts ATTRIBUTE_UNUSED)
+{
+}
+
 /* Called to perform language-specific options initialization.  */
 void
 lhd_init_options (unsigned int decoded_options_count ATTRIBUTE_UNUSED,
index 0c8a982c67391d09da08a2cbea57c5123807273c..1af12be3b51ce3221a8702a8dc4ec233cde58458 100644 (file)
@@ -267,8 +267,12 @@ struct lang_hooks
      of options.  */
   unsigned int (*option_lang_mask) (void);
 
+  /* Initialize variables in an options structure.  */
+  void (*init_options_struct) (struct gcc_options *opts);
+
   /* After the initialize_diagnostics hook is called, do any simple
-     initialization needed before any calls to handle_option.  */
+     initialization needed before any calls to handle_option, other
+     than that done by the init_options_struct hook.  */
   void (*init_options) (unsigned int decoded_options_count,
                        struct cl_decoded_option *decoded_options);
 
index ea393ba6a38d840b87a3de94d82e8501eb813a91..d901164eb7f1a114ae656b795926347ba31d2d57 100644 (file)
@@ -1,3 +1,10 @@
+2010-10-08  Joseph Myers  <joseph@codesourcery.com>
+
+       * lto-lang.c (lto_init_options): Change to
+       lto_init_options_struct.  Update parameters.
+       (LANG_HOOKS_INIT_OPTIONS): Don't define.
+       (LANG_HOOKS_INIT_OPTIONS_STRUCT): Define.
+
 2010-10-06  Jan Hubicka  <jh@suse.cz>
 
        * lto.c (lto_balanced_map): Fix accounting of program size.
index f7c0bfeb51be44e6ae9e435836907b789362466d..eeebe05efb0dfd3cda82c2e2aafd67926899a5a3 100644 (file)
@@ -639,14 +639,13 @@ lto_complain_wrong_lang_p (const struct cl_option *option ATTRIBUTE_UNUSED)
 }
 
 static void
-lto_init_options (unsigned int decoded_options_count ATTRIBUTE_UNUSED,
-                 struct cl_decoded_option *decoded_options ATTRIBUTE_UNUSED)
+lto_init_options_struct (struct gcc_options *opts)
 {
   /* By default, C99-like requirements for complex multiply and divide.
      ???  Until the complex method is encoded in the IL this is the only
      safe choice.  This will pessimize Fortran code with LTO unless
      people specify a complex method manually or use -ffast-math.  */
-  flag_complex_method = 2;
+  opts->x_flag_complex_method = 2;
 }
 
 /* Handle command-line option SCODE.  If the option takes an argument, it is
@@ -1162,8 +1161,8 @@ static void lto_init_ts (void)
 #define LANG_HOOKS_OPTION_LANG_MASK lto_option_lang_mask
 #undef LANG_HOOKS_COMPLAIN_WRONG_LANG_P
 #define LANG_HOOKS_COMPLAIN_WRONG_LANG_P lto_complain_wrong_lang_p
-#undef LANG_HOOKS_INIT_OPTIONS
-#define LANG_HOOKS_INIT_OPTIONS lto_init_options
+#undef LANG_HOOKS_INIT_OPTIONS_STRUCT
+#define LANG_HOOKS_INIT_OPTIONS_STRUCT lto_init_options_struct
 #undef LANG_HOOKS_HANDLE_OPTION
 #define LANG_HOOKS_HANDLE_OPTION lto_handle_option
 #undef LANG_HOOKS_POST_OPTIONS
index 643ad159a99a7177c7e64f44c99d9b093f480071..ba2238aeebfbc6ea6048ba8fc773b76ea943e2e5 100644 (file)
@@ -83,7 +83,7 @@ print "#endif /* GCC_DRIVER */"
 print ""
 
 have_save = 0;
-print "struct gcc_options global_options =\n{"
+print "const struct gcc_options global_options_init =\n{"
 for (i = 0; i < n_extra_vars; i++) {
        var = extra_vars[i]
        init = extra_vars[i]
@@ -138,6 +138,7 @@ for (i = 0; i < n_opts; i++) {
 }
 print "};"
 print ""
+print "struct gcc_options global_options;"
 print "struct gcc_options global_options_set;"
 print ""
 
index 99b5cff29f9ea8922ea5de17b59bb446a8e91b3e..789f9bf3486d30d9550152c8436457927efaf9d8 100644 (file)
@@ -73,6 +73,7 @@ print ""
 
 have_save = 0;
 
+print "#if !defined(IN_LIBGCC2) && !defined(IN_TARGET_LIBS) && !defined(IN_RTS)"
 print "#ifndef GENERATOR_FILE"
 print "struct gcc_options\n{"
 print "#endif"
@@ -125,9 +126,11 @@ for (i = 0; i < n_opts; i++) {
 print "#ifndef GENERATOR_FILE"
 print "};"
 print "extern struct gcc_options global_options;"
+print "extern const struct gcc_options global_options_init;"
 print "extern struct gcc_options global_options_set;"
 print "#define target_flags_explicit global_options_set.x_target_flags"
 print "#endif"
+print "#endif"
 print ""
 
 # All of the optimization switches gathered together so they can be saved and restored.
index a5f66ce45faafad821f5c7b6fe6e64143b3ab024..553e8b19b89855067ad442700096ae2111e6db24 100644 (file)
@@ -22,7 +22,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "intl.h"
 #include "coretypes.h"
 #include "opts.h"
-#include "options.h"
+#include "flags.h"
 #include "diagnostic.h"
 #include "tm.h" /* For SWITCH_TAKES_ARG, WORD_SWITCH_TAKES_ARG and
                   TARGET_OPTION_TRANSLATE_TABLE.  */
index 03098b5377202773337914ea6ff69ace580f1706..efee21e23235c02f6944dfb3583e1fd59e262f4f 100644 (file)
@@ -353,9 +353,6 @@ DEF_VEC_ALLOC_P(const_char_p,heap);
 
 static VEC(const_char_p,heap) *ignored_options;
 
-/* Language specific warning pass for unused results.  */
-bool flag_warn_unused_result = false;
-
 /* Input file names.  */
 const char **in_fnames;
 unsigned num_in_fnames;
@@ -613,11 +610,14 @@ flag_instrument_functions_exclude_p (tree fndecl)
 }
 
 
-/* Handle the vector of command line options.  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, 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.  */
 static void
-read_cmdline_options (struct cl_decoded_option *decoded_options,
+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)
@@ -628,6 +628,11 @@ read_cmdline_options (struct cl_decoded_option *decoded_options,
     {
       if (decoded_options[i].opt_index == OPT_SPECIAL_input_file)
        {
+         /* Input files should only ever appear on the main command
+            line.  */
+         gcc_assert (opts == &global_options);
+         gcc_assert (opts_set == &global_options_set);
+
          if (main_input_filename == NULL)
            {
              main_input_filename = decoded_options[i].arg;
@@ -638,76 +643,104 @@ read_cmdline_options (struct cl_decoded_option *decoded_options,
          continue;
        }
 
-      read_cmdline_option (&global_options, &global_options_set,
+      read_cmdline_option (opts, opts_set,
                           decoded_options + i, lang_mask, handlers,
                           global_dc);
     }
 }
 
-/* Parse command line options and set default flag values.  Do minimal
-   options processing.  The decoded options are placed in *DECODED_OPTIONS
-   and *DECODED_OPTIONS_COUNT.  */
+/* Language mask determined at initialization.  */
+static unsigned int initial_lang_mask;
+
+/* Initial values of parameters we reset.  */
+static int initial_min_crossjump_insns;
+static int initial_max_fields_for_field_sensitive;
+static int initial_loop_invariant_max_bbs_in_loop;
+
+/* Initialize global options-related settings at start-up.  */
+
 void
-decode_options (unsigned int argc, const char **argv,
-               struct cl_decoded_option **decoded_options,
-               unsigned int *decoded_options_count)
+init_options_once (void)
 {
-  static bool first_time_p = true;
-  static int initial_min_crossjump_insns;
-  static int initial_max_fields_for_field_sensitive;
-  static int initial_loop_invariant_max_bbs_in_loop;
-  static unsigned int initial_lang_mask;
-  struct cl_option_handlers handlers;
+  /* Perform language-specific options initialization.  */
+  initial_lang_mask = lang_hooks.option_lang_mask ();
+
+  lang_hooks.initialize_diagnostics (global_dc);
+
+  /* Save initial values of parameters we reset.  */
+  initial_min_crossjump_insns
+    = compiler_params[PARAM_MIN_CROSSJUMP_INSNS].value;
+  initial_max_fields_for_field_sensitive
+    = compiler_params[PARAM_MAX_FIELDS_FOR_FIELD_SENSITIVE].value;
+  initial_loop_invariant_max_bbs_in_loop
+    = compiler_params[PARAM_LOOP_INVARIANT_MAX_BBS_IN_LOOP].value;
+}
 
-  unsigned int i, lang_mask;
+/* Initialize OPTS and OPTS_SET before using them in parsing options.  */
+
+void
+init_options_struct (struct gcc_options *opts, struct gcc_options *opts_set)
+{
+  *opts = global_options_init;
+  memset (opts_set, 0, sizeof (*opts_set));
+
+  /* Use priority coloring if cover classes is not defined for the
+     target.  */
+  if (targetm.ira_cover_classes == NULL)
+    opts->x_flag_ira_algorithm = IRA_ALGORITHM_PRIORITY;
+
+  /* Initialize whether `char' is signed.  */
+  opts->x_flag_signed_char = DEFAULT_SIGNED_CHAR;
+  /* Set this to a special "uninitialized" value.  The actual default
+     is set after target options have been processed.  */
+  opts->x_flag_short_enums = 2;
+
+  /* Initialize target_flags before targetm.target_option.optimization
+     so the latter can modify it.  */
+  opts->x_target_flags = targetm.default_target_flags;
+
+  /* Some targets have ABI-specified unwind tables.  */
+  opts->x_flag_unwind_tables = targetm.unwind_tables_default;
+}
+
+/* Decode command-line options to an array, like
+   decode_cmdline_options_to_array and with the same arguments but
+   using the default lang_mask.  */
+
+void
+decode_cmdline_options_to_array_default_mask (unsigned int argc,
+                                             const char **argv, 
+                                             struct cl_decoded_option **decoded_options,
+                                             unsigned int *decoded_options_count)
+{
+  decode_cmdline_options_to_array (argc, argv,
+                                  initial_lang_mask | CL_COMMON | CL_TARGET,
+                                  decoded_options, decoded_options_count);
+}
+
+/* Default the options in OPTS and OPTS_SET based on the optimization
+   settings in DECODED_OPTIONS and DECODED_OPTIONS_COUNT.  */
+static void
+default_options_optimization (struct gcc_options *opts,
+                             struct gcc_options *opts_set,
+                             struct cl_decoded_option *decoded_options,
+                             unsigned int decoded_options_count)
+{
+  unsigned int i;
   int opt1;
   int opt2;
   int opt3;
   int opt1_max;
   int ofast = 0;
-  enum unwind_info_type ui_except;
-
-  if (first_time_p)
-    {
-      /* Perform language-specific options initialization.  */
-      initial_lang_mask = lang_mask = lang_hooks.option_lang_mask ();
-
-      lang_hooks.initialize_diagnostics (global_dc);
-
-      /* Save initial values of parameters we reset.  */
-      initial_min_crossjump_insns
-       = compiler_params[PARAM_MIN_CROSSJUMP_INSNS].value;
-      initial_max_fields_for_field_sensitive
-       = compiler_params[PARAM_MAX_FIELDS_FOR_FIELD_SENSITIVE].value;
-      initial_loop_invariant_max_bbs_in_loop
-       = compiler_params[PARAM_LOOP_INVARIANT_MAX_BBS_IN_LOOP].value;
-    }
-  else
-    lang_mask = initial_lang_mask;
-
-  decode_cmdline_options_to_array (argc, argv,
-                                  lang_mask | CL_COMMON | CL_TARGET,
-                                  decoded_options, decoded_options_count);
-  if (first_time_p)
-    /* Perform language-specific options initialization.  */
-    lang_hooks.init_options (*decoded_options_count, *decoded_options);
 
-  handlers.unknown_option_callback = unknown_option_callback;
-  handlers.wrong_lang_callback = complain_wrong_lang;
-  handlers.post_handling_callback = post_handling_callback;
-  handlers.num_handlers = 3;
-  handlers.handlers[0].handler = lang_handle_option;
-  handlers.handlers[0].mask = lang_mask;
-  handlers.handlers[1].handler = common_handle_option;
-  handlers.handlers[1].mask = CL_COMMON;
-  handlers.handlers[2].handler = target_handle_option;
-  handlers.handlers[2].mask = CL_TARGET;
+  gcc_assert (opts == &global_options);
+  gcc_assert (opts_set = &global_options_set);
 
   /* Scan to see what optimization level has been specified.  That will
      determine the default value of many flags.  */
-  for (i = 1; i < *decoded_options_count; i++)
+  for (i = 1; i < decoded_options_count; i++)
     {
-      struct cl_decoded_option *opt = &(*decoded_options)[i];
+      struct cl_decoded_option *opt = &decoded_options[i];
       switch (opt->opt_index)
        {
        case OPT_O:
@@ -755,11 +788,6 @@ decode_options (unsigned int argc, const char **argv,
        }
     }
 
-  /* Use priority coloring if cover classes is not defined for the
-     target.  */
-  if (targetm.ira_cover_classes == NULL)
-    flag_ira_algorithm = IRA_ALGORITHM_PRIORITY;
-
   /* -O1 optimizations.  */
   opt1 = (optimize >= 1);
   flag_defer_pop = opt1;
@@ -879,38 +907,68 @@ decode_options (unsigned int argc, const char **argv,
       targetm.handle_ofast ();
     }
 
+  /* Allow default optimizations to be specified on a per-machine basis.  */
+  targetm.target_option.optimization (optimize, optimize_size);
+}
+
+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.  */
+void
+decode_options (struct gcc_options *opts, struct gcc_options *opts_set,
+               struct cl_decoded_option *decoded_options,
+               unsigned int decoded_options_count)
+{
+  struct cl_option_handlers handlers;
+
+  unsigned int lang_mask;
+
+  lang_mask = initial_lang_mask;
+
+  handlers.unknown_option_callback = unknown_option_callback;
+  handlers.wrong_lang_callback = complain_wrong_lang;
+  handlers.post_handling_callback = post_handling_callback;
+  handlers.num_handlers = 3;
+  handlers.handlers[0].handler = lang_handle_option;
+  handlers.handlers[0].mask = lang_mask;
+  handlers.handlers[1].handler = common_handle_option;
+  handlers.handlers[1].mask = CL_COMMON;
+  handlers.handlers[2].handler = target_handle_option;
+  handlers.handlers[2].mask = CL_TARGET;
+
   /* Enable -Werror=coverage-mismatch by default */
   enable_warning_as_error ("coverage-mismatch", 1, lang_mask, &handlers,
                           global_dc);
 
-  if (first_time_p)
-    {
-      /* Initialize whether `char' is signed.  */
-      flag_signed_char = DEFAULT_SIGNED_CHAR;
-      /* Set this to a special "uninitialized" value.  The actual default is
-        set after target options have been processed.  */
-      flag_short_enums = 2;
-
-      /* Initialize target_flags before
-        targetm.target_option.optimization so the latter can modify
-        it.  */
-      target_flags = targetm.default_target_flags;
-
-      /* Some targets have ABI-specified unwind tables.  */
-      flag_unwind_tables = targetm.unwind_tables_default;
-    }
+  default_options_optimization (opts, opts_set,
+                               decoded_options, decoded_options_count);
 
 #ifdef ENABLE_LTO
   /* Clear any options currently held for LTO.  */
   lto_clear_user_options ();
 #endif
 
-  /* Allow default optimizations to be specified on a per-machine basis.  */
-  targetm.target_option.optimization (optimize, optimize_size);
-
-  read_cmdline_options (*decoded_options, *decoded_options_count, lang_mask,
+  read_cmdline_options (opts, opts_set,
+                       decoded_options, decoded_options_count, lang_mask,
                        &handlers);
 
+  finish_options (opts, opts_set);
+}
+
+/* After all options have been read into OPTS and OPTS_SET, finalize
+   settings of those options and diagnose incompatible
+   combinations.  */
+static void
+finish_options (struct gcc_options *opts, struct gcc_options *opts_set)
+{
+  static bool first_time_p = true;
+  enum unwind_info_type ui_except;
+
+  gcc_assert (opts == &global_options);
+  gcc_assert (opts_set = &global_options_set);
+
   if (dump_base_name && ! IS_ABSOLUTE_PATH (dump_base_name))
     {
       /* First try to make DUMP_BASE_NAME relative to the DUMP_DIR_NAME
index fbfe6bf34479c9f548ed1b509809a901023f1434..a1ab4cb6ca9fd757eca34ecf979a31add1d3932f 100644 (file)
@@ -208,9 +208,17 @@ extern void decode_cmdline_options_to_array (unsigned int argc,
                                             unsigned int lang_mask,
                                             struct cl_decoded_option **decoded_options,
                                             unsigned int *decoded_options_count);
-extern void decode_options (unsigned int argc, const char **argv,
-                           struct cl_decoded_option **decoded_options,
-                           unsigned int *decoded_options_count);
+extern void init_options_once (void);
+extern void init_options_struct (struct gcc_options *opts,
+                                struct gcc_options *opts_set);
+extern void decode_cmdline_options_to_array_default_mask (unsigned int argc,
+                                                         const char **argv, 
+                                                         struct cl_decoded_option **decoded_options,
+                                                         unsigned int *decoded_options_count);
+extern void decode_options (struct gcc_options *opts,
+                           struct gcc_options *opts_set,
+                           struct cl_decoded_option *decoded_options,
+                           unsigned int decoded_options_count);
 extern int option_enabled (int opt_idx, void *opts);
 extern bool get_option_state (struct gcc_options *, int,
                              struct cl_option_state *);
index 80487f63f0081c79ff0ad182d66ea97420fc8117..a6c13f11e6aca179ba09a0b91b6a36497565cfb8 100644 (file)
@@ -198,12 +198,6 @@ unsigned local_tick;
 
 /* -f flags.  */
 
-/* 0 means straightforward implementation of complex divide acceptable.
-   1 means wide ranges of inputs must work for complex divide.
-   2 means C99-like requirements for complex multiply and divide.  */
-
-int flag_complex_method = 1;
-
 /* Nonzero means we should be saving declaration info into a .X file.  */
 
 int flag_gen_aux_info = 0;
@@ -229,12 +223,6 @@ int flag_next_runtime = 0;
 
 enum tls_model flag_tls_default = TLS_MODEL_GLOBAL_DYNAMIC;
 
-/* Set the default region and algorithm for the integrated register
-   allocator.  */
-
-enum ira_algorithm flag_ira_algorithm = IRA_ALGORITHM_CB;
-enum ira_region flag_ira_region = IRA_REGION_MIXED;
-
 /* Set the default for excess precision.  */
 
 enum excess_precision flag_excess_precision_cmdline = EXCESS_PRECISION_DEFAULT;
@@ -293,9 +281,6 @@ typedef struct
 }
 lang_independent_options;
 
-/* Nonzero if subexpressions must be evaluated from left-to-right.  */
-int flag_evaluation_order = 0;
-
 /* The user symbol prefix after having resolved same.  */
 const char *user_label_prefix;
 
@@ -1661,8 +1646,10 @@ general_init (const char *argv0)
   /* Set a default printer.  Language specific initializations will
      override it later.  */
   pp_format_decoder (global_dc->printer) = &default_tree_printer;
-  global_dc->show_option_requested = flag_diagnostics_show_option;
-  global_dc->show_column = flag_show_column;
+  global_dc->show_option_requested
+    = global_options_init.x_flag_diagnostics_show_option;
+  global_dc->show_column
+    = global_options_init.x_flag_show_column;
   global_dc->internal_error = plugins_internal_error_function;
   global_dc->option_enabled = option_enabled;
   global_dc->option_state = &global_options;
@@ -2395,10 +2382,29 @@ toplev_main (int argc, char **argv)
   /* Initialization of GCC's environment, and diagnostics.  */
   general_init (argv[0]);
 
+  /* One-off initialization of options that does not need to be
+     repeated when options are added for particular functions.  */
+  init_options_once ();
+
+  /* Initialize global options structures; this must be repeated for
+     each structure used for parsing options.  */
+  init_options_struct (&global_options, &global_options_set);
+  lang_hooks.init_options_struct (&global_options);
+
+  /* Convert the options to an array.  */
+  decode_cmdline_options_to_array_default_mask (argc,
+                                               CONST_CAST2 (const char **,
+                                                            char **, argv),
+                                               &save_decoded_options,
+                                               &save_decoded_options_count);
+
+  /* Perform language-specific options initialization.  */
+  lang_hooks.init_options (save_decoded_options_count, save_decoded_options);
+
   /* Parse the options and do minimal processing; basically just
      enough to default flags appropriately.  */
-  decode_options (argc, CONST_CAST2 (const char **, char **, argv),
-                 &save_decoded_options, &save_decoded_options_count);
+  decode_options (&global_options, &global_options_set,
+                 save_decoded_options, save_decoded_options_count);
 
   init_local_tick ();
 
index 8c7a897203cfd1024189f152960e9624aa426be6..330c84909736e9d3aeee1816fbcdc41d70d0953f 100644 (file)
@@ -32,7 +32,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "real.h"
 #include "fixed-value.h"
 #include "alias.h"
-#include "options.h"
+#include "flags.h"
 
 /* Codes of tree nodes */