+2016-05-12 Marek Polacek <polacek@redhat.com>
+
+ PR driver/71063
+ * opts.c (common_handle_option): Detect missing argument for --help^.
+
2016-05-12 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
PR target/70830
case OPT__help_:
{
- const char * a = arg;
+ const char *a = arg;
unsigned int include_flags = 0;
/* Note - by default we include undocumented options when listing
specific classes. If you only want to see documented options
arg = [^]{word}[,{arg}]
word = {optimizers|target|warnings|undocumented|
params|common|<language>} */
- while (* a != 0)
+ while (*a != 0)
{
static const struct
{
- const char * string;
+ const char *string;
unsigned int flag;
}
specifics[] =
{ "common", CL_COMMON },
{ NULL, 0 }
};
- unsigned int * pflags;
- const char * comma;
+ unsigned int *pflags;
+ const char *comma;
unsigned int lang_flag, specific_flag;
unsigned int len;
unsigned int i;
- if (* a == '^')
+ if (*a == '^')
{
- ++ a;
- pflags = & exclude_flags;
+ ++a;
+ if (*a == '\0')
+ {
+ error_at (loc, "missing argument to %qs", "--help=^");
+ break;
+ }
+ pflags = &exclude_flags;
}
else
- pflags = & include_flags;
+ pflags = &include_flags;
comma = strchr (a, ',');
if (comma == NULL)
if (specific_flag != 0)
{
if (lang_flag == 0)
- * pflags |= specific_flag;
+ *pflags |= specific_flag;
else
{
/* The option's argument matches both the start of a
specified "--help=c", but otherwise we have to issue
a warning. */
if (strncasecmp (a, "c", len) == 0)
- * pflags |= lang_flag;
+ *pflags |= lang_flag;
else
warning_at (loc, 0,
"--help argument %q.*s is ambiguous, "
}
}
else if (lang_flag != 0)
- * pflags |= lang_flag;
+ *pflags |= lang_flag;
else
warning_at (loc, 0,
"unrecognized argument to --help= option: %q.*s",