From 4bd5aeb2337e2832b79ef4e98c602839b8b2eba9 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..babc305f7 100644 --- a/include/occa/scripts/tests/compiler.cpp +++ b/include/occa/scripts/tests/compiler.cpp @@ -19,9 +19,6 @@ int main(int argc, char **argv) { #elif defined(__ICC) || defined(__INTEL_COMPILER) return OCCA_INTEL_VENDOR; -#elif defined(__GNUC__) || defined(__GNUG__) - return OCCA_GNU_VENDOR; - #elif defined(__HP_cc) || defined(__HP_aCC) return OCCA_HP_VENDOR; @@ -40,6 +37,10 @@ int main(int argc, char **argv) { #elif defined(__clang__) return OCCA_LLVM_VENDOR; +// Clang also defines __GNUC__, so check for it after __clang__ +#elif defined(__GNUC__) || defined(__GNUG__) + return OCCA_GNU_VENDOR; + #else return OCCA_NOT_FOUND #endif