(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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@38856
138bc75d-0d04-0410-961f-
82ee72b054a4
+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.
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. */
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);
/* 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));
recognise the option. */
int
-lang_decode_option (argc, argv)
+cxx_decode_option (argc, argv)
int argc;
char **argv;
{
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
/* 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. */
cpp_post_options (parse_in);
}
-void
-lang_init_options ()
+static void
+cxx_init_options ()
{
parse_in = cpp_create_reader (CLK_GNUCXX);
}
/* 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
}
static void
-f_finish ()
+ffe_finish ()
{
ffe_terminate_0 ();
return 0;
}
-void
-lang_init_options ()
+static void
+ffe_init_options ()
{
/* Set default options for Fortran. */
flag_move_all_movables = 1;
}
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
};
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 *));
/* 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.
* 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;
{
print_error_function = lang_print_error;
}
-void
-lang_init_options ()
+static void
+java_init_options ()
{
flag_new_exceptions = 1;
flag_bounds_check = 1;
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. */
/* 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. */
exit (0);
}
-void
-lang_init_options ()
+static void
+objc_init_options ()
{
parse_in = cpp_create_reader (CLK_OBJC);
c_language = clk_objective_c;
return "objc";
}
-int
-lang_decode_option (argc, argv)
+static int
+objc_decode_option (argc, argv)
int argc;
char **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. */
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,
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)
/* 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));
};
\f
/* 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. */
/* 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. */