From 6831615d3fdb94443d74fd39484c44cea822ef9b Mon Sep 17 00:00:00 2001 From: Emily Mabrey Date: Tue, 14 Sep 2021 22:58:51 -0400 Subject: [PATCH 1/2] Fix clang compiler build info Make GCC/clang differentiation more accurate Add "Apple clang" detection Signed-off-by: Emily Mabrey --- src/BuildInfo.h | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/BuildInfo.h b/src/BuildInfo.h index f413c88ec..78690bd48 100644 --- a/src/BuildInfo.h +++ b/src/BuildInfo.h @@ -26,17 +26,19 @@ class BuildInfo { public: - enum class CompilerType { MSVC, MinGW, GCC, Clang, Unknown }; + enum class CompilerType { MSVC, MinGW, GCC, Clang, AppleClang, Unknown }; static constexpr auto CurrentBuildCompiler = #if defined(_MSC_FULL_VER) CompilerType::MSVC; #elif defined(__GNUC_PATCHLEVEL__) && defined(__MINGW32__) CompilerType::MinGW; - #elif defined(__GNUC_PATCHLEVEL__) + #elif defined(__GNUC_PATCHLEVEL__) && !defined(__llvm__) && !defined(__clang__) CompilerType::GCC; - #elif defined(__clang_version__) + #elif defined(__clang_version__) && !defined(__apple_build_version__) CompilerType::Clang; + #elif defined(__clang_version__) && defined(__apple_build_version__) + CompilerType::AppleClang; #else CompilerType::Unknown; #endif @@ -81,6 +83,15 @@ public: #endif return wxString::Format( wxT("clang %s"), CUSTOM_wxMAKE_VERSION_DOT_STRING_T(__clang_major__, __clang_minor__, __clang_patchlevel__)); + case BuildInfo::CompilerType::AppleClang: + #if !defined(__clang_major__) || !defined (__clang_minor__) || !defined(__clang_patchlevel__) + // This should be unreachable, but it makes the compiler realize that they will always be defined + #define __clang_major__ 0 + #define __clang_minor__ 0 + #define __clang_patchlevel__ 0 + #endif + return wxString::Format( wxT("Apple clang %s"), CUSTOM_wxMAKE_VERSION_DOT_STRING_T(__clang_major__, __clang_minor__, __clang_patchlevel__)); + case BuildInfo::CompilerType::Unknown: default: return wxT("Unknown!!!"); From 41e73e11bc84959c6d395781a3c912d1b465595f Mon Sep 17 00:00:00 2001 From: Panagiotis Vasilopoulos Date: Thu, 16 Sep 2021 07:47:48 +0200 Subject: [PATCH 2/2] BuildInfo.h: Improved Clang capitalization Signed-off-by: Panagiotis Vasilopoulos Reference-to: https://github.com/tenacityteam/tenacity/pull/626 --- src/BuildInfo.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BuildInfo.h b/src/BuildInfo.h index 78690bd48..99b6241bf 100644 --- a/src/BuildInfo.h +++ b/src/BuildInfo.h @@ -81,7 +81,7 @@ public: #define __clang_minor__ 0 #define __clang_patchlevel__ 0 #endif - return wxString::Format( wxT("clang %s"), CUSTOM_wxMAKE_VERSION_DOT_STRING_T(__clang_major__, __clang_minor__, __clang_patchlevel__)); + return wxString::Format( wxT("Clang %s"), CUSTOM_wxMAKE_VERSION_DOT_STRING_T(__clang_major__, __clang_minor__, __clang_patchlevel__)); case BuildInfo::CompilerType::AppleClang: #if !defined(__clang_major__) || !defined (__clang_minor__) || !defined(__clang_patchlevel__) @@ -90,7 +90,7 @@ public: #define __clang_minor__ 0 #define __clang_patchlevel__ 0 #endif - return wxString::Format( wxT("Apple clang %s"), CUSTOM_wxMAKE_VERSION_DOT_STRING_T(__clang_major__, __clang_minor__, __clang_patchlevel__)); + return wxString::Format( wxT("Apple Clang %s"), CUSTOM_wxMAKE_VERSION_DOT_STRING_T(__clang_major__, __clang_minor__, __clang_patchlevel__)); case BuildInfo::CompilerType::Unknown: default: