diff options
author | Patrick Georgi <pgeorgi@google.com> | 2017-03-13 13:48:03 +0100 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2017-05-04 12:24:12 +0200 |
commit | d2a03b3e43043b596a79803bcb93f70e513bbb50 (patch) | |
tree | 9f91e409309d3a823d795075e187caaa9b764227 /platform.h | |
parent | a52731d78478056039f935f8fad86007132fd2a7 (diff) | |
download | flashrom-d2a03b3e43043b596a79803bcb93f70e513bbb50.tar.gz flashrom-d2a03b3e43043b596a79803bcb93f70e513bbb50.tar.bz2 flashrom-d2a03b3e43043b596a79803bcb93f70e513bbb50.zip |
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>
Diffstat (limited to 'platform.h')
-rw-r--r-- | platform.h | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/platform.h b/platform.h index c5a52ef89..b2fdcd01a 100644 --- a/platform.h +++ b/platform.h @@ -25,9 +25,21 @@ #define __PLATFORM_H__ 1 // Helper defines for operating systems -#define IS_LINUX (defined(__gnu_linux__) || defined(__linux__)) -#define IS_MACOSX (defined(__APPLE__) && defined(__MACH__)) /* yes, both. */ -#define IS_WINDOWS (defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(__WINDOWS__)) +#if defined(__gnu_linux__) || defined(__linux__) +#define IS_LINUX 1 +#else +#define IS_LINUX 0 +#endif +#if defined(__APPLE__) && defined(__MACH__) /* yes, both. */ +#define IS_MACOSX 1 +#else +#define IS_MACOSX 0 +#endif +#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(__WINDOWS__) +#define IS_WINDOWS 1 +#else +#define IS_WINDOWS 0 +#endif // Likewise for target architectures #if defined (__i386__) || defined (__x86_64__) || defined(__amd64__) |