]> Git Repo - linux.git/commitdiff
perf build: Allow nested externs to enable BUILD_BUG() usage
authorVasily Gorbik <[email protected]>
Fri, 9 Oct 2020 12:25:23 +0000 (14:25 +0200)
committerIngo Molnar <[email protected]>
Tue, 13 Oct 2020 10:08:32 +0000 (12:08 +0200)
Currently the BUILD_BUG() macro is expanded to the following:

   do {
           extern void __compiletime_assert_0(void)
                   __attribute__((error("BUILD_BUG failed")));
           if (!(!(1)))
                   __compiletime_assert_0();
   } while (0);

If used in a function body this would obviously produce build errors
with -Wnested-externs and -Werror.

To enable BUILD_BUG() usage in tools/arch/x86/lib/insn.c which perf
includes in intel-pt-decoder, build perf without -Wnested-externs.

Reported-by: Stephen Rothwell <[email protected]>
Tested-by: Stephen Rothwell <[email protected]> # build tested
Signed-off-by: Vasily Gorbik <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Link: https://lore.kernel.org/r/patch-1.thread-251403.git-2514037e9477.your-ad-here.call-01602244460-ext-7088@work.hours
tools/perf/Makefile.config

index 190be4fa5c2187f37d37e7b3f4e66fcb392a6f6b..8137a6046a47e3ce2807cf910e2ccfc9ecdb7b90 100644 (file)
@@ -16,7 +16,7 @@ $(shell printf "" > $(OUTPUT).config-detected)
 detected     = $(shell echo "$(1)=y"       >> $(OUTPUT).config-detected)
 detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected)
 
-CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS)
+CFLAGS := $(EXTRA_CFLAGS) $(filter-out -Wnested-externs,$(EXTRA_WARNINGS))
 
 include $(srctree)/tools/scripts/Makefile.arch
 
This page took 0.057642 seconds and 4 git commands to generate.