1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-02 06:23:18 +02:00

Remove undefined behavior

Per clang-3.9, the compiler fails on #define ...defined(...) statements
as they're undefined behavior (apparently with different behavior
between gcc/clang and msvc, too).

See clang's cfe repo commit r258128 for details.

Change-Id: I82b6235e11b425fae45eebbe06b08f81c5bdbb98
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: https://review.coreboot.org/18792
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Patrick Georgi
2017-03-13 13:48:03 +01:00
parent a52731d784
commit d2a03b3e43
2 changed files with 30 additions and 6 deletions

View File

@ -37,9 +37,21 @@
#error "Unknown operating system"
#endif
#define USE_IOPL (IS_LINUX || IS_MACOSX || defined(__NetBSD__) || defined(__OpenBSD__))
#define USE_DEV_IO (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__))
#define USE_IOPERM (defined(__gnu_hurd__))
#if IS_LINUX || IS_MACOSX || defined(__NetBSD__) || defined(__OpenBSD__)
#define USE_IOPL 1
#else
#define USE_IOPL 0
#endif
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
#define USE_DEV_IO 1
#else
#define USE_DEV_IO 0
#endif
#if defined(__gnu_hurd__)
#define USE_IOPERM 1
#else
#define USE_IOPERM 0
#endif
#if USE_IOPERM
#include <sys/io.h>