return false;
}
+/* Look up ARG in the enum used by option OPT_INDEX for language
+ LANG_MASK, returning true and storing the value in *VALUE if found,
+ and returning false without modifying *VALUE if not found. */
+
+bool
+opt_enum_arg_to_value (size_t opt_index, const char *arg, int *value,
+ unsigned int lang_mask)
+{
+ const struct cl_option *option = &cl_options[opt_index];
+
+ gcc_assert (option->var_type == CLVC_ENUM);
+
+ return enum_arg_to_value (cl_enums[option->var_enum].values, arg,
+ value, lang_mask);
+}
+
/* Look of VALUE in ENUM_ARGS for language LANG_MASK and store the
corresponding string in *ARGP, returning true if the found string
was marked as canonical, false otherwise. If VALUE is not found
if (!option_ok_for_language (option, lang_mask))
errors |= CL_ERR_WRONG_LANG;
+ /* Convert the argument to lowercase if appropriate. */
+ if (arg && option->cl_tolower)
+ {
+ size_t j;
+ size_t len = strlen (arg);
+ char *arg_lower = XNEWVEC (char, len + 1);
+
+ for (j = 0; j < len; j++)
+ arg_lower[j] = TOLOWER ((unsigned char) arg[j]);
+ arg_lower[len] = 0;
+ arg = arg_lower;
+ }
+
/* If the switch takes an integer, convert it. */
if (arg && option->cl_uinteger)
{
unsigned int n, i;
struct cl_decoded_option *opt_array;
unsigned int num_decoded_options;
- bool argv_copied = false;
opt_array = XNEWVEC (struct cl_decoded_option, argc);
num_decoded_options++;
}
- if (argv_copied)
- free (argv);
*decoded_options = opt_array;
*decoded_options_count = num_decoded_options;
prune_options (decoded_options, decoded_options_count);
lang_mask, kind, loc,
handlers, dc))
return false;
- else
- handlers->post_handling_callback (decoded,
- handlers->handlers[i].mask);
}
return true;
break;
case CLVC_EQUAL:
- *(int *) flag_var = (value
- ? option->var_value
- : !option->var_value);
+ if (option->cl_host_wide_int)
+ *(HOST_WIDE_INT *) flag_var = (value
+ ? option->var_value
+ : !option->var_value);
+ else
+ *(int *) flag_var = (value
+ ? option->var_value
+ : !option->var_value);
if (set_flag_var)
*(int *) set_flag_var = 1;
break;
case CLVC_BIT_CLEAR:
case CLVC_BIT_SET:
if ((value != 0) == (option->var_type == CLVC_BIT_SET))
- *(int *) flag_var |= option->var_value;
+ {
+ if (option->cl_host_wide_int)
+ *(HOST_WIDE_INT *) flag_var |= option->var_value;
+ else
+ *(int *) flag_var |= option->var_value;
+ }
else
- *(int *) flag_var &= ~option->var_value;
+ {
+ if (option->cl_host_wide_int)
+ *(HOST_WIDE_INT *) flag_var &= ~option->var_value;
+ else
+ *(int *) flag_var &= ~option->var_value;
+ }
if (set_flag_var)
- *(int *) set_flag_var |= option->var_value;
+ {
+ if (option->cl_host_wide_int)
+ *(HOST_WIDE_INT *) set_flag_var |= option->var_value;
+ else
+ *(int *) set_flag_var |= option->var_value;
+ }
break;
case CLVC_STRING:
return *(int *) flag_var != 0;
case CLVC_EQUAL:
- return *(int *) flag_var == option->var_value;
+ if (option->cl_host_wide_int)
+ return *(HOST_WIDE_INT *) flag_var == option->var_value;
+ else
+ return *(int *) flag_var == option->var_value;
case CLVC_BIT_CLEAR:
- return (*(int *) flag_var & option->var_value) == 0;
+ if (option->cl_host_wide_int)
+ return (*(HOST_WIDE_INT *) flag_var & option->var_value) == 0;
+ else
+ return (*(int *) flag_var & option->var_value) == 0;
case CLVC_BIT_SET:
- return (*(int *) flag_var & option->var_value) != 0;
+ if (option->cl_host_wide_int)
+ return (*(HOST_WIDE_INT *) flag_var & option->var_value) != 0;
+ else
+ return (*(int *) flag_var & option->var_value) != 0;
case CLVC_STRING:
case CLVC_ENUM:
case CLVC_BOOLEAN:
case CLVC_EQUAL:
state->data = flag_var;
- state->size = sizeof (int);
+ state->size = (cl_options[option].cl_host_wide_int
+ ? sizeof (HOST_WIDE_INT)
+ : sizeof (int));
break;
case CLVC_BIT_CLEAR: