diff --git a/gcc/ChangeLog b/gcc/ChangeLog index df45676087c..1f48c7c67ca 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,22 @@ +2003-07-31 Per Bothner + + * opts.c (in_fnames, num_in_fnames): Moved here from c-opts. + (add_input_filename): New function. + (handle_options): Call add_input_filename directly instead of + with a lang hook. + * opts.h (in_fnames, num_in_fnames): Moved here. + (add_input_filename): Declare. + * c-decl.c: Need to #include opts.h. + * Makefile.in (c-decl.o): Also depends on opts.h. + * c-opts.c (in_fnames, num_in_fnames): Moved to opts.c. + (c_common_handle_filename): Replaced by add_input_filename. + * c-common.h (in_fnames, num_in_fnames, c_common_handle_filename): + Remove. + * langhooks.h (struct lang_hooks): Remove handle_filename hook. + * langhooks-def.h (LANG_HOOKS_HANDLE_FILENAME): Remove macro. + (LANG_HOOKS_INITIALIZER): Remove use of LANG_HOOKS_HANDLE_FILENAME. + * c-lang.c (LANG_HOOKS_HANDLE_FILENAME): Remove macro. + 2003-07-31 Zdenek Dvorak * combine.c (try_combine): Set JUMP_LABEL for newly created diff --git a/gcc/Makefile.in b/gcc/Makefile.in index aaf42fcd816..5fe504bf4ae 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1270,7 +1270,7 @@ c-incpath.o: c-incpath.c c-incpath.h $(CONFIG_H) $(SYSTEM_H) $(CPPLIB_H) \ c-decl.o : c-decl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ $(RTL_H) $(C_TREE_H) $(GGC_H) $(TARGET_H) flags.h function.h output.h \ $(EXPR_H) debug.h toplev.h intl.h $(TM_P_H) tree-inline.h $(TIMEVAR_H) \ - c-pragma.h gt-c-decl.h cgraph.h $(HASHTAB_H) libfuncs.h except.h \ + opts.h c-pragma.h gt-c-decl.h cgraph.h $(HASHTAB_H) libfuncs.h except.h \ $(LANGHOOKS_DEF_H) c-typeck.o : c-typeck.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(C_TREE_H) \ $(TARGET_H) flags.h intl.h output.h $(EXPR_H) $(RTL_H) toplev.h $(TM_P_H) diff --git a/gcc/c-common.h b/gcc/c-common.h index 6590453f867..aecf9638a2f 100644 --- a/gcc/c-common.h +++ b/gcc/c-common.h @@ -845,11 +845,6 @@ extern int max_tinst_depth; extern int skip_evaluation; -/* The count of input filenames. Only really valid for comparisons - against 1. */ - -extern unsigned num_in_fnames; - /* C types are partitioned into three subsets: object, function, and incomplete types. */ #define C_TYPE_OBJECT_P(type) \ @@ -901,7 +896,6 @@ extern tree handle_format_attribute (tree *, tree, tree, int, bool *); extern tree handle_format_arg_attribute (tree *, tree, tree, int, bool *); extern void c_common_insert_default_attributes (tree); extern int c_common_handle_option (size_t code, const char *arg, int value); -extern void c_common_handle_filename (const char *filename); extern bool c_common_missing_argument (const char *opt, size_t code); extern tree c_common_type_for_mode (enum machine_mode, int); extern tree c_common_type_for_size (unsigned int, int); diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 8259fb9ff55..1f8ca3fcb94 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -45,6 +45,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "cpplib.h" #include "target.h" #include "debug.h" +#include "opts.h" #include "timevar.h" #include "c-common.h" #include "c-pragma.h" diff --git a/gcc/c-lang.c b/gcc/c-lang.c index 98158a1eaef..fb729f326b9 100644 --- a/gcc/c-lang.c +++ b/gcc/c-lang.c @@ -45,8 +45,6 @@ enum c_language_kind c_language = clk_c; #define LANG_HOOKS_INIT_OPTIONS c_common_init_options #undef LANG_HOOKS_HANDLE_OPTION #define LANG_HOOKS_HANDLE_OPTION c_common_handle_option -#undef LANG_HOOKS_HANDLE_FILENAME -#define LANG_HOOKS_HANDLE_FILENAME c_common_handle_filename #undef LANG_HOOKS_MISSING_ARGUMENT #define LANG_HOOKS_MISSING_ARGUMENT c_common_missing_argument #undef LANG_HOOKS_POST_OPTIONS diff --git a/gcc/c-opts.c b/gcc/c-opts.c index 85f9a0bf2e0..3e4a10aafd3 100644 --- a/gcc/c-opts.c +++ b/gcc/c-opts.c @@ -52,8 +52,6 @@ static int saved_lineno; static cpp_options *cpp_opts; /* Input filename. */ -static const char **in_fnames; -unsigned num_in_fnames; static const char *this_input_filename; /* Filename and stream for preprocessed output. */ @@ -1032,15 +1030,6 @@ c_common_handle_option (size_t scode, const char *arg, int value) return result; } -/* Handle FILENAME from the command line. */ -void -c_common_handle_filename (const char *filename) -{ - num_in_fnames++; - in_fnames = xrealloc (in_fnames, num_in_fnames * sizeof (in_fnames[0])); - in_fnames[num_in_fnames - 1] = filename; -} - /* Post-switch processing. */ bool c_common_post_options (const char **pfilename) diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h index 864cff9e150..abdf2df3af8 100644 --- a/gcc/langhooks-def.h +++ b/gcc/langhooks-def.h @@ -88,7 +88,6 @@ extern tree lhd_tree_inlining_convert_parm_for_inlining (tree, tree, tree); #define LANG_HOOKS_CLEAR_BINDING_STACK lhd_clear_binding_stack #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_HANDLE_FILENAME hook_void_constcharptr #define LANG_HOOKS_MISSING_ARGUMENT hook_bool_constcharptr_size_t_false #define LANG_HOOKS_POST_OPTIONS lhd_post_options #define LANG_HOOKS_GET_ALIAS_SET lhd_get_alias_set @@ -247,7 +246,6 @@ extern int lhd_tree_dump_type_quals (tree); LANG_HOOKS_TREE_SIZE, \ LANG_HOOKS_INIT_OPTIONS, \ LANG_HOOKS_HANDLE_OPTION, \ - LANG_HOOKS_HANDLE_FILENAME, \ LANG_HOOKS_MISSING_ARGUMENT, \ LANG_HOOKS_POST_OPTIONS, \ LANG_HOOKS_INIT, \ diff --git a/gcc/langhooks.h b/gcc/langhooks.h index 398ad55c802..4c43ddc93ea 100644 --- a/gcc/langhooks.h +++ b/gcc/langhooks.h @@ -213,9 +213,6 @@ struct lang_hooks valid and should not be treated as language-independent too. */ int (*handle_option) (size_t code, const char *arg, int value); - /* Handle a filename on the command line. */ - void (*handle_filename) (const char *filename); - /* Return false to use the default complaint about a missing argument, otherwise output a complaint and return true. */ bool (*missing_argument) (const char *opt, size_t code); diff --git a/gcc/opts.c b/gcc/opts.c index 7c24921b0ab..de39e5c6c8d 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -134,6 +134,10 @@ static unsigned int columns = 80; /* What to print when a switch has no documentation. */ static const char undocumented_msg[] = N_("This switch lacks documentation"); +/* Input file names. */ +const char **in_fnames; +unsigned num_in_fnames; + 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 *); @@ -422,7 +426,7 @@ handle_options (unsigned int argc, const char **argv, unsigned int lang_mask) if (opt[0] != '-' || opt[1] == '\0') { main_input_filename = opt; - (*lang_hooks.handle_filename) (opt); + add_input_filename (opt); n = 1; continue; } @@ -437,6 +441,15 @@ handle_options (unsigned int argc, const char **argv, unsigned int lang_mask) } } +/* Handle FILENAME from the command line. */ +void +add_input_filename (const char *filename) +{ + num_in_fnames++; + in_fnames = xrealloc (in_fnames, num_in_fnames * sizeof (in_fnames[0])); + in_fnames[num_in_fnames - 1] = filename; +} + /* Parse command line options and set default flag values. Do minimal options processing. */ void diff --git a/gcc/opts.h b/gcc/opts.h index 0848054e567..6063057e3ec 100644 --- a/gcc/opts.h +++ b/gcc/opts.h @@ -22,6 +22,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #define GCC_OPTS_H extern void decode_options (unsigned int argc, const char **argv); +extern void add_input_filename (const char *filename); struct cl_option { @@ -44,4 +45,12 @@ extern const char *const lang_names[]; #define CL_COMMON (1 << 29) /* Language-independent. */ #define CL_UNDOCUMENTED (1 << 30) /* Do not output with --help. */ +/* Input file names. */ + +extern const char **in_fnames; + +/* The count of input filenames. */ + +extern unsigned num_in_fnames; + #endif