c-pch.c (asm_file_name): Remove.
authorNeil Booth <neil@daikokuya.co.uk>
Sun, 15 Jun 2003 08:30:02 +0000 (08:30 +0000)
committerNeil Booth <neil@gcc.gnu.org>
Sun, 15 Jun 2003 08:30:02 +0000 (08:30 +0000)
* c-pch.c (asm_file_name): Remove.
* common.opt: Add more switches.
* flags.h (g_switch_set): Boolify.
* opts.c (g_switch_value, g_switch_set, exit_after_options,
version_flag): Move from toplev.c.
(common_handle_option): Handle more switches from toplev.c.
* toplev.c (display_help, display_target_options, decode_d_option,
print_version): Make non-static, remove prototypes.
(aux_base_name, asm_file_name, aux_info_file_name): Constify.
(version_flag, g_switch_value, g_switch_set, exit_after_options):
Remove.
(independent_decode_option): Move some handlers to opts.c.
* toplev.h (aux_info_file_name, aux_base_name, asm_file_name,
exit_after_options, version_flag, display_help, display_target_options,
print_version, decode_d_option): New.
java:
* lang.c (version_flag): Rename to v_flag to avoid clash w/ toplev.h.

From-SVN: r67971

gcc/ChangeLog
gcc/c-pch.c
gcc/common.opt
gcc/flags.h
gcc/java/ChangeLog
gcc/java/lang.c
gcc/opts.c
gcc/toplev.c
gcc/toplev.h

index 8bd85fa99d63770574f2e16a4e1d8e3b5ebed083..a3c9063d7f9f6595a6b1f6e41f57deac6ea8dd8d 100644 (file)
@@ -1,3 +1,21 @@
+2003-06-15  Neil Booth  <neil@daikokuya.co.uk>
+
+       * c-pch.c (asm_file_name): Remove.
+       * common.opt: Add more switches.
+       * flags.h (g_switch_set): Boolify.
+       * opts.c (g_switch_value, g_switch_set, exit_after_options,
+       version_flag): Move from toplev.c.
+       (common_handle_option): Handle more switches from toplev.c.
+       * toplev.c (display_help, display_target_options, decode_d_option,
+       print_version): Make non-static, remove prototypes.
+       (aux_base_name, asm_file_name, aux_info_file_name): Constify.
+       (version_flag, g_switch_value, g_switch_set, exit_after_options):
+       Remove.
+       (independent_decode_option): Move some handlers to opts.c.
+       * toplev.h (aux_info_file_name, aux_base_name, asm_file_name,
+       exit_after_options, version_flag, display_help, display_target_options,
+       print_version, decode_d_option): New.
+
 2003-06-15  Kazu Hirata  <kazu@cs.umass.edu>
 
        * config/alpha/alpha.md: Follow spelling conventions.
index 354fcc7849b9c23247c1f738eca5b7e6dee68f10..6a2131404c9c1ff8540a5304cb70dcb61f6c64dc 100644 (file)
@@ -46,7 +46,6 @@ struct c_pch_header
 
 static FILE *pch_outfile;
 
-extern char *asm_file_name;
 static long asm_file_startpos;
 
 static const char * get_ident PARAMS((void));
index c3c955e2462359ef4ce6e4d2235a8318798c5936..6c936210ae52f66148c737e3b8324124ab59502e 100644 (file)
 
 ; Please try to keep this file in ASCII collating order.
 
+-help
+Common
+
+-target-help
+Common
+
+-version
+Common
+
+G
+Common Joined Separate
+
+aux-info
+Common Separate
+
+aux-info=
+Common Joined
+
+auxbase
+Common Separate
+
+auxbase-strip
+Common Separate
+
+d
+Common Joined
+
+dumpbase
+Common Separate
+
+o
+Common Joined Separate
+
+p
+Common
+
+pedantic
+Common
+
+pedantic-errors
+Common
+
 quiet
 Common
 
+version
+Common
+
+w
+Common
+
 ; This comment is to ensure we retain the blank line above.
index 766b24dc4d7464a565a03a71ac167bd3775100fc..511312420f47dd0cf80ff2dafb81880390986a16 100644 (file)
@@ -600,7 +600,7 @@ extern int flag_wrapv;
 
 /* Value of the -G xx switch, and whether it was passed or not.  */
 extern unsigned HOST_WIDE_INT g_switch_value;
