[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190811184938.1796-2-rikard.falkeborn@gmail.com>
Date: Sun, 11 Aug 2019 20:49:36 +0200
From: Rikard Falkeborn <rikard.falkeborn@...il.com>
To: rikard.falkeborn@...il.com
Cc: akpm@...ux-foundation.org, joe@...ches.com,
johannes@...solutions.net, linux-kernel@...r.kernel.org,
yamada.masahiro@...ionext.com,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Allison Randal <allison@...utok.net>,
Enrico Weigelt <info@...ux.net>,
Jordan Borgner <mail@...dan-borgner.de>,
Kate Stewart <kstewart@...uxfoundation.org>
Subject: [PATCH v3 1/3] x86/boot: Use common BUILD_BUG_ON
Defining BUILD_BUG_ON causes redefinition warnings when adding includes
of include/linux/build_bug.h in files unrelated to x86/boot.
For example, adding an include of build_bug.h to include/linux/bits.h
shows the following warnings:
CC arch/x86/boot/cpucheck.o
In file included from ./include/linux/bits.h:22,
from ./arch/x86/include/asm/msr-index.h:5,
from arch/x86/boot/cpucheck.c:28:
./include/linux/build_bug.h:49: warning: "BUILD_BUG_ON" redefined
49 | #define BUILD_BUG_ON(condition) \
|
In file included from arch/x86/boot/cpucheck.c:22:
arch/x86/boot/boot.h:31: note: this is the location of the previous definition
31 | #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
|
The macro was added to boot.h in commit 62bd0337d0c4 ("Top header file
for new x86 setup code"). At that time, BUILD_BUG_ON was defined in
kernel.h. Presumably BUILD_BUG_ON was redefined to avoid pulling in
kernel.h. Since then, BUILD_BUG_ON and similar macros have been split to
a separate header file.
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@...il.com>
---
arch/x86/boot/boot.h | 2 --
arch/x86/boot/main.c | 1 +
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/x86/boot/boot.h b/arch/x86/boot/boot.h
index 19eca14b49a0..ca866f1cca2e 100644
--- a/arch/x86/boot/boot.h
+++ b/arch/x86/boot/boot.h
@@ -28,8 +28,6 @@
#include "cpuflags.h"
/* Useful macros */
-#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
-
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
extern struct setup_header hdr;
diff --git a/arch/x86/boot/main.c b/arch/x86/boot/main.c
index 996df3d586f0..c5e55d2c55d0 100644
--- a/arch/x86/boot/main.c
+++ b/arch/x86/boot/main.c
@@ -13,6 +13,7 @@
#include "boot.h"
#include "string.h"
+#include <linux/build_bug.h>
struct boot_params boot_params __attribute__((aligned(16)));
--
2.22.0
Powered by blists - more mailing lists