mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
made previous commit less hairy
* src/getargs.c : here
This commit is contained in:
committed by
yro3ht
parent
981c53e257
commit
fd01e1d05e
@@ -85,61 +85,42 @@ flags_argmatch (const char *option,
|
||||
if (args)
|
||||
{
|
||||
args = strtok (args, ",");
|
||||
|
||||
/* Not sure whether we should keep this : -Werror=no-bar */
|
||||
int no = STRPREFIX_LIT ("no-", args) ? 3 : 0;
|
||||
args += no;
|
||||
int value = 0;
|
||||
|
||||
while (args)
|
||||
{
|
||||
int err = STRPREFIX_LIT ("error", args);
|
||||
if (err)
|
||||
args += (args[5] == '=') ? 6 : 5;
|
||||
int value = all;
|
||||
int *save_flags = flags;
|
||||
int no = STRPREFIX_LIT ("no-", args) ? 3 : 0;
|
||||
int err = STRPREFIX_LIT ("error", args + no) ? 5 : 0;
|
||||
|
||||
if (!err || args[-1] == '=')
|
||||
value = XARGMATCH (option, args, keys, values);
|
||||
if (value == 0)
|
||||
{
|
||||
if (no)
|
||||
if (err)
|
||||
flags = &errors_flag;
|
||||
if (!err || args[no + err++] != '\0')
|
||||
value = XARGMATCH (option, args + no + err, keys, values);
|
||||
|
||||
if (!value)
|
||||
{
|
||||
if (err)
|
||||
/* Using &= ~all activates complaint, silent and fatal */
|
||||
errors_flag = Wnone;
|
||||
else
|
||||
if (no)
|
||||
*flags |= all;
|
||||
else
|
||||
*flags &= ~all;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (err)
|
||||
errors_flag |= all;
|
||||
else
|
||||
*flags &= ~all;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (no)
|
||||
{
|
||||
if (err)
|
||||
errors_flag &= ~value;
|
||||
else
|
||||
if (no)
|
||||
*flags &= ~value;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (err)
|
||||
{
|
||||
errors_flag |= value;
|
||||
warnings_flag |= value;
|
||||
}
|
||||
else
|
||||
*flags |= value;
|
||||
{
|
||||
if (err)
|
||||
warnings_flag |= value;
|
||||
*flags |= value;
|
||||
}
|
||||
}
|
||||
}
|
||||
flags = save_flags;
|
||||
args = strtok (NULL, ",");
|
||||
}
|
||||
}
|
||||
else
|
||||
*flags |= all;
|
||||
}
|
||||
|
||||
/** Decode a set of sub arguments.
|
||||
|
||||
Reference in New Issue
Block a user