-extern int g_switch_set;
+extern bool g_switch_set;
 
 /* Values of the -falign-* flags: how much to align labels in code. 
    0 means `use default', 1 means `don't align'.  
index d1827cb6c4afd67d11e766e0769dec6c61248aec..37dacc531a2013c08017125a7fbb2666d9685ddd 100644 (file)
@@ -1,3 +1,7 @@
+2003-06-15  Neil Booth  <neil@daikokuya.co.uk>
+
+       * lang.c (version_flag): Rename to v_flag to avoid clash w/ toplev.h.
+
 2003-06-14  Neil Booth  <neil@daikokuya.co.uk>
 
        * lang-specs.h: Rewrite -MD and -MMD to append an underscore.
index ab5b744fee1a1c7af520ac48e6421eab791174ff..3ac6fd2e883f81f9efac9071fa7b4bc5aabedd5c 100644 (file)
@@ -181,7 +181,7 @@ int flag_indirect_dispatch = 0;
 int flag_store_check = 1;
 
 /* When nonzero, print extra version information.  */
-static int version_flag = 0;
+static int v_flag = 0;
 
 /* Set nonzero if the user specified -finline-functions on the command
    line.  */
@@ -448,7 +448,7 @@ java_handle_option (size_t scode, const char *arg, int value)
       break;
 
     case OPT_version:
-      version_flag = 1;
+      v_flag = 1;
       break;
     }
 
@@ -476,7 +476,7 @@ java_init (void)
       && force_align_functions_log < 1)
     force_align_functions_log = 1;
 
-  jcf_path_seal (version_flag);
+  jcf_path_seal (v_flag);
 
   java_init_decl_processing ();
 
index 99b3298688b4cab89706e6050847282a54b3608b..204cc0d0db38fe154ea4b1cec8898a2031ae142a 100644 (file)
@@ -30,6 +30,16 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "flags.h"
 #include "toplev.h"
 
+/* Value of the -G xx switch, and whether it was passed or not.  */
+unsigned HOST_WIDE_INT g_switch_value;
+bool g_switch_set;
+
+/* True if we should exit after parsing options.  */
+bool exit_after_options;
+
+/* If -version.  */
+bool version_flag;
+
 static size_t find_opt (const char *, int);
 static int common_handle_option (size_t scode, const char *arg, int value);
 
@@ -236,9 +246,82 @@ common_handle_option (size_t scode, const char *arg,
     default:
       abort ();
 
+    case OPT__help:
+      display_help ();
+      exit_after_options = true;
+      break;
+
+    case OPT__target_help:
+      display_target_options ();
+      exit_after_options = true;
+      break;
+
+    case OPT__version:
+      print_version (stderr, "");
+      exit_after_options = true;
+      break;
+
+    case OPT_G:
+      g_switch_value = read_integral_parameter (arg, 0, -1);
+      if (g_switch_value == (unsigned HOST_WIDE_INT) -1)
+       return 0;
+      g_switch_set = true;
+      break;
+
+    case OPT_aux_info:
+    case OPT_aux_info_:
+      aux_info_file_name = arg;
+      flag_gen_aux_info = 1;
+      break;
+
+    case OPT_auxbase:
+      aux_base_name = arg;
+      break;
+
+    case OPT_auxbase_strip:
+      {
+       char *tmp = xstrdup (arg);
+       strip_off_ending (tmp, strlen (tmp));
+       if (tmp[0])
+         aux_base_name = tmp;
+      }
+      break;
+
+    case OPT_d:
+      decode_d_option (arg);
+      break;
+
+    case OPT_dumpbase:
+      dump_base_name = arg;
+      break;
+
+    case OPT_o:
+      asm_file_name = arg;
+      break;
+
+    case OPT_p:
+      profile_flag = 1;
+      break;
+
+    case OPT_pedantic:
+      pedantic = 1;
+      break;
+
+    case OPT_pedantic_errors:
+      flag_pedantic_errors = pedantic = 1;
+      break;
+
     case OPT_quiet:
       quiet_flag = 1;
       break;
+
+    case OPT_version:
+      version_flag = 1;
+      break;
+
+    case OPT_w:
+      inhibit_warnings = 1;
+      break;      
     }
 
   return 1;
