2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-30 05:47:59 +00:00

parser: Fix make DEBUG=1

When building the parser with DEBUG=1 enabled the build fails with
the following error and warnings

    In file included from parser_main.c:47:0:
    parser_main.c: In function ‘void auto_tune_parameters()’:
     parser_main.c:1421:35: error: ‘estimate_jobs’ was not declared in this scope
        PDEBUG("Auto tune: --jobs=%d", estimate_jobs);
                                   ^
    parser.h:201:37: note: in definition of macro ‘PDEBUG’
      fprintf(stderr, "parser: " fmt, ## args); \
                                     ^~~~
    parser_main.c:1421:35: note: suggested alternative: ‘estimated_jobs’
        PDEBUG("Auto tune: --jobs=%d", estimate_jobs);
                                   ^
    parser.h:201:37: note: in definition of macro ‘PDEBUG’
      fprintf(stderr, "parser: " fmt, ## args); \
                                     ^~~~
    parser.h:201:41: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat=]
      fprintf(stderr, "parser: " fmt, ## args); \
                                         ^
    parser_main.c:1428:5: note: in expansion of macro ‘PDEBUG’
         PDEBUG("Auto tune: --jobs=%d", jobs);
     ^~~~~~
    Makefile:234: recipe for target 'parser_main.o' failed

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/745
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
This commit is contained in:
John Johansen 2021-04-21 01:16:53 -07:00
parent 472383a429
commit cf809ea928

View File

@ -1418,14 +1418,14 @@ static void auto_tune_parameters(void)
} else if (estimated_jobs < ncpus) {
/* --jobs=estimate_jobs */
jobs = estimated_jobs;
PDEBUG("Auto tune: --jobs=%d", estimate_jobs);
PDEBUG("Auto tune: --jobs=%ld", estimated_jobs);
} else {
long long n = estimated_jobs / ncpus;
if (n < -DEFAULT_JOBS_MAX) {
/* --jobs=cpus*n */
jobs = -n;
PDEBUG("Auto tune: --jobs=%d", jobs);
PDEBUG("Auto tune: --jobs=%ld", jobs);
}
}
} else {