From 5f20c6574d02381a0d928beda3eff69dc00af1cb Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Tue, 27 Jul 2010 22:23:53 +0100 Subject: 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 --- gcc/ada/ChangeLog | 5 +++++ gcc/ada/gcc-interface/misc.c | 22 ++++++++-------------- 2 files changed, 13 insertions(+), 14 deletions(-) (limited to 'gcc/ada') diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index a8506db..7324c3a 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,10 @@ 2010-07-27 Joseph Myers + * gcc-interface/misc.c (gnat_handle_option): Update prototype and + return value type. Don't check for missing arguments here. + +2010-07-27 Joseph Myers + * gcc-interface/misc.c (gnat_option_lang_mask): New. (gnat_init_options): Update prototype. Reconstruct argv array from decoded options. diff --git a/gcc/ada/gcc-interface/misc.c b/gcc/ada/gcc-interface/misc.c index 43ed157..01b33a3 100644 --- a/gcc/ada/gcc-interface/misc.c +++ b/gcc/ada/gcc-interface/misc.c @@ -64,7 +64,8 @@ static bool gnat_init (void); static unsigned int gnat_option_lang_mask (void); static void gnat_init_options (unsigned int, struct cl_decoded_option *); -static int gnat_handle_option (size_t, const char *, int, int); +static bool gnat_handle_option (size_t, const char *, int, int, + const struct cl_option_handlers *); static bool gnat_post_options (const char **); static alias_set_type gnat_get_alias_set (tree); static void gnat_print_decl (FILE *, tree, int); @@ -186,22 +187,15 @@ gnat_parse_file (int set_yydebug ATTRIBUTE_UNUSED) /* Decode all the language specific options that cannot be decoded by GCC. The option decoding phase of GCC calls this routine on the flags that - it cannot decode. Return the number of consecutive arguments from ARGV - that have been successfully decoded or 0 on failure. */ + are marked as Ada-specific. Return true on success or false on failure. */ -static int -gnat_handle_option (size_t scode, const char *arg, int value, - int kind ATTRIBUTE_UNUSED) +static bool +gnat_handle_option (size_t scode, const char *arg ATTRIBUTE_UNUSED, int value, + int kind ATTRIBUTE_UNUSED, + const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED) { - const struct cl_option *option = &cl_options[scode]; enum opt_code code = (enum opt_code) scode; - if (arg == NULL && (option->flags & (CL_JOINED | CL_SEPARATE))) - { - error ("missing argument to \"-%s\"", option->opt_text); - return 1; - } - switch (code) { case OPT_Wall: @@ -250,7 +244,7 @@ gnat_handle_option (size_t scode, const char *arg, int value, gcc_unreachable (); } - return 1; + return true; } /* Return language mask for option processing. */ -- cgit v1.1