index f349f73f5f1464989f875ad50cba48ddbf70f2a8..dc939250f18499333e31d0cb2055a9ed75f97794 100644 (file)
@@ -117,17 +117,14 @@ static void set_target_switch (const char *);
 static void crash_signal (int) ATTRIBUTE_NORETURN;
 static void setup_core_dumping (void);
 static void compile_file (void);
-static void display_help (void);
-static void display_target_options (void);
 
-static void decode_d_option (const char *);
+void decode_d_option (const char *);
 static int decode_f_option (const char *);
 static int decode_W_option (const char *);
 static int decode_g_option (const char *);
 static unsigned int independent_decode_option (int, char **);
 static void set_Wextra (int);
 
-static void print_version (FILE *, const char *);
 static int print_single_switch (FILE *, int, int, const char *,
                                const char *, const char *,
                                const char *, const char *);
@@ -214,7 +211,7 @@ const char *dump_base_name;
 
 /* Name to use as a base for auxiliary output files.  */
 
-static const char *aux_base_name;
+const char *aux_base_name;
 
 /* Format to use to print dumpfile index value */
 #ifndef DUMPFILE_FORMAT
@@ -358,16 +355,11 @@ static void close_dump_file (enum dump_file_index,
 
 int rtl_dump_and_exit;
 int flag_print_asm_name;
-static int version_flag;
 enum graph_dump_types graph_dump_format;
 
 /* Name for output file of assembly code, specified with -o.  */
 
-char *asm_file_name;
-
-/* Value of the -G xx switch, and whether it was passed or not.  */
-unsigned HOST_WIDE_INT g_switch_value;
-int g_switch_set;
+const char *asm_file_name;
 
 /* Type(s) of debugging information we are producing (if any).
    See flags.h for the definitions of the different possible
@@ -400,9 +392,6 @@ int optimize = 0;
 
 int optimize_size = 0;
 
-/* Nonzero if we should exit after parsing options.  */
-static int exit_after_options = 0;
-
 /* The FUNCTION_DECL for the function currently being compiled,
    or 0 if between functions.  */
 tree current_function_decl;
@@ -743,7 +732,7 @@ int flag_gen_aux_info = 0;
 
 /* Specified name of aux-info file.  */
 
-static char *aux_info_file_name;
+const char *aux_info_file_name;
 
 /* Nonzero means make the text shared if supported.  */
 
@@ -4011,7 +4000,7 @@ rest_of_compilation (tree decl)
 }
 
 /* Display help for generic options.  */
-static void
+void
 display_help (void)
 {
   int undoc;
@@ -4145,7 +4134,7 @@ display_help (void)
 }
 
 /* Display help for target options.  */
