aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-opts.c
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.co.uk>2003-07-02 20:15:46 +0000
committerNeil Booth <neil@gcc.gnu.org>2003-07-02 20:15:46 +0000
commitb86f6cd9ab108f1fda89c4fb00b0b16931182041 (patch)
tree9c89fbb7a4fe5df7e431edc8e3aadca6bfb3b1de /gcc/c-opts.c
parent41ba4c4632751678d7c32b169da1ff40c39bfb9e (diff)
downloadgcc-b86f6cd9ab108f1fda89c4fb00b0b16931182041.zip
gcc-b86f6cd9ab108f1fda89c4fb00b0b16931182041.tar.gz
gcc-b86f6cd9ab108f1fda89c4fb00b0b16931182041.tar.bz2
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
Diffstat (limited to 'gcc/c-opts.c')
-rw-r--r--gcc/c-opts.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/gcc/c-opts.c b/gcc/c-opts.c
index 09c58b9..5ee53b4 100644
--- a/gcc/c-opts.c
+++ b/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. */