summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@digia.com>2014-01-10 13:19:55 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-20 20:17:56 +0100
commit22f0dc4f893581f53d1f030587ae535128afccf8 (patch)
tree7f9a57be397c5af8ef5d3eed43a403e2d5138437 /src
parentd641792ff29cae3ef92bbc76f593e9262b4789ef (diff)
Loosen checks for Q_COMPILER_VARIADIC_MACROS
So far we did bind the definition of Q_COMPILER_VARIADIC_MACROS to C++11 (so gcc, clang will not define it in default gnu++98 standard). However, variadic macros are a feature of the gcc preprocessor since version 2.97, and are enabled in the default configurations on gcc, clang, icc. This might cause warnings and errors though if one enables additional warnings in gcc, clang (e.g. by -pedantic). Anyhow, as a precedent qglobal.h already relies on 'long long' ... The warning can be disabled by adding '-Wno-variadic-macros'. [ChangeLog][Compiler Specific Changes] Variadic macros are now enabled more liberally for gcc, clang, icc. If you have warnings (because you e.g. compile with -pedantic), disable them by -Wno-variadic-macros. Change-Id: Ie979b85809508ad70cab75e6981f20496429f463 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/global/qcompilerdetection.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index 70f45345c6..1eb442aa5f 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -489,6 +489,7 @@
#ifdef Q_CC_INTEL
# define Q_COMPILER_RESTRICTED_VLA
+# define Q_COMPILER_VARIADIC_MACROS // C++11 feature supported as an extension in other modes, too
# if __INTEL_COMPILER < 1200
# define Q_NO_TEMPLATE_FRIENDS
# endif
@@ -498,7 +499,6 @@
# define Q_COMPILER_BINARY_LITERALS
# endif
# if __cplusplus >= 201103L
-# define Q_COMPILER_VARIADIC_MACROS
# if __INTEL_COMPILER >= 1200
# define Q_COMPILER_AUTO_TYPE
# define Q_COMPILER_CLASS_ENUM
@@ -560,6 +560,15 @@
# define Q_COMPILER_BINARY_LITERALS
# endif
+// Variadic macros are supported for gnu++98, c++11, c99 ... since 2.9
+# if ((__clang_major__ * 100) + __clang_minor__) >= 209
+# if !defined(__STRICT_ANSI__) || defined(__GXX_EXPERIMENTAL_CXX0X__) \
+ || (defined(__cplusplus) && (__cplusplus >= 201103L)) \
+ || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
+# define Q_COMPILER_VARIADIC_MACROS
+# endif
+# endif
+
/* C++11 features, see http://clang.llvm.org/cxx_status.html */
# if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
/* Detect C++ features using __has_feature(), see http://clang.llvm.org/docs/LanguageExtensions.html#cxx11 */
@@ -656,7 +665,6 @@
/* Features that have no __has_feature() check */
# if ((__clang_major__ * 100) + __clang_minor__) >= 209 /* since clang 2.9 */
# define Q_COMPILER_EXTERN_TEMPLATES
-# define Q_COMPILER_VARIADIC_MACROS
# endif
# endif
@@ -693,13 +701,18 @@
// GCC supports binary literals in C, C++98 and C++11 modes
# define Q_COMPILER_BINARY_LITERALS
# endif
+# if !defined(__STRICT_ANSI__) || defined(__GXX_EXPERIMENTAL_CXX0X__) \
+ || (defined(__cplusplus) && (__cplusplus >= 201103L)) \
+ || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
+ // Variadic macros are supported for gnu++98, c++11, C99 ... since forever (gcc 2.97)
+# define Q_COMPILER_VARIADIC_MACROS
+# endif
# if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 403
/* C++11 features supported in GCC 4.3: */
# define Q_COMPILER_DECLTYPE
# define Q_COMPILER_RVALUE_REFS
# define Q_COMPILER_STATIC_ASSERT
-# define Q_COMPILER_VARIADIC_MACROS
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404
/* C++11 features supported in GCC 4.4: */