aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog25
-rw-r--r--gcc/c-lang.c17
-rw-r--r--gcc/cp/cp-tree.h2
-rw-r--r--gcc/cp/decl2.c2
-rw-r--r--gcc/cp/lex.c7
-rw-r--r--gcc/f/com.c29
-rw-r--r--gcc/java/lang.c12
-rw-r--r--gcc/objc/objc-act.c14
-rw-r--r--gcc/toplev.c7
-rw-r--r--gcc/toplev.h10
-rw-r--r--gcc/tree.h8
11 files changed, 80 insertions, 53 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5cc5582..8686ddf 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,28 @@
+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>
* config/d30v/d30v.c (d30v_eh_epilogue_sp_ofs): Delete.
diff --git a/gcc/c-lang.c b/gcc/c-lang.c
index f8cefb3..dfd772f 100644
--- a/gcc/c-lang.c
+++ b/gcc/c-lang.c
@@ -39,11 +39,14 @@ Boston, MA 02111-1307, USA. */
static int c_tree_printer PARAMS ((output_buffer *));
static int c_missing_noreturn_ok_p PARAMS ((tree));
static void c_init PARAMS ((void));
+static void c_init_options PARAMS ((void));
static void c_post_options PARAMS ((void));
/* Each front end provides its own. */
struct lang_hooks lang_hooks = {c_init,
NULL, /* c_finish */
+ c_init_options,
+ c_decode_option,
c_post_options};
/* Post-switch processing. */
@@ -53,18 +56,8 @@ c_post_options ()
cpp_post_options (parse_in);
}
-/* Each of the functions defined here
- is an alternative to a function in objc-actions.c. */
-int
-lang_decode_option (argc, argv)
- int argc;
- char **argv;
-{
- return c_decode_option (argc, argv);
-}
-
-void
-lang_init_options ()
+static void
+c_init_options ()
{
parse_in = cpp_create_reader (CLK_GNUC89);
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index e2309e9..d0664b1 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -3913,7 +3913,7 @@ extern tmpl_spec_kind current_tmpl_spec_kind PARAMS ((int));
/* in decl2.c */
extern void init_decl2 PARAMS ((void));
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 void warn_if_unknown_interface PARAMS ((tree));
extern void grok_x_components PARAMS ((tree));
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 8bdd43e..f051a45 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -560,7 +560,7 @@ compare_options (p1, p2)
recognise the option. */
int
-lang_decode_option (argc, argv)
+cxx_decode_option (argc, argv)
int argc;
char **argv;
{
diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
index 3203b4c..f295e7c 100644
--- a/gcc/cp/lex.c
+++ b/gcc/cp/lex.c
@@ -63,6 +63,7 @@ static void handle_pragma_interface PARAMS ((cpp_reader *));
static void handle_pragma_implementation PARAMS ((cpp_reader *));
static void cxx_init PARAMS ((void));
static void cxx_finish PARAMS ((void));
+static void cxx_init_options PARAMS ((void));
static void cxx_post_options PARAMS ((void));
#ifdef GATHER_STATISTICS
@@ -246,6 +247,8 @@ static const char *cplus_tree_code_name[] = {
/* Each front end provides its own hooks, for toplev.c. */
struct lang_hooks lang_hooks = {cxx_init,
cxx_finish,
+ cxx_init_options,
+ cxx_decode_option,
cxx_post_options};
/* Post-switch processing. */
@@ -255,8 +258,8 @@ cxx_post_options ()
cpp_post_options (parse_in);
}
-void
-lang_init_options ()
+static void
+cxx_init_options ()
{
parse_in = cpp_create_reader (CLK_GNUCXX);
diff --git a/gcc/f/com.c b/gcc/f/com.c
index cdd48bf..3e66467 100644
--- a/gcc/f/com.c
+++ b/gcc/f/com.c
@@ -14677,21 +14677,16 @@ insert_block (block)
}
/* Each front end provides its own. */
-static void f_init PARAMS ((void));
-static void f_finish PARAMS ((void));
-
-struct lang_hooks lang_hooks = {f_init,
- f_finish,
+static void ffe_init PARAMS ((void));
+static void ffe_finish PARAMS ((void));
+static void ffe_init_options PARAMS ((void));
+
+struct lang_hooks lang_hooks = {ffe_init,
+ ffe_finish,
+ ffe_init_options,
+ ffe_decode_option,
NULL /* post_options */};
-int
-lang_decode_option (argc, argv)
- int argc;
- char **argv;
-{
- return ffe_decode_option (argc, argv);
-}
-
/* used by print-tree.c */
void
@@ -14703,7 +14698,7 @@ lang_print_xnode (file, node, indent)
}
static void
-f_finish ()
+ffe_finish ()
{
ffe_terminate_0 ();
@@ -14732,8 +14727,8 @@ lang_get_alias_set (t)
return 0;
}
-void
-lang_init_options ()
+static void
+ffe_init_options ()
{
/* Set default options for Fortran. */
flag_move_all_movables = 1;
@@ -14744,7 +14739,7 @@ lang_init_options ()
}
static void
-f_init ()
+ffe_init ()
{
/* If the file is output from cpp, it should contain a first line
`# 1 "real-filename"', and the current design of gcc (toplev.c
diff --git a/gcc/java/lang.c b/gcc/java/lang.c
index 9b299b2..a88203c 100644
--- a/gcc/java/lang.c
+++ b/gcc/java/lang.c
@@ -46,6 +46,8 @@ struct string_option
};
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_node PARAMS ((tree));
static void java_dummy_print PARAMS ((const char *));
@@ -190,6 +192,8 @@ static int dependency_tracking = 0;
/* Each front end provides its own. */
struct lang_hooks lang_hooks = {java_init,
NULL, /* java_finish */
+ java_init_options,
+ java_decode_option,
NULL /* post_options */};
/* Process an option that can accept a `no-' form.
@@ -224,8 +228,8 @@ process_option_with_no (p, table, table_size)
* process java-specific compiler command-line options
* return 0, but do not complain if the option is not recognised.
*/
-int
-lang_decode_option (argc, argv)
+static int
+java_decode_option (argc, argv)
int argc __attribute__ ((__unused__));
char **argv;
{
@@ -678,8 +682,8 @@ void lang_init_source (level)
print_error_function = lang_print_error;
}
-void
-lang_init_options ()
+static void
+java_init_options ()
{
flag_new_exceptions = 1;
flag_bounds_check = 1;
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index b70c3e6..12af8f9 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -148,8 +148,10 @@ char *util_firstobj;
static void init_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_options PARAMS ((void));
+static int objc_decode_option PARAMS ((int, char **));
+static void objc_post_options PARAMS ((void));
/* Code generation. */
@@ -631,6 +633,8 @@ static int print_struct_values = 0;
/* Each front end provides its own. */
struct lang_hooks lang_hooks = {objc_init,
NULL, /* objc_finish */
+ objc_init_options,
+ objc_decode_option,
objc_post_options};
/* Post-switch processing. */
@@ -703,8 +707,8 @@ generate_struct_by_value_array ()
exit (0);
}
-void
-lang_init_options ()
+static void
+objc_init_options ()
{
parse_in = cpp_create_reader (CLK_OBJC);
c_language = clk_objective_c;
@@ -774,8 +778,8 @@ lang_identify ()
return "objc";
}
-int
-lang_decode_option (argc, argv)
+static int
+objc_decode_option (argc, argv)
int argc;
char **argv;
{
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 32effd4..e9ca071 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -4590,7 +4590,8 @@ main (argc, argv)
initialize_diagnostics ();
/* 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
determine the default value of many flags. */
@@ -4700,7 +4701,7 @@ main (argc, argv)
unsigned int indep_processed;
/* 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.
Some options are both language specific and language independent,
@@ -4770,7 +4771,7 @@ main (argc, argv)
flag_no_inline = 1;
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
lots of errors for people who don't realize what -Wall does. */
if (warn_uninitialized == 1)
diff --git a/gcc/toplev.h b/gcc/toplev.h
index f0c37f8..97134d9 100644
--- a/gcc/toplev.h
+++ b/gcc/toplev.h
@@ -142,6 +142,16 @@ struct lang_hooks
/* Called last, as a finalizer. */
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. */
void (*post_options) PARAMS ((void));
};
diff --git a/gcc/tree.h b/gcc/tree.h
index b6129fc..d77336f 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -2563,9 +2563,6 @@ extern tree fold_builtin PARAMS ((tree));
/* 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. */
extern void init_lex PARAMS ((void));
/* Function of no arguments for initializing the symbol table. */
@@ -2583,11 +2580,6 @@ extern void copy_lang_decl PARAMS ((tree));
/* Function called with no arguments to parse and compile the input. */
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. */
/* Function to enter a new lexical scope.
Takes one argument: always zero when called from outside the front end. */