c-common.h (c_common_init_options): New prototype.
* c-common.h (c_common_init_options): New prototype. * c-opts.c (deferred_size): Remove. (defer_opt): Array is now pre-allocated. (c_common_init_options): Pre-allocate deferred_opts. Make lang_flags unsigned. (push_command_line_options): Free deferred_opts. * hooks.c (hook_uint_uint_constcharptrptr_0): New. * hooks.h (hook_uint_uint_constcharptrptr_0): New. * langhooks-def.h (LANG_HOOKS_INIT_OPTIONS): Update. * langhooks.h (struct lang_hooks): New prototype for init_options. * main.c (main): Cast argv. * opts.c (handle_option, handle_options): Update prototypes. (decode_options): save_argc, save_argv are not global. Constify. * opts.h (decode_options): New prototype. * toplev.c (general_init): New protoype. (save_argv): Make static. (save_argc): Remove. (print_switch_values, general_init): Constify. (toplev_main): Save argv. * toplev.h (toplev_main): Update prototype. (save_argc, save_argv): Remove. ada: * misc.c (save_argc, save_argv): Make static. (gnat_init_options): New prototype. (gnat_init_options): Update. f: * top.c (ffe_init_options): Update prototype. * top.h (ffe_init_options): Update prototype. java: * lang.c (java_init_options): Update prototype. treelang: * tree1.c (treelang_init_options): Update prototype. * treelang.h (treelang_init_options): Update prototype. From-SVN: r68850
This commit is contained in:
parent
41ba4c4632
commit
b86f6cd9ab
22 changed files with 112 additions and 67 deletions
|
@ -1,3 +1,27 @@
|
|||
2003-07-02 Neil Booth <neil@daikokuya.co.uk>
|
||||
|
||||
* c-common.h (c_common_init_options): New prototype.
|
||||
* c-opts.c (deferred_size): Remove.
|
||||
(defer_opt): Array is now pre-allocated.
|
||||
(c_common_init_options): Pre-allocate deferred_opts. Make
|
||||
lang_flags unsigned.
|
||||
(push_command_line_options): Free deferred_opts.
|
||||
* hooks.c (hook_uint_uint_constcharptrptr_0): New.
|
||||
* hooks.h (hook_uint_uint_constcharptrptr_0): New.
|
||||
* langhooks-def.h (LANG_HOOKS_INIT_OPTIONS): Update.
|
||||
* langhooks.h (struct lang_hooks): New prototype for init_options.
|
||||
* main.c (main): Cast argv.
|
||||
* opts.c (handle_option, handle_options): Update prototypes.
|
||||
(decode_options): save_argc, save_argv are not global. Constify.
|
||||
* opts.h (decode_options): New prototype.
|
||||
* toplev.c (general_init): New protoype.
|
||||
(save_argv): Make static.
|
||||
(save_argc): Remove.
|
||||
(print_switch_values, general_init): Constify.
|
||||
(toplev_main): Save argv.
|
||||
* toplev.h (toplev_main): Update prototype.
|
||||
(save_argc, save_argv): Remove.
|
||||
|
||||
2003-07-02 David Edelsohn <edelsohn@gnu.org>
|
||||
|
||||
* dbxout.c (pending_bincls): Guard with DBX_USE_BINCLS.
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2003-07-02 Neil Booth <neil@daikokuya.co.uk>
|
||||
|
||||
* misc.c (save_argc, save_argv): Make static.
|
||||
(gnat_init_options): New prototype.
|
||||
(gnat_init_options): Update.
|
||||
|
||||
2003-07-01 Matt Kraai <kraai@alumni.cmu.edu>
|
||||
|
||||
* gnat_ug.texi: Remove unlikely characters from @vars.
|
||||
|
|
|
@ -78,12 +78,10 @@
|
|||
#include "options.h"
|
||||
|
||||
extern FILE *asm_out_file;
|
||||
extern int save_argc;
|
||||
extern char **save_argv;
|
||||
|
||||
static size_t gnat_tree_size PARAMS ((enum tree_code));
|
||||
static bool gnat_init PARAMS ((void));
|
||||
static int gnat_init_options PARAMS ((void));
|
||||
static unsigned int gnat_init_options (unsigned int, const char **);
|
||||
static int gnat_handle_option (size_t scode, const char *arg, int value);
|
||||
static HOST_WIDE_INT gnat_get_alias_set PARAMS ((tree));
|
||||
static void gnat_print_decl PARAMS ((FILE *, tree, int));
|
||||
|
@ -181,6 +179,10 @@ const char *const tree_code_name[] = {
|
|||
};
|
||||
#undef DEFTREECODE
|
||||
|
||||
/* Command-line argc and argv. */
|
||||
static unsigned int save_argc;
|
||||
static const char **save_argv;
|
||||
|
||||
/* gnat standard argc argv */
|
||||
|
||||
extern int gnat_argc;
|
||||
|
@ -222,7 +224,7 @@ gnat_handle_option (size_t scode, const char *arg, int value ATTRIBUTE_UNUSED)
|
|||
{
|
||||
enum opt_code code = (enum opt_code) scode;
|
||||
char *q;
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
/* Ignore file names. */
|
||||
if (code == N_OPTS)
|
||||
|
@ -279,14 +281,17 @@ gnat_handle_option (size_t scode, const char *arg, int value ATTRIBUTE_UNUSED)
|
|||
|
||||
/* Initialize for option processing. */
|
||||
|
||||
static int
|
||||
gnat_init_options ()
|
||||
static unsigned int
|
||||
gnat_init_options (unsigned int argc, const char **argv)
|
||||
{
|
||||
/* Initialize gnat_argv with save_argv size */
|
||||
gnat_argv = (char **) xmalloc ((save_argc + 1) * sizeof (gnat_argv[0]));
|
||||
gnat_argv[0] = save_argv[0]; /* name of the command */
|
||||
/* Initialize gnat_argv with save_argv size. */
|
||||
gnat_argv = (char **) xmalloc ((argc + 1) * sizeof (argv[0]));
|
||||
gnat_argv[0] = argv[0]; /* name of the command */
|
||||
gnat_argc = 1;
|
||||
|
||||
save_argc = argc;
|
||||
save_argv = argv;
|
||||
|
||||
return CL_Ada;
|
||||
}
|
||||
|
||||
|
|
|
@ -953,7 +953,7 @@ extern void disable_builtin_function (const char *);
|
|||
|
||||
extern tree build_va_arg (tree, tree);
|
||||
|
||||
extern int c_common_init_options (void);
|
||||
extern unsigned int c_common_init_options (unsigned int, const char **);
|
||||
extern bool c_common_post_options (const char **);
|
||||
extern bool c_common_init (void);
|
||||
extern void c_common_finish (void);
|
||||
|
|
27
gcc/c-opts.c
27
gcc/c-opts.c
|
@ -92,8 +92,8 @@ static bool quote_chain_split;
|
|||
/* If -Wunused-macros. */
|
||||
static bool warn_unused_macros;
|
||||
|
||||
/* Number of deferred options, deferred options array size. */
|
||||
static size_t deferred_count, deferred_size;
|
||||
/* Number of deferred options. */
|
||||
static size_t deferred_count;
|
||||
|
||||
/* Number of deferred options scanned for -include. */
|
||||
static size_t include_cursor;
|
||||
|
@ -191,29 +191,16 @@ missing_arg (enum opt_code code)
|
|||
static void
|
||||
defer_opt (enum opt_code code, const char *arg)
|
||||
{
|
||||
/* FIXME: this should be in c_common_init_options, which should take
|
||||
argc and argv. */
|
||||
if (!deferred_opts)
|
||||
{
|
||||
extern int save_argc;
|
||||
deferred_size = save_argc;
|
||||
deferred_opts = (struct deferred_opt *)
|
||||
xmalloc (deferred_size * sizeof (struct deferred_opt));
|
||||
}
|
||||
|
||||
if (deferred_count == deferred_size)
|
||||
abort ();
|
||||
|
||||
deferred_opts[deferred_count].code = code;
|
||||
deferred_opts[deferred_count].arg = arg;
|
||||
deferred_count++;
|
||||
}
|
||||
|
||||
/* Common initialization before parsing options. */
|
||||
int
|
||||
c_common_init_options (void)
|
||||
unsigned int
|
||||
c_common_init_options (unsigned int argc, const char **argv ATTRIBUTE_UNUSED)
|
||||
{
|
||||
static const int lang_flags[] = {CL_C, CL_ObjC, CL_CXX, CL_ObjCXX};
|
||||
static const unsigned int lang_flags[] = {CL_C, CL_ObjC, CL_CXX, CL_ObjCXX};
|
||||
|
||||
/* This is conditionalized only because that is the way the front
|
||||
ends used to do it. Maybe this should be unconditional? */
|
||||
|
@ -242,6 +229,9 @@ c_common_init_options (void)
|
|||
flag_exceptions = c_dialect_cxx ();
|
||||
warn_pointer_arith = c_dialect_cxx ();
|
||||
|
||||
deferred_opts = (struct deferred_opt *)
|
||||
xmalloc (argc * sizeof (struct deferred_opt));
|
||||
|
||||
return lang_flags[c_language];
|
||||
}
|
||||
|
||||
|
@ -1406,6 +1396,7 @@ push_command_line_include (void)
|
|||
|
||||
if (include_cursor == deferred_count)
|
||||
{
|
||||
free (deferred_opts);
|
||||
/* Restore the line map from <command line>. */
|
||||
cpp_change_file (parse_in, LC_RENAME, main_input_filename);
|
||||
/* -Wunused-macros should only warn about macros defined hereafter. */
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
Wed Jul 2 21:16:02 2003 Neil Booth <neil@daikokuya.co.uk>
|
||||
|
||||
* top.c (ffe_init_options): Update prototype.
|
||||
* top.h (ffe_init_options): Update prototype.
|
||||
|
||||
2003-06-27 Zack Weinberg <zack@codesourcery.com>
|
||||
|
||||
* com.c (input_file_stack_tick): Delete redundant declaration.
|
||||
|
|
|
@ -156,8 +156,9 @@ ffe_is_digit_string_ (const char *s)
|
|||
}
|
||||
|
||||
/* Get ready for options handling. */
|
||||
int
|
||||
ffe_init_options ()
|
||||
unsigned int
|
||||
ffe_init_options (unsigned int argc ATTRIBUTE_UNUSED,
|
||||
const char **argv ATTRIBUTE_UNUSED)
|
||||
{
|
||||
/* Set default options for Fortran. */
|
||||
flag_move_all_movables = 1;
|
||||
|
|
|
@ -141,7 +141,7 @@ extern bool ffe_in_4;
|
|||
|
||||
/* Declare functions with prototypes. */
|
||||
|
||||
int ffe_init_options (void);
|
||||
unsigned int ffe_init_options (unsigned int, const char **);
|
||||
int ffe_handle_option (size_t code, const char *arg, int on);
|
||||
void ffe_file (ffewhereFile wf, FILE *f);
|
||||
void ffe_init_0 (void);
|
||||
|
|
|
@ -133,6 +133,13 @@ hook_int_size_t_constcharptr_int_0 (size_t a ATTRIBUTE_UNUSED,
|
|||
return 0;
|
||||
}
|
||||
|
||||
unsigned int
|
||||
hook_uint_uint_constcharptrptr_0 (unsigned int a ATTRIBUTE_UNUSED,
|
||||
const char **b ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
hook_void_tree (a)
|
||||
tree a ATTRIBUTE_UNUSED;
|
||||
|
|
|
@ -44,6 +44,8 @@ int hook_int_void_0 (void);
|
|||
int hook_int_size_t_constcharptr_int_0 (size_t, const char *, int);
|
||||
int hook_int_void_no_regs (void);
|
||||
|
||||
unsigned hook_uint_uint_constcharptrptr_0 (unsigned, const char **);
|
||||
|
||||
bool default_can_output_mi_thunk_no_vcall
|
||||
PARAMS ((tree, HOST_WIDE_INT, HOST_WIDE_INT, tree));
|
||||
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2003-07-02 Neil Booth <neil@daikokuya.co.uk>
|
||||
|
||||
* lang.c (java_init_options): Update prototype.
|
||||
|
||||
2003-07-01 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
* decl.c (poplevel): Adjust define_label call.
|
||||
|
|
|
@ -50,7 +50,7 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
|
|||
|
||||
static bool java_init (void);
|
||||
static void java_finish (void);
|
||||
static int java_init_options (void);
|
||||
static unsigned int java_init_options (unsigned int, const char **);
|
||||
static bool java_post_options (const char **);
|
||||
|
||||
static int java_handle_option (size_t scode, const char *arg, int value);
|
||||
|
@ -664,8 +664,9 @@ void lang_init_source (int level)
|
|||
inhibit_error_function_printing = (level == 1);
|
||||
}
|
||||
|
||||
static int
|
||||
java_init_options (void)
|
||||
static unsigned int
|
||||
java_init_options (unsigned int argc ATTRIBUTE_UNUSED,
|
||||
const char **argv ATTRIBUTE_UNUSED)
|
||||
{
|
||||
flag_bounds_check = 1;
|
||||
flag_exceptions = 1;
|
||||
|
|
|
@ -90,8 +90,8 @@ void write_global_declarations PARAMS ((void));
|
|||
#define LANG_HOOKS_FINISH lhd_do_nothing
|
||||
#define LANG_HOOKS_PARSE_FILE lhd_do_nothing_i
|
||||
#define LANG_HOOKS_CLEAR_BINDING_STACK lhd_clear_binding_stack
|
||||
#define LANG_HOOKS_INIT_OPTIONS hook_int_void_0
|
||||
#define LANG_HOOKS_HANDLE_OPTION hook_int_size_t_constharptr_int_0
|
||||
#define LANG_HOOKS_INIT_OPTIONS hook_uint_uint_constcharptrptr_0
|
||||
#define LANG_HOOKS_HANDLE_OPTION hook_int_size_t_constcharptr_int_0
|
||||
#define LANG_HOOKS_POST_OPTIONS lhd_post_options
|
||||
#define LANG_HOOKS_GET_ALIAS_SET lhd_get_alias_set
|
||||
#define LANG_HOOKS_EXPAND_CONSTANT lhd_return_tree
|
||||
|
|
|
@ -207,7 +207,7 @@ struct lang_hooks
|
|||
/* The first callback made to the front end, for simple
|
||||
initialization needed before any calls to handle_option. Return
|
||||
the language mask to filter the switch array with. */
|
||||
int (*init_options) PARAMS ((void));
|
||||
unsigned int (*init_options) (unsigned int argc, const char **argv);
|
||||
|
||||
/* Handle the switch CODE, which has real type enum opt_code from
|
||||
options.h. If the switch takes an argument, it is passed in ARG
|
||||
|
|
|
@ -34,5 +34,5 @@ main (argc, argv)
|
|||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
return toplev_main (argc, argv);
|
||||
return toplev_main (argc, (const char **) argv);
|
||||
}
|
||||
|
|
20
gcc/opts.c
20
gcc/opts.c
|
@ -131,11 +131,11 @@ static size_t find_opt (const char *, int);
|
|||
static int common_handle_option (size_t scode, const char *arg, int value);
|
||||
static void handle_param (const char *);
|
||||
static void set_Wextra (int);
|
||||
static unsigned int handle_option (char **argv, unsigned int lang_mask);
|
||||
static unsigned int handle_option (const char **argv, unsigned int lang_mask);
|
||||
static char *write_langs (unsigned int lang_mask);
|
||||
static void complain_wrong_lang (const char *, const struct cl_option *,
|
||||
unsigned int lang_mask);
|
||||
static void handle_options (unsigned int, char **, unsigned int lang_mask);
|
||||
static void handle_options (unsigned int, const char **, unsigned int);
|
||||
|
||||
/* Perform a binary search to find which option the command-line INPUT
|
||||
matches. Returns its index in the option array, and N_OPTS
|
||||
|
@ -286,7 +286,7 @@ complain_wrong_lang (const char *text, const struct cl_option *option,
|
|||
/* Handle the switch beginning at ARGV for the language indicated by
|
||||
LANG_MASK. Returns the number of switches consumed. */
|
||||
static unsigned int
|
||||
handle_option (char **argv, unsigned int lang_mask)
|
||||
handle_option (const char **argv, unsigned int lang_mask)
|
||||
{
|
||||
size_t opt_index;
|
||||
const char *opt, *arg = 0;
|
||||
|
@ -408,7 +408,7 @@ handle_option (char **argv, unsigned int lang_mask)
|
|||
contains has a single bit set representing the current
|
||||
language. */
|
||||
static void
|
||||
handle_options (unsigned int argc, char **argv, unsigned int lang_mask)
|
||||
handle_options (unsigned int argc, const char **argv, unsigned int lang_mask)
|
||||
{
|
||||
unsigned int n, i;
|
||||
|
||||
|
@ -427,16 +427,12 @@ handle_options (unsigned int argc, char **argv, unsigned int lang_mask)
|
|||
/* Parse command line options and set default flag values. Do minimal
|
||||
options processing. */
|
||||
void
|
||||
decode_options (int argc, char **argv)
|
||||
decode_options (unsigned int argc, const char **argv)
|
||||
{
|
||||
int i, lang_mask;
|
||||
|
||||
/* Save in case md file wants to emit args as a comment. */
|
||||
save_argc = argc;
|
||||
save_argv = argv;
|
||||
unsigned int i, lang_mask;
|
||||
|
||||
/* Perform language-specific options initialization. */
|
||||
lang_mask = (*lang_hooks.init_options) ();
|
||||
lang_mask = (*lang_hooks.init_options) (argc, argv);
|
||||
|
||||
/* Scan to see what optimization level has been specified. That will
|
||||
determine the default value of many flags. */
|
||||
|
@ -450,7 +446,7 @@ decode_options (int argc, char **argv)
|
|||
else if (argv[i][0] == '-' && argv[i][1] == 'O')
|
||||
{
|
||||
/* Handle -Os, -O2, -O3, -O69, ... */
|
||||
char *p = &argv[i][2];
|
||||
const char *p = &argv[i][2];
|
||||
|
||||
if ((p[0] == 's') && (p[1] == 0))
|
||||
{
|
||||
|
|
|
@ -21,7 +21,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
|||
#ifndef GCC_OPTS_H
|
||||
#define GCC_OPTS_H
|
||||
|
||||
extern void decode_options (int argc, char **argv);
|
||||
extern void decode_options (unsigned int argc, const char **argv);
|
||||
|
||||
struct cl_option
|
||||
{
|
||||
|
|
17
gcc/toplev.c
17
gcc/toplev.c
|
@ -104,7 +104,7 @@ extern tree last_assemble_variable_decl;
|
|||
|
||||
extern void reg_alloc (void);
|
||||
|
||||
static void general_init (char *);
|
||||
static void general_init (const char *);
|
||||
static void do_compile (void);
|
||||
static void process_options (void);
|
||||
static void backend_init (void);
|
||||
|
@ -172,9 +172,8 @@ static bool no_backend;
|
|||
|
||||
const char *progname;
|
||||
|
||||
/* Copy of arguments to toplev_main. */
|
||||
int save_argc;
|
||||
char **save_argv;
|
||||
/* Copy of argument vector to toplev_main. */
|
||||
static const char **save_argv;
|
||||
|
||||
/* Name of top-level original source file (what was input to cpp).
|
||||
This comes from the #-command at the beginning of the actual input.
|
||||
|
@ -4408,7 +4407,7 @@ print_switch_values (FILE *file, int pos, int max,
|
|||
const char *indent, const char *sep, const char *term)
|
||||
{
|
||||
size_t j;
|
||||
char **p;
|
||||
const char **p;
|
||||
|
||||
/* Fill in the -frandom-seed option, if the user didn't pass it, so
|
||||
that it can be printed below. This helps reproducibility. Of
|
||||
|
@ -4537,9 +4536,9 @@ init_asm_output (const char *name)
|
|||
options are parsed. Signal handlers, internationalization etc.
|
||||
ARGV0 is main's argv[0]. */
|
||||
static void
|
||||
general_init (char *argv0)
|
||||
general_init (const char *argv0)
|
||||
{
|
||||
char *p;
|
||||
const char *p;
|
||||
|
||||
p = argv0 + strlen (argv0);
|
||||
while (p != argv0 && !IS_DIR_SEPARATOR (p[-1]))
|
||||
|
@ -4975,8 +4974,10 @@ do_compile (void)
|
|||
It is not safe to call this function more than once. */
|
||||
|
||||
int
|
||||
toplev_main (int argc, char **argv)
|
||||
toplev_main (unsigned int argc, const char **argv)
|
||||
{
|
||||
save_argv = argv;
|
||||
|
||||
/* Initialization of GCC's environment, and diagnostics. */
|
||||
general_init (argv[0]);
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
|||
#define skip_leading_substring(whole, part) \
|
||||
(strncmp (whole, part, strlen (part)) ? NULL : whole + strlen (part))
|
||||
|
||||
extern int toplev_main (int, char **);
|
||||
extern int toplev_main (unsigned int, const char **);
|
||||
extern int read_integral_parameter (const char *, const char *,
|
||||
const int);
|
||||
extern void strip_off_ending (char *, int);
|
||||
|
@ -102,10 +102,6 @@ extern const char *asm_file_name;
|
|||
extern bool exit_after_options;
|
||||
extern bool version_flag;
|
||||
|
||||
/* Copy of arguments to toplev_main. */
|
||||
extern int save_argc;
|
||||
extern char **save_argv;
|
||||
|
||||
extern int target_flags_explicit;
|
||||
|
||||
/* See toplev.c. */
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2003-07-02 Neil Booth <neil@daikokuya.co.uk>
|
||||
|
||||
* tree1.c (treelang_init_options): Update prototype.
|
||||
* treelang.h (treelang_init_options): Update prototype.
|
||||
|
||||
2003-07-01 Neil Booth <neil@daikokuya.co.uk>
|
||||
|
||||
* Make-lang.in: Update.
|
||||
|
|
|
@ -92,8 +92,9 @@ static int version_done = 0;
|
|||
static unsigned int work_nesting_level = 0;
|
||||
|
||||
/* Prepare to handle switches. */
|
||||
int
|
||||
treelang_init_options (void)
|
||||
unsigned int
|
||||
treelang_init_options (unsigned int argc ATTRIBUTE_UNUSED,
|
||||
const char **argv ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return CL_Treelang;
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ tree tree_code_get_type (int type_num);
|
|||
void treelang_init_decl_processing (void);
|
||||
void treelang_finish (void);
|
||||
bool treelang_init (void);
|
||||
int treelang_init_options (void);
|
||||
unsigned int treelang_init_options (unsigned int, const char **);
|
||||
int treelang_handle_option (size_t scode, const char *arg, int value);
|
||||
void treelang_parse_file (int debug_flag);
|
||||
void push_var_level (void);
|
||||
|
|
Loading…
Add table
Reference in a new issue