diff options
author | Joseph Myers <joseph@codesourcery.com> | 2010-07-27 22:23:53 +0100 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2010-07-27 22:23:53 +0100 |
commit | 5f20c6574d02381a0d928beda3eff69dc00af1cb (patch) | |
tree | f94ec6c06f2efb7241fe151e3dc75cfb9af059a1 /gcc/opts.h | |
parent | 689d6c4a78eb67a4eb256d27647660a7523958a4 (diff) | |
download | gcc-5f20c6574d02381a0d928beda3eff69dc00af1cb.zip gcc-5f20c6574d02381a0d928beda3eff69dc00af1cb.tar.gz gcc-5f20c6574d02381a0d928beda3eff69dc00af1cb.tar.bz2 |
coretypes.h (struct cl_option_handlers): Declare.
* coretypes.h (struct cl_option_handlers): Declare.
* hooks.c (hook_int_size_t_constcharptr_int_0): Remove.
* hooks.h (hook_int_size_t_constcharptr_int_0): Remove.
* langhooks-def.h (lhd_handle_option): Declare.
(LANG_HOOKS_HANDLE_OPTION): Use lhd_handle_option.
* langhooks.c (lhd_handle_option): New.
* langhooks.h (struct lang_hooks): Update prototype and return
value type of handle_option hook.
* optc-gen.awk: Generate target_flags_explicit definition for the
driver.
* opts-common.c: Include diagnostic.h.
(handle_option): Move from opts.c. Update prototype and return
value type. Use handlers structure.
(read_cmdline_option): Move from opts.c. Update prototype. Use
handlers structure.
(set_option): Move from opts.c.
* opts.c (common_handle_option): Update prototype and return value
type. Update calls to handle_option and enable_warning_as_error.
(unknown_option_callback, post_handling_callback,
lang_handle_option, target_handle_option): New.
(handle_option, read_cmdline_option): Move to opts-common.c.
(read_cmdline_options): Update prototype. Update call to
read_cmdline_option.
(decode_options): Initialize and use handlers structure.
(set_option): Move to opts-common.c.
(enable_warning_as_error): Update prototype. Update call to
handle_option.
* opts.h (struct cl_option_handler_func, struct
cl_option_handlers): New.
(handle_option, enable_warning_as_error): Update prototypes.
(read_cmdline_option): Declare.
* Makefile.in (opts-common.o): Update dependencies.
ada:
* gcc-interface/misc.c (gnat_handle_option): Update prototype and
return value type. Don't check for missing arguments here.
c-family:
* c-common.h (c_common_handle_option): Update prototype and return
value type.
* c-opts.c (c_common_handle_option): Update prototype and return
value type. Update calls to handle_option and
enable_warning_as_error.
fortran:
* gfortran.h (gfc_handle_option): Update prototype and return
value type.
* options.c (gfc_handle_option): Update prototype and return value
type.
java:
* lang.c (java_handle_option): Update prototype and return value
type.
lto:
* lto-lang.c (lto_handle_option): Update prototype and return
value type. Remove duplicate assignment to result.
From-SVN: r162601
Diffstat (limited to 'gcc/opts.h')
-rw-r--r-- | gcc/opts.h | 52 |
1 files changed, 49 insertions, 3 deletions
@@ -135,6 +135,47 @@ struct cl_decoded_option int errors; }; +/* Structure describing a single option-handling callback. */ + +struct cl_option_handler_func +{ + /* The function called to handle the option. */ + bool (*handler) (size_t opt_index, const char *arg, int value, + unsigned int lang_mask, int kind, + const struct cl_option_handlers *handlers); + + /* The mask that must have some bit in common with the flags for the + option for this particular handler to be used. */ + unsigned int mask; +}; + +/* Structure describing the callbacks used in handling options. */ + +struct cl_option_handlers +{ + /* Callback for an unknown option to determine whether to give an + error for it, and possibly store information to diagnose the + option at a later point. Return true if an error should be + given, false otherwise. */ + bool (*unknown_option_callback) (const char *opt); + + /* Callback to handle, and possibly diagnose, an option for another + language. */ + void (*wrong_lang_callback) (const char *text, + const struct cl_option *option, + unsigned int lang_mask); + + /* Callback to call after the successful handling of any option. */ + void (*post_handling_callback) (size_t opt_index, const char *arg, + int value, unsigned int mask); + + /* The number of individual handlers. */ + size_t num_handlers; + + /* The handlers themselves. */ + struct cl_option_handler_func handlers[3]; +}; + /* Input file names. */ extern const char **in_fnames; @@ -157,10 +198,15 @@ extern void decode_options (unsigned int argc, const char **argv, extern int option_enabled (int opt_idx); extern bool get_option_state (int, struct cl_option_state *); extern void set_option (int opt_index, int value, const char *arg, int); -bool handle_option (int opt_index, int value, const char *arg, - unsigned int lang_mask, int kind); +bool handle_option (size_t opt_index, const char *arg, int value, + unsigned int lang_mask, int kind, + const struct cl_option_handlers *handlers); +extern void read_cmdline_option (struct cl_decoded_option *decoded, + unsigned int lang_mask, + const struct cl_option_handlers *handlers); extern void register_warning_as_error_callback (void (*callback) (int)); extern void enable_warning_as_error (const char *arg, int value, - unsigned int lang_mask); + unsigned int lang_mask, + const struct cl_option_handlers *handlers); extern void print_ignored_options (void); #endif |