Re: [PATCH] perf, tools, stat: Include asm/bug.h for WARN_ON

From: Arnaldo Carvalho de Melo
Date: Wed Feb 17 2016 - 13:52:20 EST


Em Wed, Feb 17, 2016 at 10:39:08AM -0800, Andi Kleen escreveu:
> From: Andi Kleen <ak@xxxxxxxxxxxxxxx>
>
> In my set up (separate objdir, DEBUG=1) tip perf doesn't build without this change.
> It may be that in some other setups asm/bug.h is implicitely included.

Doesn't matter, as there is usage of something defined in that header,
so we must have it included

Thanks, applying your fix, after making it build on acme/perf/core:

[acme@jouet linux]$ patch -p1 < /wb/1.patch
patching file tools/perf/builtin-stat.c
Hunk #1 FAILED at 60.
1 out of 1 hunk FAILED -- saving rejects to file tools/perf/builtin-stat.c.rej
[acme@jouet linux]$

> But always include it into builtin-stat.c
>
> builtin-stat.c: In function âset_mapsâ:
> builtin-stat.c:2126:6: error: implicit declaration of function âWARN_ONCEâ [-Werror=implicit-function-declaration]
> if (WARN_ONCE(st->maps_allocated, "stats double allocation\n"))
> ^
> builtin-stat.c:2126:2: error: nested extern declaration of âWARN_ONCEâ [-Werror=nested-externs]
> if (WARN_ONCE(st->maps_allocated, "stats double allocation\n"))
> ^
>
> Signed-off-by: Andi Kleen <ak@xxxxxxxxxxxxxxx>
> ---
> tools/perf/builtin-stat.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
> index 6f24a96..a570e6d 100644
> --- a/tools/perf/builtin-stat.c
> +++ b/tools/perf/builtin-stat.c
> @@ -60,6 +60,7 @@
> #include "util/thread_map.h"
> #include "util/counts.h"
> #include "util/group.h"
> +#include "asm/bug.h"
>
> #include <api/fs/fs.h>
> #include <stdlib.h>
> --
> 2.5.0