From e6d4b9841c35629de91c36ba40ed247fef749037 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Fri, 26 Nov 2010 23:18:28 +0000 Subject: options.texi (Enum, EnumValue): Document new record types. * doc/options.texi (Enum, EnumValue): Document new record types. (Enum): Document new option flag. * opt-functions.awk * optc-gen.awk: Handle enumerated option arguments. * opth-gen.awk: Handle enumerated option arguments. * opts-common.c (enum_arg_ok_for_language, enum_arg_to_value, enum_value_to_arg): New. (decode_cmdline_option): Handle enumerated arguments. (read_cmdline_option): Handle CL_ERR_ENUM_ARG. (set_option, option_enabled, get_option_state): Handle CLVC_ENUM. * opts.c (print_filtered_help, print_specific_help): Take lang_mask arguments. (print_filtered_help): Handle printing values of enumerated options. Print possible arguments for enumerated options. (print_specific_help): Update call to print_filtered_help. (common_handle_option): Update calls to print_specific_help. Use value rather than arg for OPT_fdiagnostics_show_location_. Don't handle OPT_ffp_contract_, OPT_fexcess_precision_, OPT_fvisibility_, OPT_ftls_model_, OPT_fira_algorithm_ or OPT_fira_region_ here. * opts.h (enum cl_var_type): Add CLVC_ENUM. (struct cl_option): Add var_enum. (CL_ENUM_CANONICAL, CL_ENUM_DRIVER_ONLY, struct cl_enum_arg, struct cl_enum, cl_enums, cl_enums_count): New. (CL_ERR_ENUM_ARG): Define. (CL_ERR_NEGATIVE): Update value. (enum_value_to_arg): Declare. * common.opt (flag_ira_algorithm, flag_ira_region, flag_fp_contract_mode, flag_excess_precision_cmdline, default_visibility, flag_tls_default): Remove Variable entries. (help_enum_printed): New Variable. (fdiagnostics-show-location=): Use Enum. Add associated SourceInclude, Enum and EnumValue entries. (fexcess-precision=, ffp-contract=, fira-algorithm=, fira-region=, ftls-model=, fvisibility=): Use Enum, Var and Init. Add associated Enum and EnumValue entries. po: * exgettext: Handle UnknownError. From-SVN: r167190 --- gcc/opt-functions.awk | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'gcc/opt-functions.awk') diff --git a/gcc/opt-functions.awk b/gcc/opt-functions.awk index 99bbb31..9aff0e0 100644 --- a/gcc/opt-functions.awk +++ b/gcc/opt-functions.awk @@ -150,6 +150,10 @@ function var_type(flags) { if (flag_set_p("Defer", flags)) return "void *" + else if (flag_set_p("Enum.*", flags)) { + en = opt_args("Enum", flags); + return enum_type[en] " " + } else if (!flag_set_p("Joined.*", flags) && !flag_set_p("Separate", flags)) return "int " else if (flag_set_p("UInteger", flags)) @@ -176,33 +180,37 @@ function var_type_struct(flags) } # Given that an option has flags FLAGS, return an initializer for the -# "var_cond" and "var_value" fields of its cl_options[] entry. +# "var_enum", "var_type" and "var_value" fields of its cl_options[] entry. function var_set(flags) { if (flag_set_p("Defer", flags)) - return "CLVC_DEFER, 0" + return "0, CLVC_DEFER, 0" s = nth_arg(1, opt_args("Var", flags)) if (s != "") - return "CLVC_EQUAL, " s + return "0, CLVC_EQUAL, " s s = opt_args("Mask", flags); if (s != "") { vn = var_name(flags); if (vn) - return "CLVC_BIT_SET, OPTION_MASK_" s + return "0, CLVC_BIT_SET, OPTION_MASK_" s else - return "CLVC_BIT_SET, MASK_" s + return "0, CLVC_BIT_SET, MASK_" s } s = nth_arg(0, opt_args("InverseMask", flags)); if (s != "") { vn = var_name(flags); if (vn) - return "CLVC_BIT_CLEAR, OPTION_MASK_" s + return "0, CLVC_BIT_CLEAR, OPTION_MASK_" s else - return "CLVC_BIT_CLEAR, MASK_" s + return "0, CLVC_BIT_CLEAR, MASK_" s + } + if (flag_set_p("Enum.*", flags)) { + en = opt_args("Enum", flags); + return enum_index[en] ", CLVC_ENUM, 0" } if (var_type(flags) == "const char *") - return "CLVC_STRING, 0" - return "CLVC_BOOLEAN, 0" + return "0, CLVC_STRING, 0" + return "0, CLVC_BOOLEAN, 0" } # Given that an option called NAME has flags FLAGS, return an initializer -- cgit v1.1