← All bug reports

FS#885Xcode Clang wrongly reported as GCC

Type
Bug
Status
Closed
Resolution
Fixed
Category
QCAD (main)
Severity
Low
Priority
Low
Reported version
3.2.0
Operating system
macOS (All)
Reported
2013-08-14 by kazmer
Closed
2013-08-14 by andrew

src/core/RSettings.cpp:RSettings::getCompilerVersion() doesn't account for Clang, used in Xcode. Instead of reporting the appropriate Clang version number, it reports the GCC compatibility level. The following patch addresses the issue.

diff --git a/src/core/RSettings.cpp b/src/core/RSettings.cpp
index 46dc6df..d6fbe63 100644
--- a/src/core/RSettings.cpp
+++ b/src/core/RSettings.cpp
@@ -363,7 +363,9 @@ QString RSettings::getQtVersion() {
 }
 
 QString RSettings::getCompilerVersion() {
-#if defined(Q_CC_GNU)
+#if defined(Q_CC_CLANG)
+    return QString("Clang %1.%2.%3").arg(__clang_major__).arg(__clang_minor__).arg(__clang_patchlevel__);
+#elif defined(Q_CC_GNU)
     return QString("gcc %1.%2.%3").arg(__GNUC__).arg(__GNUC_MINOR__).arg(__GNUC_PATCHLEVEL__);
 #elif defined(Q_CC_MSVC)
 #   if _MSC_VER==1310

Comments (1)

andrew 2013-08-14

Excellent, thanks for the patch!