2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-31 06:16:03 +00:00

parser: begin deprecation process for #include

by adding a warning flag that is disabled by default. This will enable
devs to find when and where #include is in use by adding the compile
flag

  --warn=pound-include

and can even abort policy compiles by using

  --warn=pound-include --Werror=pound-include

The resulting messages look like

  Warning from /etc/apparmor.d/usr.sbin.cupsd (/etc/apparmor.d/usr.sbin.cupsd line 5): deprecated use of '#include'

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Time-out
This commit is contained in:
John Johansen
2022-07-28 15:03:39 -07:00
parent a382452a54
commit db246ddbb5
3 changed files with 8 additions and 2 deletions

View File

@@ -66,10 +66,12 @@ extern int parser_token;
#define WARN_FORMAT 0x400
#define WARN_MISSING 0x800
#define WARN_OVERRIDE 0x1000
#define WARN_INCLUDE 0x2000
#define WARN_DEV (WARN_RULE_NOT_ENFORCED | WARN_RULE_DOWNGRADED | WARN_ABI | \
WARN_DEPRECATED | WARN_DANGEROUS | WARN_UNEXPECTED | \
WARN_FORMAT | WARN_MISSING | WARN_OVERRIDE | WARN_DEBUG_CACHE)
WARN_FORMAT | WARN_MISSING | WARN_OVERRIDE | \
WARN_DEBUG_CACHE | WARN_INCLUDE)
#define DEFAULT_WARNINGS (WARN_CONFIG | WARN_CACHE | WARN_JOBS | \
WARN_UNEXPECTED | WARN_OVERRIDE)
@@ -77,7 +79,8 @@ extern int parser_token;
#define WARN_ALL (WARN_RULE_NOT_ENFORCED | WARN_RULE_DOWNGRADED | WARN_ABI | \
WARN_DEPRECATED | WARN_CONFIG | WARN_CACHE | \
WARN_DEBUG_CACHE | WARN_JOBS | WARN_DANGEROUS | \
WARN_UNEXPECTED | WARN_FORMAT | WARN_MISSING | WARN_OVERRIDE)
WARN_UNEXPECTED | WARN_FORMAT | WARN_MISSING | \
WARN_OVERRIDE | WARN_INCLUDE)
extern dfaflags_t warnflags;
extern dfaflags_t werrflags;