args = strtok (args, ",");
while (args)
{
+ int value = 0;
+ int *save_flags = flags;
int no = STRPREFIX_LIT ("no-", args) ? 3 : 0;
- int value = XARGMATCH (option, args + no, keys, values);
- if (value == 0)
+ int err = STRPREFIX_LIT ("error", args + no) ? 5 : 0;
+
+ if (err)
+ flags = &errors_flag;
+ if (!err || args[no + err++] != '\0')
+ value = XARGMATCH (option, args + no + err, keys, values);
+
+ if (!value)
{
- if (no)
+ /* With a simpler 'if (no)' version, -Werror means -Werror=all
+ (or rather, -Werror=no-none, but that syntax is invalid).
+ The difference is:
+ - Werror activates all errors, but not the warnings
+ - Werror=all activates errors, and all warnings */
+ if (no ? !err : err)
*flags |= all;
else
*flags &= ~all;
if (no)
*flags &= ~value;
else
- *flags |= value;
+ {
+ if (err)
+ warnings_flag |= value;
+ *flags |= value;
+ }
}
+ flags = save_flags;
args = strtok (NULL, ",");
}
}
fputs (_("\
Warning categories include:\n\
- `midrule-values' unset or unused midrule values\n\
- `yacc' incompatibilities with POSIX Yacc\n\
- `conflicts-sr' S/R conflicts (enabled by default)\n\
- `conflicts-rr' R/R conflicts (enabled by default)\n\
- `deprecated' obsolete constructs\n\
- `other' all other warnings (enabled by default)\n\
- `all' all the warnings\n\
- `no-CATEGORY' turn off warnings in CATEGORY\n\
- `none' turn off all the warnings\n\
- `error' treat warnings as errors\n\
+ `midrule-values' unset or unused midrule values\n\
+ `yacc' incompatibilities with POSIX Yacc\n\
+ `conflicts-sr' S/R conflicts (enabled by default)\n\
+ `conflicts-rr' R/R conflicts (enabled by default)\n\
+ `deprecated' obsolete constructs\n\
+ `other' all other warnings (enabled by default)\n\
+ `all' all the warnings\n\
+ `no-CATEGORY' turn off warnings in CATEGORY\n\
+ `none' turn off all the warnings\n\
+ `error[=CATEGORY]' treat warnings as errors\n\
"), stdout);
putc ('\n', stdout);
skeleton = arg;
}
else if (prio == skeleton_prio)
- complain_at (loc, complaint,
- _("multiple skeleton declarations are invalid"));
+ complain (&loc, complaint,
+ _("multiple skeleton declarations are invalid"));
}
void
else
return;
- complain_at (loc, complaint, msg, quotearg_colon (arg));
+ complain (&loc, complaint, msg, quotearg_colon (arg));
}
/*----------------------.
break;
case 'y':
+ warnings_flag |= Wyacc;
+ errors_flag |= Wyacc;
yacc_flag = true;
break;