Fix a warning on compilers not supporting constexpr.
authorJędrzej Nowacki <jedrzej.nowacki@digia.com>
Wed, 7 Nov 2012 10:23:09 +0000 (11:23 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Sun, 11 Nov 2012 11:10:49 +0000 (12:10 +0100)
Macros should call QSKIP instead of creating a semi-empty function body.

Change-Id: I389701f618fe9bf0a40aa26f161620389a80e407
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp

index c8a1eb1..266eb48 100644 (file)
@@ -1741,25 +1741,25 @@ struct RegisterMetaTypeStructDefaultTemplateValue
 
 void tst_QMetaType::constexprMetaTypeIds()
 {
+#if defined(Q_COMPILER_CONSTEXPR)
     int id = 0;
     int metaType;
 
     switch(id) {
-#if defined(Q_COMPILER_CONSTEXPR)
       QT_FOR_EACH_STATIC_TYPE(METATYPE_ID_FUNCTION)
       metaType = MetaTypeIdStructDefaultTemplateValue<>::Value;
-#endif
     default:;
     }
 
     switch (id) {
-#if defined(Q_COMPILER_CONSTEXPR)
       QT_FOR_EACH_STATIC_TYPE(REGISTER_METATYPE_FUNCTION)
       metaType = RegisterMetaTypeStructDefaultTemplateValue<>::Value;
-#endif
     default:;
     }
     Q_UNUSED(metaType);
+#else
+    QSKIP("The test needs a compiler supporting constexpr");
+#endif
 }
 
 // Compile-time test, it should be possible to register function pointer types