Commit d185d268 by Neil Booth Committed by Neil Booth

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
parent 72ac76be
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> 2003-06-15 Kazu Hirata <kazu@cs.umass.edu>
* config/alpha/alpha.md: Follow spelling conventions. * config/alpha/alpha.md: Follow spelling conventions.
......
...@@ -46,7 +46,6 @@ struct c_pch_header ...@@ -46,7 +46,6 @@ struct c_pch_header
static FILE *pch_outfile; static FILE *pch_outfile;
extern char *asm_file_name;
static long asm_file_startpos; static long asm_file_startpos;
static const char * get_ident PARAMS((void)); static const char * get_ident PARAMS((void));
......
...@@ -41,7 +41,55 @@ ...@@ -41,7 +41,55 @@
; Please try to keep this file in ASCII collating order. ; 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 quiet
Common Common
version
Common
w
Common
; This comment is to ensure we retain the blank line above. ; This comment is to ensure we retain the blank line above.
...@@ -600,7 +600,7 @@ extern int flag_wrapv; ...@@ -600,7 +600,7 @@ extern int flag_wrapv;
/* Value of the -G xx switch, and whether it was passed or not. */ /* Value of the -G xx switch, and whether it was passed or not. */
extern unsigned HOST_WIDE_INT g_switch_value; 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. /* Values of the -falign-* flags: how much to align labels in code.
0 means `use default', 1 means `don't align'. 0 means `use default', 1 means `don't align'.
......
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> 2003-06-14 Neil Booth <neil@daikokuya.co.uk>
* lang-specs.h: Rewrite -MD and -MMD to append an underscore. * lang-specs.h: Rewrite -MD and -MMD to append an underscore.
......
...@@ -181,7 +181,7 @@ int flag_indirect_dispatch = 0; ...@@ -181,7 +181,7 @@ int flag_indirect_dispatch = 0;
int flag_store_check = 1; int flag_store_check = 1;
/* When nonzero, print extra version information. */ /* 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 /* Set nonzero if the user specified -finline-functions on the command
line. */ line. */
...@@ -448,7 +448,7 @@ java_handle_option (size_t scode, const char *arg, int value) ...@@ -448,7 +448,7 @@ java_handle_option (size_t scode, const char *arg, int value)
break; break;
case OPT_version: case OPT_version:
version_flag = 1; v_flag = 1;
break; break;
} }
...@@ -476,7 +476,7 @@ java_init (void) ...@@ -476,7 +476,7 @@ java_init (void)
&& force_align_functions_log < 1) && force_align_functions_log < 1)
force_align_functions_log = 1; force_align_functions_log = 1;
jcf_path_seal (version_flag); jcf_path_seal (v_flag);
java_init_decl_processing (); java_init_decl_processing ();
......
...@@ -30,6 +30,16 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -30,6 +30,16 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "flags.h" #include "flags.h"
#include "toplev.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 size_t find_opt (const char *, int);
static int common_handle_option (size_t scode, const char *arg, int value); 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, ...@@ -236,9 +246,82 @@ common_handle_option (size_t scode, const char *arg,
default: default:
abort (); 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: case OPT_quiet:
quiet_flag = 1; quiet_flag = 1;
break; break;
case OPT_version:
version_flag = 1;
break;
case OPT_w:
inhibit_warnings = 1;
break;
} }
return 1; return 1;
......
...@@ -117,17 +117,14 @@ static void set_target_switch (const char *); ...@@ -117,17 +117,14 @@ static void set_target_switch (const char *);
static void crash_signal (int) ATTRIBUTE_NORETURN; static void crash_signal (int) ATTRIBUTE_NORETURN;
static void setup_core_dumping (void); static void setup_core_dumping (void);
static void compile_file (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_f_option (const char *);
static int decode_W_option (const char *); static int decode_W_option (const char *);
static int decode_g_option (const char *); static int decode_g_option (const char *);
static unsigned int independent_decode_option (int, char **); static unsigned int independent_decode_option (int, char **);
static void set_Wextra (int); static void set_Wextra (int);
static void print_version (FILE *, const char *);
static int print_single_switch (FILE *, int, int, const char *, static int print_single_switch (FILE *, int, int, const char *,
const char *, const char *, const char *, const char *,
const char *, const char *); const char *, const char *);
...@@ -214,7 +211,7 @@ const char *dump_base_name; ...@@ -214,7 +211,7 @@ const char *dump_base_name;
/* Name to use as a base for auxiliary output files. */ /* 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 */ /* Format to use to print dumpfile index value */
#ifndef DUMPFILE_FORMAT #ifndef DUMPFILE_FORMAT
...@@ -358,16 +355,11 @@ static void close_dump_file (enum dump_file_index, ...@@ -358,16 +355,11 @@ static void close_dump_file (enum dump_file_index,
int rtl_dump_and_exit; int rtl_dump_and_exit;
int flag_print_asm_name; int flag_print_asm_name;
static int version_flag;
enum graph_dump_types graph_dump_format; enum graph_dump_types graph_dump_format;
/* Name for output file of assembly code, specified with -o. */ /* Name for output file of assembly code, specified with -o. */
char *asm_file_name; const 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;
/* Type(s) of debugging information we are producing (if any). /* Type(s) of debugging information we are producing (if any).
See flags.h for the definitions of the different possible See flags.h for the definitions of the different possible
...@@ -400,9 +392,6 @@ int optimize = 0; ...@@ -400,9 +392,6 @@ int optimize = 0;
int optimize_size = 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, /* The FUNCTION_DECL for the function currently being compiled,
or 0 if between functions. */ or 0 if between functions. */
tree current_function_decl; tree current_function_decl;
...@@ -743,7 +732,7 @@ int flag_gen_aux_info = 0; ...@@ -743,7 +732,7 @@ int flag_gen_aux_info = 0;
/* Specified name of aux-info file. */ /* 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. */ /* Nonzero means make the text shared if supported. */
...@@ -4011,7 +4000,7 @@ rest_of_compilation (tree decl) ...@@ -4011,7 +4000,7 @@ rest_of_compilation (tree decl)
} }
/* Display help for generic options. */ /* Display help for generic options. */
static void void
display_help (void) display_help (void)
{ {
int undoc; int undoc;
...@@ -4145,7 +4134,7 @@ display_help (void) ...@@ -4145,7 +4134,7 @@ display_help (void)
} }
/* Display help for target options. */ /* Display help for target options. */
static void void
display_target_options (void) display_target_options (void)
{ {
int undoc, i; int undoc, i;
...@@ -4154,6 +4143,7 @@ display_target_options (void) ...@@ -4154,6 +4143,7 @@ display_target_options (void)
/* Avoid double printing for --help --target-help. */ /* Avoid double printing for --help --target-help. */
if (displayed) if (displayed)
return; return;
displayed = true; displayed = true;
if (ARRAY_SIZE (target_switches) > 1 if (ARRAY_SIZE (target_switches) > 1
...@@ -4217,7 +4207,7 @@ display_target_options (void) ...@@ -4217,7 +4207,7 @@ display_target_options (void)
/* Parse a -d... command line switch. */ /* Parse a -d... command line switch. */
static void void
decode_d_option (const char *arg) decode_d_option (const char *arg)
{ {
int i, c, matched; int i, c, matched;
...@@ -4597,27 +4587,6 @@ independent_decode_option (int argc, char **argv) ...@@ -4597,27 +4587,6 @@ independent_decode_option (int argc, char **argv)
arg++; 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>'. */ /* Handle '--param <name>=<value>'. */
if (strcmp (arg, "-param") == 0) if (strcmp (arg, "-param") == 0)
{ {
...@@ -4671,46 +4640,6 @@ independent_decode_option (int argc, char **argv) ...@@ -4671,46 +4640,6 @@ independent_decode_option (int argc, char **argv)
case 'g': case 'g':
return decode_g_option (arg + 1); 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': case 'W':
/* For backward compatibility, -W is the same as -Wextra. */ /* For backward compatibility, -W is the same as -Wextra. */
if (arg[1] == 0) if (arg[1] == 0)
...@@ -4718,95 +4647,6 @@ independent_decode_option (int argc, char **argv) ...@@ -4718,95 +4647,6 @@ independent_decode_option (int argc, char **argv)
else else
return decode_W_option (arg + 1); return decode_W_option (arg + 1);
break; 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; return 1;
...@@ -4870,7 +4710,7 @@ set_target_switch (const char *name) ...@@ -4870,7 +4710,7 @@ set_target_switch (const char *name)
Each line begins with INDENT (for the case where FILE is the Each line begins with INDENT (for the case where FILE is the
assembler output file). */ assembler output file). */
static void void
print_version (FILE *file, const char *indent) print_version (FILE *file, const char *indent)
{ {
#ifndef __VERSION__ #ifndef __VERSION__
......
...@@ -97,9 +97,18 @@ extern void check_global_declarations (union tree_node **, int); ...@@ -97,9 +97,18 @@ extern void check_global_declarations (union tree_node **, int);
extern const char *progname; extern const char *progname;
extern const char *dump_base_name; 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 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. */ /* The hashtable, so that the C front ends can pass it to cpplib. */
extern struct ht *ident_hash; extern struct ht *ident_hash;
...@@ -108,6 +117,9 @@ extern struct ht *ident_hash; ...@@ -108,6 +117,9 @@ extern struct ht *ident_hash;
extern void set_fast_math_flags (int); 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. */ /* Return true iff flags are set as if -ffast-math. */
extern bool fast_math_flags_set_p (void); extern bool fast_math_flags_set_p (void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment