From d645a55051b60c39169c1e9bb6710a16215fc544 Mon Sep 17 00:00:00 2001 From: Stefan Frijters Date: Tue, 7 Apr 2020 12:10:38 +0200 Subject: [PATCH] [Fix] Compiler detection in test script Clang also defines __GNUC__, so it would be incorrectly identified as GNU before reaching the check for __clang__. --- include/occa/scripts/tests/compiler.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/occa/scripts/tests/compiler.cpp b/include/occa/scripts/tests/compiler.cpp index dec4e8adb..26b6544b6 100644 --- a/include/occa/scripts/tests/compiler.cpp +++ b/include/occa/scripts/tests/compiler.cpp @@ -19,6 +19,10 @@ int main(int argc, char **argv) { #elif defined(__ICC) || defined(__INTEL_COMPILER) return OCCA_INTEL_VENDOR; +// Clang also defines __GNUC__, so check for __clang__ first +#elif defined(__clang__) + return OCCA_LLVM_VENDOR; + #elif defined(__GNUC__) || defined(__GNUG__) return OCCA_GNU_VENDOR; @@ -37,9 +41,6 @@ int main(int argc, char **argv) { #elif defined(_MSC_VER) return OCCA_VISUALSTUDIO_VENDOR; -#elif defined(__clang__) - return OCCA_LLVM_VENDOR; - #else return OCCA_NOT_FOUND #endif