aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.co.uk>2003-06-15 08:30:02 +0000
committerNeil Booth <neil@gcc.gnu.org>2003-06-15 08:30:02 +0000
commitd185d26881a1946cf82da6350a1d1518464a8eb6 (patch)
treefb5a3a4fc913d05084620e60c670ecc9dde2dd16
parent72ac76be3abe9ed981037fe35da0c15bec5611ef (diff)
downloadgcc-d185d26881a1946cf82da6350a1d1518464a8eb6.zip
gcc-d185d26881a1946cf82da6350a1d1518464a8eb6.tar.gz
gcc-d185d26881a1946cf82da6350a1d1518464a8eb6.tar.bz2
c-pch.c (asm_file_name): Remove.
* 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
-rw-r--r--gcc/ChangeLog18
-rw-r--r--gcc/c-pch.c1
-rw-r--r--gcc/common.opt48
-rw-r--r--gcc/flags.h2
-rw-r--r--gcc/java/ChangeLog4
-rw-r--r--gcc/java/lang.c6
-rw-r--r--gcc/opts.c83
-rw-r--r--gcc/toplev.c178
-rw-r--r--gcc/toplev.h12
9 files changed, 178 insertions, 174 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8bd85fa..a3c9063 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/c-pch.c b/gcc/c-pch.c
index 354fcc7..6a21314 100644
--- a/gcc/c-pch.c
+++ b/gcc/c-pch.c
@@ -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));
diff --git a/gcc/common.opt b/gcc/common.opt
index c3c955e..6c93621 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -41,7 +41,55 @@
; 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.
diff --git a/gcc/flags.h b/gcc/flags.h
index 766b24d..5113124 100644
--- a/gcc/flags.h
+++ b/gcc/flags.h
@@ -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'.
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index d1827cb..37dacc5 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -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.
diff --git a/gcc/java/lang.c b/gcc/java/lang.c
index ab5b744..3ac6fd2 100644
--- a/gcc/java/lang.c
+++ b/gcc/java/lang.c
@@ -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 ();
diff --git a/gcc/opts.c b/gcc/opts.c
index 99b3298..204cc0d 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -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;
diff --git a/gcc/toplev.c b/gcc/toplev.c
index f349f73..dc93925 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -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__
diff --git a/gcc/toplev.h b/gcc/toplev.h
index ef1a705..61bed8b 100644
--- a/gcc/toplev.h
+++ b/gcc/toplev.h
@@ -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);