From 37d1dfe62ff6ee7f42a0244fc69b23e33fd8a530 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Thu, 21 Jul 2016 11:16:47 -0400 Subject: [PATCH] Some tweaks for Clang. --- buildver.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/buildver.c b/buildver.c index 1990c53..52d7ea2 100644 --- a/buildver.c +++ b/buildver.c @@ -27,7 +27,11 @@ #error Please define APPREV in the build system. #endif -#if (defined __GNUC__) +#if (defined __clang__) +# define VERSTR2(x) #x +# define VERSTR(x) VERSTR2(x) +# define COMPILERVER " " VERSTR(__clang_major__) "." VERSTR(__clang_minor__) "." VERSTR(__clang_patchlevel__) +#elif (defined __GNUC__) # define VERSTR2(x) #x # define VERSTR(x) VERSTR2(x) # define COMPILERVER " " VERSTR(__GNUC__) "." VERSTR(__GNUC_MINOR__) "." VERSTR(__GNUC_PATCHLEVEL__) @@ -50,7 +54,11 @@ #endif #ifndef COMPILER - #if (defined __GNUC__) + #if (defined __clang__) && defined(__apple_build_version__) // Apple reports version differently than LLVM Clang, note difference here. + #define COMPILER "Apple Clang" + #elif (defined __clang__) + #define COMPILER "Clang" + #elif (defined __GNUC__) #define COMPILER "GCC" #elif (defined _MSC_VER) #define COMPILER "Visual Studio"