]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
objtool: Allow nested externs to enable BUILD_BUG()
authorVasily Gorbik <gor@linux.ibm.com>
Mon, 5 Oct 2020 15:50:28 +0000 (17:50 +0200)
committerJosh Poimboeuf <jpoimboe@redhat.com>
Tue, 6 Oct 2020 14:32:13 +0000 (09:32 -0500)
Currently BUILD_BUG() macro is expanded to smth like 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 obviously would produce build errors
with -Wnested-externs and -Werror.

Build objtool with -Wno-nested-externs to enable BUILD_BUG() usage.

Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
tools/objtool/Makefile

index 33d1e3ca8efdd1ff14fd02a1f899e2743ce7ac64..4ea9a833dde7aa8ce18a37beb444533caec8a41f 100644 (file)
@@ -37,7 +37,7 @@ INCLUDES := -I$(srctree)/tools/include \
            -I$(srctree)/tools/arch/$(HOSTARCH)/include/uapi \
            -I$(srctree)/tools/arch/$(SRCARCH)/include  \
            -I$(srctree)/tools/objtool/arch/$(SRCARCH)/include
-WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed
+WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed -Wno-nested-externs
 CFLAGS   := -Werror $(WARNINGS) $(KBUILD_HOSTCFLAGS) -g $(INCLUDES) $(LIBELF_FLAGS)
 LDFLAGS  += $(LIBELF_LIBS) $(LIBSUBCMD) $(KBUILD_HOSTLDFLAGS)