Skip to content

Commit

Permalink
[Fix] Compiler detection in test script
Browse files Browse the repository at this point in the history
Clang also defines __GNUC__, so it would be incorrectly identified as GNU
before reaching the check for __clang__.
  • Loading branch information
SFrijters committed Apr 7, 2020
1 parent d0511b1 commit d645a55
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions include/occa/scripts/tests/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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
Expand Down

0 comments on commit d645a55

Please sign in to comment.