Guard _GNU_SOURCE (as done in pt-decoder/intel-pt-decoder.c) to prevent
possible redefinition error.
Signed-off-by: Tony Jones <[email protected]>
---
tools/perf/pmu-events/jevents.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c
index baa073f38334..b6300e875b87 100644
--- a/tools/perf/pmu-events/jevents.c
+++ b/tools/perf/pmu-events/jevents.c
@@ -1,5 +1,7 @@
#define _XOPEN_SOURCE 500 /* needed for nftw() */
+#ifndef _GNU_SOURCE
#define _GNU_SOURCE /* needed for asprintf() */
+#endif
/* Parse event JSON files */
--
2.11.0
Add NULL end elements to 'unit_to_pmu' map to prevent compiler warning on
some toolchains.
Signed-off-by: Tony Jones <[email protected]>
---
tools/perf/pmu-events/jevents.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c
index b6300e875b87..ecabdbb92944 100644
--- a/tools/perf/pmu-events/jevents.c
+++ b/tools/perf/pmu-events/jevents.c
@@ -198,7 +198,7 @@ static struct map {
{ "QPI LL", "uncore_qpi" },
{ "SBO", "uncore_sbox" },
{ "iMPH-U", "uncore_arb" },
- {}
+ { NULL, NULL}
};
static const char *field_to_perf(struct map *table, char *map, jsmntok_t *val)
--
2.11.0
On Sun, Apr 23, 2017 at 09:26:32PM -0700, Tony Jones wrote:
> Guard _GNU_SOURCE (as done in pt-decoder/intel-pt-decoder.c) to prevent
> possible redefinition error.
Who defines it?
If it's always defined somewhere else it can be just removed.
-Andi
>
> Signed-off-by: Tony Jones <[email protected]>
> ---
> tools/perf/pmu-events/jevents.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c
> index baa073f38334..b6300e875b87 100644
> --- a/tools/perf/pmu-events/jevents.c
> +++ b/tools/perf/pmu-events/jevents.c
> @@ -1,5 +1,7 @@
> #define _XOPEN_SOURCE 500 /* needed for nftw() */
> +#ifndef _GNU_SOURCE
> #define _GNU_SOURCE /* needed for asprintf() */
> +#endif
>
> /* Parse event JSON files */
>
> --
> 2.11.0
>
On 04/24/2017 06:05 AM, Andi Kleen wrote:
> On Sun, Apr 23, 2017 at 09:26:32PM -0700, Tony Jones wrote:
>> Guard _GNU_SOURCE (as done in pt-decoder/intel-pt-decoder.c) to prevent
>> possible redefinition error.
>
> Who defines it?
>
> If it's always defined somewhere else it can be just removed.
>
> -Andi
sometimes it's defaulted on (I believe) by the toolchain. it fails on our SLE12-SP3 toolchain.
I assumed the existing guard in pt-decoder/intel-pt-decoder.c (only other use) was for a reason.
tony