diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2e6206c459b..559b125db6e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2001-01-07 Neil Booth + + * toplev.c (main): Call the front-end specific post_options + hook if one is given. + * toplev.h (struct_lang_hooks, lang_hooks): New. + * c-lang.c (c_post_options, lang_hooks): Implement lang_hooks + for the C front end. + * cp/decl2.c (cxx_post_options, lang_hooks): Implement + lang_hooks for the C++ front end. + * objc/objc-act.c (objc_post_options, lang_hooks): Implement + lang_hooks for the ObjC front end. + * f/com.c (lang_hooks): Hooks for the Fortran front end. + * java/lang.c (lang_hooks): Hooks for the Java front end. + 2001-01-07 Neil Booth * c-lex.c (init_c_lex): Request #define / #undef callbacks diff --git a/gcc/c-lang.c b/gcc/c-lang.c index b96895d4c87..52f6015a49f 100644 --- a/gcc/c-lang.c +++ b/gcc/c-lang.c @@ -38,10 +38,19 @@ 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_post_options PARAMS ((void)); + +/* Each front end provides its own. */ +struct lang_hooks lang_hooks = {c_post_options}; + +/* Post-switch processing. */ +static void +c_post_options () +{ +} /* Each of the functions defined here is an alternative to a function in objc-actions.c. */ - int lang_decode_option (argc, argv) int argc; diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 1a38f4488ff..4daf5909d8b 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -59,6 +59,7 @@ typedef struct priority_info_s { int destructions_p; } *priority_info; +static void cxx_post_options PARAMS ((void)); static void mark_vtable_entries PARAMS ((tree)); static void grok_function_init PARAMS ((tree, tree)); static int finish_vtable_vardecl PARAMS ((tree *, void *)); @@ -543,6 +544,15 @@ static const char * const unsupported_options[] = { "strict-prototype", }; +/* Each front end provides its own. */ +struct lang_hooks lang_hooks = {cxx_post_options}; + +/* Post-switch processing. */ +static void +cxx_post_options () +{ +} + /* Compare two option strings, pointed two by P1 and P2, for use with bsearch. */ diff --git a/gcc/f/com.c b/gcc/f/com.c index 40d511664e4..f6f80e03bac 100644 --- a/gcc/f/com.c +++ b/gcc/f/com.c @@ -14676,6 +14676,9 @@ insert_block (block) = chainon (current_binding_level->blocks, block); } +/* Each front end provides its own. */ +struct lang_hooks lang_hooks = {NULL /* post_options */}; + int lang_decode_option (argc, argv) int argc; diff --git a/gcc/java/lang.c b/gcc/java/lang.c index 7565eba9e24..3a9f34509dd 100644 --- a/gcc/java/lang.c +++ b/gcc/java/lang.c @@ -186,6 +186,9 @@ static int dependency_tracking = 0; #define DEPEND_TARGET_SET 4 #define DEPEND_FILE_ALREADY_SET 8 +/* Each front end provides its own. */ +struct lang_hooks lang_hooks = {NULL /* post_options */}; + /* Process an option that can accept a `no-' form. Return 1 if option found, 0 otherwise. */ static int diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 99f2d23055c..06b0e8cbcf3 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -148,6 +148,7 @@ char *util_firstobj; static void init_objc PARAMS ((void)); static void finish_objc PARAMS ((void)); +static void objc_post_options PARAMS ((void)); /* Code generation. */ @@ -626,6 +627,15 @@ static int generating_instance_variables = 0; static int print_struct_values = 0; +/* Each front end provides its own. */ +struct lang_hooks lang_hooks = {objc_post_options}; + +/* Post-switch processing. */ +static void +objc_post_options () +{ +} + /* Some platforms pass small structures through registers versus through an invisible pointer. Determine at what size structure is the transition point between the two possibilities. */ diff --git a/gcc/toplev.c b/gcc/toplev.c index 16081371005..0d51302471f 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -4750,6 +4750,10 @@ main (argc, argv) } } + /* All command line options have been processed. */ + if (lang_hooks.post_options) + (*lang_hooks.post_options) (); + /* Reflect any language-specific diagnostic option setting. */ reshape_diagnostic_buffer (); diff --git a/gcc/toplev.h b/gcc/toplev.h index 4e029c0861f..05fca0103a1 100644 --- a/gcc/toplev.h +++ b/gcc/toplev.h @@ -133,4 +133,14 @@ extern int sorrycount; extern const char *progname; +/* Language-specific hooks. */ +struct lang_hooks +{ + /* If non-NULL, called when all command line options have been processed. */ + void (*post_options) PARAMS ((void)); +}; + +/* Each front end provides its own. */ +extern struct lang_hooks lang_hooks; + #endif /* __GCC_TOPLEV_H */