ALL: Don't use 'defined' in macro definitions

This is undefined behavior and clang warns about it.
See <http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20160118/147239.html>.
This commit is contained in:
Ori Avtalion
2016-07-23 14:04:56 +03:00
parent 2e4dd165e9
commit 4d120800fa
3 changed files with 20 additions and 6 deletions
+9 -3
View File
@@ -48,9 +48,15 @@
// 0 - Force OpenGL context
// 1 - Force OpenGL ES context
// 2 - Force OpenGL ES 2.0 context
#define USE_FORCED_GL (defined(USE_GLES_MODE) && USE_GLES_MODE == 0)
#define USE_FORCED_GLES (defined(USE_GLES_MODE) && USE_GLES_MODE == 1)
#define USE_FORCED_GLES2 (defined(USE_GLES_MODE) && USE_GLES_MODE == 2)
#ifdef USE_GLES_MODE
#define USE_FORCED_GL (USE_GLES_MODE == 0)
#define USE_FORCED_GLES (USE_GLES_MODE == 1)
#define USE_FORCED_GLES2 (USE_GLES_MODE == 2)
#else
#define USE_FORCED_GL 0
#define USE_FORCED_GLES 0
#define USE_FORCED_GLES2 0
#endif
// On Tizen we include the toolchain's OpenGL file. This is something we
// actually want to avoid. However, since Tizen uses eglGetProcAddress which
+6 -2
View File
@@ -79,8 +79,12 @@ extern int pluginTypeVersions[PLUGIN_TYPE_MAX];
#define PLUGIN_ENABLED_STATIC(ID) \
(ENABLE_##ID && !PLUGIN_ENABLED_DYNAMIC(ID))
#define PLUGIN_ENABLED_DYNAMIC(ID) \
(ENABLE_##ID && (ENABLE_##ID == DYNAMIC_PLUGIN) && defined(DYNAMIC_MODULES))
#ifdef DYNAMIC_MODULES
#define PLUGIN_ENABLED_DYNAMIC(ID) \
(ENABLE_##ID && (ENABLE_##ID == DYNAMIC_PLUGIN))
#else
#define PLUGIN_ENABLED_DYNAMIC(ID) 0
#endif
// see comments in backends/plugins/elf/elf-provider.cpp
#if defined(USE_ELF_LOADER) && defined(ELF_LOADER_CXA_ATEXIT)
+5 -1
View File
@@ -29,7 +29,11 @@
// This is a convenience macro to test whether the compiler used is a GCC
// version, which is at least major.minor.
#define GCC_ATLEAST(major, minor) (defined(__GNUC__) && (__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor))))
#ifdef __GNUC__
#define GCC_ATLEAST(major, minor) (__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))
#else
#define GCC_ATLEAST(major, minor) 0
#endif
#if defined(_WIN32_WCE) && _WIN32_WCE < 300
#define NONSTANDARD_PORT