parser: allow specifying --warn=no-XXX to turn off warnings

Some warning flags are enabled by default, allow a warning to
be disbaled by specifying no- infront of the warning.

  Eg.
    --warn=no-deprecated

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/600
Signed-off-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
John Johansen 2020-08-31 22:28:13 -07:00
parent 343024b4a3
commit 3d54324db0
2 changed files with 19 additions and 15 deletions

View file

@ -301,6 +301,10 @@ multiple times.
apparmor_parser --warn=rules-not-enforced ...
A specific warning can be disabled by prepending I<no>- to the flag
apparmor_parser --warn=no-rules-not-enforced ...
Use --help=warn to see a full list of which warn flags are supported.
=item --Werror[=n]

View file

@ -249,21 +249,21 @@ static void display_usage(const char *command)
}
optflag_table_t warnflag_table[] = {
{ 0, "rule-not-enforced", "warn if a rule is not enforced", WARN_RULE_NOT_ENFORCED },
{ 0, "rule-downgraded", "warn if a rule is downgraded to a lesser but still enforcing rule", WARN_RULE_DOWNGRADED },
{ 0, "abi", "warn if there are abi issues in the profile", WARN_ABI },
{ 0, "deprecated", "warn if something in the profile is deprecated", WARN_DEPRECATED },
{ 0, "config", "enable configuration warnings", WARN_CONFIG },
{ 0, "cache", "enable regular cache warnings", WARN_CACHE },
{ 0, "debug-cache", "enable warnings for debug cache file checks", WARN_DEBUG_CACHE },
{ 0, "jobs", "enable job control warnings", WARN_JOBS },
{ 0, "dangerous", "warn on dangerous policy", WARN_DANGEROUS },
{ 0, "unexpected", "warn when an unexpected condition is found", WARN_UNEXPECTED },
{ 0, "format", "warn on unnecessary or confusing formating", WARN_FORMAT },
{ 0, "missing", "warn when missing qualifier and a default is used", WARN_MISSING },
{ 0, "override", "warn when overriding", WARN_OVERRIDE },
{ 0, "dev", "turn on warnings that are useful for profile development", WARN_DEV },
{ 0, "all", "turn on all warnings", WARN_ALL},
{ 1, "rule-not-enforced", "warn if a rule is not enforced", WARN_RULE_NOT_ENFORCED },
{ 1, "rule-downgraded", "warn if a rule is downgraded to a lesser but still enforcing rule", WARN_RULE_DOWNGRADED },
{ 1, "abi", "warn if there are abi issues in the profile", WARN_ABI },
{ 1, "deprecated", "warn if something in the profile is deprecated", WARN_DEPRECATED },
{ 1, "config", "enable configuration warnings", WARN_CONFIG },
{ 1, "cache", "enable regular cache warnings", WARN_CACHE },
{ 1, "debug-cache", "enable warnings for debug cache file checks", WARN_DEBUG_CACHE },
{ 1, "jobs", "enable job control warnings", WARN_JOBS },
{ 1, "dangerous", "warn on dangerous policy", WARN_DANGEROUS },
{ 1, "unexpected", "warn when an unexpected condition is found", WARN_UNEXPECTED },
{ 1, "format", "warn on unnecessary or confusing formating", WARN_FORMAT },
{ 1, "missing", "warn when missing qualifier and a default is used", WARN_MISSING },
{ 1, "override", "warn when overriding", WARN_OVERRIDE },
{ 1, "dev", "turn on warnings that are useful for profile development", WARN_DEV },
{ 1, "all", "turn on all warnings", WARN_ALL},
{ 0, NULL, NULL, 0 },
};