-static void
+void 
 display_target_options (void)
 {
   int undoc, i;
@@ -4154,6 +4143,7 @@ display_target_options (void)
   /* Avoid double printing for --help --target-help.  */
   if (displayed)
     return;
+
   displayed = true;
 
   if (ARRAY_SIZE (target_switches) > 1
@@ -4217,7 +4207,7 @@ display_target_options (void)
 
 /* Parse a -d... command line switch.  */
 
-static void
+void
 decode_d_option (const char *arg)
 {
   int i, c, matched;
@@ -4597,27 +4587,6 @@ independent_decode_option (int argc, char **argv)
 
   arg++;
 
-  if (!strcmp (arg, "-help"))
-    {
-      display_help ();
-      exit_after_options = 1;
-      return 1;
-    }
-
-  if (!strcmp (arg, "-target-help"))
-    {
-      display_target_options ();
-      exit_after_options = 1;
-      return 1;
-    }
-
-  if (!strcmp (arg, "-version"))
-    {
-      print_version (stderr, "");
-      exit_after_options = 1;
-      return 1;
-    }
-
   /* Handle '--param <name>=<value>'.  */
   if (strcmp (arg, "-param") == 0)
     {
@@ -4671,46 +4640,6 @@ independent_decode_option (int argc, char **argv)
     case 'g':
       return decode_g_option (arg + 1);
 
-    case 'd':
-      if (!strcmp (arg, "dumpbase"))
-       {
-         if (argc == 1)
-           return 0;
-
-         if (argv[1][0])
-           dump_base_name = argv[1];
-
-         return 2;
-       }
-      else
-       decode_d_option (arg + 1);
-      break;
-
-    case 'p':
-      if (!strcmp (arg, "pedantic"))
-       pedantic = 1;
-      else if (!strcmp (arg, "pedantic-errors"))
-       flag_pedantic_errors = pedantic = 1;
-      else if (arg[1] == 0)
-       profile_flag = 1;
-      else
-       return 0;
-      break;
-
-    case 'v':
-      if (!strcmp (arg, "version"))
-       version_flag = 1;
-      else
-       return 0;
-      break;
-
-    case 'w':
-      if (arg[1] == 0)
-       inhibit_warnings = 1;
-      else
-       return 0;
-      break;
-
     case 'W':
       /* For backward compatibility, -W is the same as -Wextra.  */
       if (arg[1] == 0)
@@ -4718,95 +4647,6 @@ independent_decode_option (int argc, char **argv)
       else
        return decode_W_option (arg + 1);
       break;
-
-    case 'a':
-      if (!strncmp (arg, "aux-info", 8))
-       {
-         if (arg[8] == '\0')
-           {
-             if (argc == 1)
-               return 0;
-
-             aux_info_file_name = argv[1];
-             flag_gen_aux_info = 1;
-             return 2;
-           }
-         else if (arg[8] == '=')
-           {
-             aux_info_file_name = arg + 9;
-             flag_gen_aux_info = 1;
-           }
-         else
-           return 0;
-       }
-      else if (!strcmp (arg, "auxbase"))
-       {
-         if (argc == 1)
-           return 0;
-
-         if (argv[1][0])
-           aux_base_name = argv[1];
-
-         return 2;
-       }
-      else if (!strcmp (arg, "auxbase-strip"))
-       {
-         if (argc == 1)
-           return 0;
-
-         if (argv[1][0])
-           {
-             strip_off_ending (argv[1], strlen (argv[1]));
-             if (argv[1][0])
-               aux_base_name = argv[1];
-           }
-
-         return 2;
-       }
-      else
-       return 0;
-      break;
-
-    case 'o':
-      if (arg[1] == 0)
-       {
-         if (argc == 1)
-           return 0;
-
-         asm_file_name = argv[1];
-         return 2;
-       }
-      return 0;
-
-    case 'G':
-      {
-       int g_switch_val;
-       int return_val;
-
-       if (arg[1] == 0)
-         {
-           if (argc == 1)
-             return 0;
-
-           g_switch_val = read_integral_parameter (argv[1], 0, -1);
-           return_val = 2;
-         }
-       else
-         {
-           g_switch_val = read_integral_parameter (arg + 1, 0, -1);
-           return_val = 1;
-         }
-
-       if (g_switch_val == -1)
-         return_val = 0;
-       else
-         {
-           g_switch_set = TRUE;
-           g_switch_value = g_switch_val;
-         }
-
-       return return_val;
-      }
     }
 
   return 1;
@@ -4870,7 +4710,7 @@ set_target_switch (const char *name)
    Each line begins with INDENT (for the case where FILE is the
    assembler output file).  */
 
-static void
+void
 print_version (FILE *file, const char *indent)
 {
 #ifndef __VERSION__
index ef1a705f3a343bcb8352fc9c4ab38f5298b56df7..61bed8b3e857ecaa3e06ada9732e72db80686fef 100644 (file)
@@ -97,9 +97,18 @@ extern void check_global_declarations   (union tree_node **, int);
 
 extern const char *progname;
 extern const char *dump_base_name;
+extern const char *aux_base_name;
+extern const char *aux_info_file_name;
+extern const char *asm_file_name;
+extern bool exit_after_options;
+extern bool version_flag;
 
 extern int target_flags_explicit;
 
+extern void display_help (void);
+extern void display_target_options (void);
+extern void print_version (FILE *, const char *);
+
 /* The hashtable, so that the C front ends can pass it to cpplib.  */
 extern struct ht *ident_hash;
 
@@ -108,6 +117,9 @@ extern struct ht *ident_hash;
 
 extern void set_fast_math_flags         (int);
 
+/* Handle -d switch.  */
+extern void decode_d_option            (const char *);
+
 /* Return true iff flags are set as if -ffast-math.  */
 extern bool fast_math_flags_set_p      (void);