Compiler.h: work around clang 3.9 warning -Wexpansion-to-defined

Check {GCC,CLANG}_VERSION==0 or >0 instead of using defined(), which
may render undefined behavior.
This commit is contained in:
Max Kellermann 2016-08-23 09:55:59 +02:00
parent 093abaad29
commit b05beb000f
2 changed files with 4 additions and 3 deletions

1
NEWS
View File

@ -3,6 +3,7 @@ ver 0.19.19 (not yet released)
- wildmidi: support libWildMidi 0.4
* output
- pulse: support 32 bit, 24 bit and floating point playback
* fix clang 3.9 warnings
ver 0.19.18 (2016/08/05)
* decoder

View File

@ -39,7 +39,7 @@
* other compiler) or newer?
*/
#define GCC_CHECK_VERSION(major, minor) \
(!defined(__clang__) && \
(CLANG_VERSION == 0 && \
GCC_VERSION >= GCC_MAKE_VERSION(major, minor, 0))
/**
@ -47,14 +47,14 @@
* gcc version?
*/
#define CLANG_OR_GCC_VERSION(major, minor) \
(defined(__clang__) || GCC_CHECK_VERSION(major, minor))
(CLANG_VERSION > 0 || GCC_CHECK_VERSION(major, minor))
/**
* Are we building with gcc (not clang or any other compiler) and a
* version older than the specified one?
*/
#define GCC_OLDER_THAN(major, minor) \
(defined(__GNUC__) && !defined(__clang__) && \
(GCC_VERSION > 0 && CLANG_VERSION == 0 && \
GCC_VERSION < GCC_MAKE_VERSION(major, minor, 0))
#ifdef __clang__