Commit ee811cfd by Neil Booth Committed by Neil Booth

c-lang.c (lang_hooks): Update.

        * c-lang.c (lang_hooks): Update.
        (lang_decode_option): Remove.
        (lang_init_options): Rename c_init_options.
        * toplev.c (main): Use lang_hooks for lang_init_options
        and lang_decode_option.
        * toplev.h (lang_hooks): Add 2 new hooks.
        * tree.h: Remove lang_init_options and lang_decode_option.
        * cp/cp-tree.h (lang_decode_option): Rename cxx_decode_option.
        * cp/decl2.c: Similarly.
        * cp/lex.c (lang_init_options): Rename cxx_init_options.
        (lang_hooks): Update.
        * f/com.c (f_init, f_finish): Rename ffe_init, ffe_finish
        for consistency.
        (lang_init_options): Rename ffe_init_options.
        (lang_hooks): Update.
        (lang_decode_option): Remove.
        * java/lang.c (lang_init_options): Rename java_init_options.
        (lang_decode_option): Rename java_decode_option.
        (lang_hooks): Update.
        * objc/objc-act.c (lang_init_options): Rename objc_init_options.
        (lang_decode_option): Rename objc_decode_option.
        (lang_hooks): Update.

From-SVN: r38856
parent 8541c24b
2001-01-10 Neil Booth <neil@daikokuya.demon.co.uk>
* c-lang.c (lang_hooks): Update.
(lang_decode_option): Remove.
(lang_init_options): Rename c_init_options.
* toplev.c (main): Use lang_hooks for lang_init_options
and lang_decode_option.
* toplev.h (lang_hooks): Add 2 new hooks.
* tree.h: Remove lang_init_options and lang_decode_option.
* cp/cp-tree.h (lang_decode_option): Rename cxx_decode_option.
* cp/decl2.c: Similarly.
* cp/lex.c (lang_init_options): Rename cxx_init_options.
(lang_hooks): Update.
* f/com.c (f_init, f_finish): Rename ffe_init, ffe_finish
for consistency.
(lang_init_options): Rename ffe_init_options.
(lang_hooks): Update.
(lang_decode_option): Remove.
* java/lang.c (lang_init_options): Rename java_init_options.
(lang_decode_option): Rename java_decode_option.
(lang_hooks): Update.
* objc/objc-act.c (lang_init_options): Rename objc_init_options.
(lang_decode_option): Rename objc_decode_option.
(lang_hooks): Update.
2001-01-09 Nick Clifton <nickc@redhat.com> 2001-01-09 Nick Clifton <nickc@redhat.com>
* config/d30v/d30v.c (d30v_eh_epilogue_sp_ofs): Delete. * config/d30v/d30v.c (d30v_eh_epilogue_sp_ofs): Delete.
......
...@@ -39,11 +39,14 @@ Boston, MA 02111-1307, USA. */ ...@@ -39,11 +39,14 @@ Boston, MA 02111-1307, USA. */
static int c_tree_printer PARAMS ((output_buffer *)); static int c_tree_printer PARAMS ((output_buffer *));
static int c_missing_noreturn_ok_p PARAMS ((tree)); static int c_missing_noreturn_ok_p PARAMS ((tree));
static void c_init PARAMS ((void)); static void c_init PARAMS ((void));
static void c_init_options PARAMS ((void));
static void c_post_options PARAMS ((void)); static void c_post_options PARAMS ((void));
/* Each front end provides its own. */ /* Each front end provides its own. */
struct lang_hooks lang_hooks = {c_init, struct lang_hooks lang_hooks = {c_init,
NULL, /* c_finish */ NULL, /* c_finish */
c_init_options,
c_decode_option,
c_post_options}; c_post_options};
/* Post-switch processing. */ /* Post-switch processing. */
...@@ -53,18 +56,8 @@ c_post_options () ...@@ -53,18 +56,8 @@ c_post_options ()
cpp_post_options (parse_in); cpp_post_options (parse_in);
} }
/* Each of the functions defined here static void
is an alternative to a function in objc-actions.c. */ c_init_options ()
int
lang_decode_option (argc, argv)
int argc;
char **argv;
{
return c_decode_option (argc, argv);
}
void
lang_init_options ()
{ {
parse_in = cpp_create_reader (CLK_GNUC89); parse_in = cpp_create_reader (CLK_GNUC89);
......
...@@ -3913,7 +3913,7 @@ extern tmpl_spec_kind current_tmpl_spec_kind PARAMS ((int)); ...@@ -3913,7 +3913,7 @@ extern tmpl_spec_kind current_tmpl_spec_kind PARAMS ((int));
/* in decl2.c */ /* in decl2.c */
extern void init_decl2 PARAMS ((void)); extern void init_decl2 PARAMS ((void));
extern int check_java_method PARAMS ((tree)); extern int check_java_method PARAMS ((tree));
extern int lang_decode_option PARAMS ((int, char **)); extern int cxx_decode_option PARAMS ((int, char **));
extern int grok_method_quals PARAMS ((tree, tree, tree)); extern int grok_method_quals PARAMS ((tree, tree, tree));
extern void warn_if_unknown_interface PARAMS ((tree)); extern void warn_if_unknown_interface PARAMS ((tree));
extern void grok_x_components PARAMS ((tree)); extern void grok_x_components PARAMS ((tree));
......
...@@ -560,7 +560,7 @@ compare_options (p1, p2) ...@@ -560,7 +560,7 @@ compare_options (p1, p2)
recognise the option. */ recognise the option. */
int int
lang_decode_option (argc, argv) cxx_decode_option (argc, argv)
int argc; int argc;
char **argv; char **argv;
{ {
......
...@@ -63,6 +63,7 @@ static void handle_pragma_interface PARAMS ((cpp_reader *)); ...@@ -63,6 +63,7 @@ static void handle_pragma_interface PARAMS ((cpp_reader *));
static void handle_pragma_implementation PARAMS ((cpp_reader *)); static void handle_pragma_implementation PARAMS ((cpp_reader *));
static void cxx_init PARAMS ((void)); static void cxx_init PARAMS ((void));
static void cxx_finish PARAMS ((void)); static void cxx_finish PARAMS ((void));
static void cxx_init_options PARAMS ((void));
static void cxx_post_options PARAMS ((void)); static void cxx_post_options PARAMS ((void));
#ifdef GATHER_STATISTICS #ifdef GATHER_STATISTICS
...@@ -246,6 +247,8 @@ static const char *cplus_tree_code_name[] = { ...@@ -246,6 +247,8 @@ static const char *cplus_tree_code_name[] = {
/* Each front end provides its own hooks, for toplev.c. */ /* Each front end provides its own hooks, for toplev.c. */
struct lang_hooks lang_hooks = {cxx_init, struct lang_hooks lang_hooks = {cxx_init,
cxx_finish, cxx_finish,
cxx_init_options,
cxx_decode_option,
cxx_post_options}; cxx_post_options};
/* Post-switch processing. */ /* Post-switch processing. */
...@@ -255,8 +258,8 @@ cxx_post_options () ...@@ -255,8 +258,8 @@ cxx_post_options ()
cpp_post_options (parse_in); cpp_post_options (parse_in);
} }
void static void
lang_init_options () cxx_init_options ()
{ {
parse_in = cpp_create_reader (CLK_GNUCXX); parse_in = cpp_create_reader (CLK_GNUCXX);
......
...@@ -14677,21 +14677,16 @@ insert_block (block) ...@@ -14677,21 +14677,16 @@ insert_block (block)
} }
/* Each front end provides its own. */ /* Each front end provides its own. */
static void f_init PARAMS ((void)); static void ffe_init PARAMS ((void));
static void f_finish PARAMS ((void)); static void ffe_finish PARAMS ((void));
static void ffe_init_options PARAMS ((void));
struct lang_hooks lang_hooks = {f_init,
f_finish, struct lang_hooks lang_hooks = {ffe_init,
ffe_finish,
ffe_init_options,
ffe_decode_option,
NULL /* post_options */}; NULL /* post_options */};
int
lang_decode_option (argc, argv)
int argc;
char **argv;
{
return ffe_decode_option (argc, argv);
}
/* used by print-tree.c */ /* used by print-tree.c */
void void
...@@ -14703,7 +14698,7 @@ lang_print_xnode (file, node, indent) ...@@ -14703,7 +14698,7 @@ lang_print_xnode (file, node, indent)
} }
static void static void
f_finish () ffe_finish ()
{ {
ffe_terminate_0 (); ffe_terminate_0 ();
...@@ -14732,8 +14727,8 @@ lang_get_alias_set (t) ...@@ -14732,8 +14727,8 @@ lang_get_alias_set (t)
return 0; return 0;
} }
void static void
lang_init_options () ffe_init_options ()
{ {
/* Set default options for Fortran. */ /* Set default options for Fortran. */
flag_move_all_movables = 1; flag_move_all_movables = 1;
...@@ -14744,7 +14739,7 @@ lang_init_options () ...@@ -14744,7 +14739,7 @@ lang_init_options ()
} }
static void static void
f_init () ffe_init ()
{ {
/* If the file is output from cpp, it should contain a first line /* If the file is output from cpp, it should contain a first line
`# 1 "real-filename"', and the current design of gcc (toplev.c `# 1 "real-filename"', and the current design of gcc (toplev.c
......
...@@ -46,6 +46,8 @@ struct string_option ...@@ -46,6 +46,8 @@ struct string_option
}; };
static void java_init PARAMS ((void)); static void java_init PARAMS ((void));
static void java_init_options PARAMS ((void));
static int java_decode_option PARAMS ((int, char **));
static void put_decl_string PARAMS ((const char *, int)); static void put_decl_string PARAMS ((const char *, int));
static void put_decl_node PARAMS ((tree)); static void put_decl_node PARAMS ((tree));
static void java_dummy_print PARAMS ((const char *)); static void java_dummy_print PARAMS ((const char *));
...@@ -190,6 +192,8 @@ static int dependency_tracking = 0; ...@@ -190,6 +192,8 @@ static int dependency_tracking = 0;
/* Each front end provides its own. */ /* Each front end provides its own. */
struct lang_hooks lang_hooks = {java_init, struct lang_hooks lang_hooks = {java_init,
NULL, /* java_finish */ NULL, /* java_finish */
java_init_options,
java_decode_option,
NULL /* post_options */}; NULL /* post_options */};
/* Process an option that can accept a `no-' form. /* Process an option that can accept a `no-' form.
...@@ -224,8 +228,8 @@ process_option_with_no (p, table, table_size) ...@@ -224,8 +228,8 @@ process_option_with_no (p, table, table_size)
* process java-specific compiler command-line options * process java-specific compiler command-line options
* return 0, but do not complain if the option is not recognised. * return 0, but do not complain if the option is not recognised.
*/ */
int static int
lang_decode_option (argc, argv) java_decode_option (argc, argv)
int argc __attribute__ ((__unused__)); int argc __attribute__ ((__unused__));
char **argv; char **argv;
{ {
...@@ -678,8 +682,8 @@ void lang_init_source (level) ...@@ -678,8 +682,8 @@ void lang_init_source (level)
print_error_function = lang_print_error; print_error_function = lang_print_error;
} }
void static void
lang_init_options () java_init_options ()
{ {
flag_new_exceptions = 1; flag_new_exceptions = 1;
flag_bounds_check = 1; flag_bounds_check = 1;
......
...@@ -148,8 +148,10 @@ char *util_firstobj; ...@@ -148,8 +148,10 @@ char *util_firstobj;
static void init_objc PARAMS ((void)); static void init_objc PARAMS ((void));
static void finish_objc PARAMS ((void)); static void finish_objc PARAMS ((void));
static void objc_post_options PARAMS ((void));
static void objc_init PARAMS ((void)); static void objc_init PARAMS ((void));
static void objc_init_options PARAMS ((void));
static int objc_decode_option PARAMS ((int, char **));
static void objc_post_options PARAMS ((void));
/* Code generation. */ /* Code generation. */
...@@ -631,6 +633,8 @@ static int print_struct_values = 0; ...@@ -631,6 +633,8 @@ static int print_struct_values = 0;
/* Each front end provides its own. */ /* Each front end provides its own. */
struct lang_hooks lang_hooks = {objc_init, struct lang_hooks lang_hooks = {objc_init,
NULL, /* objc_finish */ NULL, /* objc_finish */
objc_init_options,
objc_decode_option,
objc_post_options}; objc_post_options};
/* Post-switch processing. */ /* Post-switch processing. */
...@@ -703,8 +707,8 @@ generate_struct_by_value_array () ...@@ -703,8 +707,8 @@ generate_struct_by_value_array ()
exit (0); exit (0);
} }
void static void
lang_init_options () objc_init_options ()
{ {
parse_in = cpp_create_reader (CLK_OBJC); parse_in = cpp_create_reader (CLK_OBJC);
c_language = clk_objective_c; c_language = clk_objective_c;
...@@ -774,8 +778,8 @@ lang_identify () ...@@ -774,8 +778,8 @@ lang_identify ()
return "objc"; return "objc";
} }
int static int
lang_decode_option (argc, argv) objc_decode_option (argc, argv)
int argc; int argc;
char **argv; char **argv;
{ {
......
...@@ -4590,7 +4590,8 @@ main (argc, argv) ...@@ -4590,7 +4590,8 @@ main (argc, argv)
initialize_diagnostics (); initialize_diagnostics ();
/* Perform language-specific options intialization. */ /* Perform language-specific options intialization. */
lang_init_options (); if (lang_hooks.init_options)
(*lang_hooks.init_options) ();
/* Scan to see what optimization level has been specified. That will /* Scan to see what optimization level has been specified. That will
determine the default value of many flags. */ determine the default value of many flags. */
...@@ -4700,7 +4701,7 @@ main (argc, argv) ...@@ -4700,7 +4701,7 @@ main (argc, argv)
unsigned int indep_processed; unsigned int indep_processed;
/* Give the language a chance to decode the option for itself. */ /* Give the language a chance to decode the option for itself. */
lang_processed = lang_decode_option (argc - i, argv + i); lang_processed = (*lang_hooks.decode_option) (argc - i, argv + i);
/* Now see if the option also has a language independent meaning. /* Now see if the option also has a language independent meaning.
Some options are both language specific and language independent, Some options are both language specific and language independent,
...@@ -4770,7 +4771,7 @@ main (argc, argv) ...@@ -4770,7 +4771,7 @@ main (argc, argv)
flag_no_inline = 1; flag_no_inline = 1;
warn_inline = 0; warn_inline = 0;
/* The c_decode_option and lang_decode_option functions set /* The c_decode_option function and decode_option hook set
this to `2' if -Wall is used, so we can avoid giving out this to `2' if -Wall is used, so we can avoid giving out
lots of errors for people who don't realize what -Wall does. */ lots of errors for people who don't realize what -Wall does. */
if (warn_uninitialized == 1) if (warn_uninitialized == 1)
......
...@@ -142,6 +142,16 @@ struct lang_hooks ...@@ -142,6 +142,16 @@ struct lang_hooks
/* Called last, as a finalizer. */ /* Called last, as a finalizer. */
void (*finish) PARAMS ((void)); void (*finish) PARAMS ((void));
/* Called to initialize options, before any calls to decode_option. */
void (*init_options) PARAMS ((void));
/* Function called with an option vector as argument, to decode a
single option (typically starting with -f or -W or +). It should
return the number of command-line arguments it uses if it handles
the option, or 0 and not complain if it does not recognise the
option. This hook cannot be NULL. */
int (*decode_option) PARAMS ((int, char **));
/* Called when all command line options have been processed. */ /* Called when all command line options have been processed. */
void (*post_options) PARAMS ((void)); void (*post_options) PARAMS ((void));
}; };
......
...@@ -2563,9 +2563,6 @@ extern tree fold_builtin PARAMS ((tree)); ...@@ -2563,9 +2563,6 @@ extern tree fold_builtin PARAMS ((tree));
/* The language front-end must define these functions. */ /* The language front-end must define these functions. */
/* Function of no arguments for initializing options. */
extern void lang_init_options PARAMS ((void));
/* Function of no arguments for initializing lexical scanning. */ /* Function of no arguments for initializing lexical scanning. */
extern void init_lex PARAMS ((void)); extern void init_lex PARAMS ((void));
/* Function of no arguments for initializing the symbol table. */ /* Function of no arguments for initializing the symbol table. */
...@@ -2583,11 +2580,6 @@ extern void copy_lang_decl PARAMS ((tree)); ...@@ -2583,11 +2580,6 @@ extern void copy_lang_decl PARAMS ((tree));
/* Function called with no arguments to parse and compile the input. */ /* Function called with no arguments to parse and compile the input. */
extern int yyparse PARAMS ((void)); extern int yyparse PARAMS ((void));
/* Function called with option as argument
to decode options starting with -f or -W or +.
It should return nonzero if it handles the option. */
extern int lang_decode_option PARAMS ((int, char **));
/* Functions for processing symbol declarations. */ /* Functions for processing symbol declarations. */
/* Function to enter a new lexical scope. /* Function to enter a new lexical scope.
Takes one argument: always zero when called from outside the front end. */ Takes one argument: always zero when called from outside the front end. */
......
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