Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/marian-nmt/intgemm/intgemm.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Heafield <github@kheafield.com>2021-12-10 16:12:01 +0300
committerKenneth Heafield <github@kheafield.com>2021-12-10 16:12:01 +0300
commita56f8225c2ebade4a742b1e691514c7d6c9def3d (patch)
tree85eb9f3f6014effc95b1099f9ca9e055618cdedd
parentf4ba2e259ae82f91d163ef86a3d91edd743aaaf7 (diff)
Of course clang-cl pretending to be MSVC has a different exception macro
-rw-r--r--intgemm/aligned.h6
-rw-r--r--intgemm/intgemm.cc2
2 files changed, 4 insertions, 4 deletions
diff --git a/intgemm/aligned.h b/intgemm/aligned.h
index ccd3aff..cba7d06 100644
--- a/intgemm/aligned.h
+++ b/intgemm/aligned.h
@@ -7,7 +7,7 @@
#include <malloc.h>
#endif
-#if !(defined(_MSC_VER) ? (_HAS_EXCEPTIONS) : (__EXCEPTIONS))
+#if !((defined(_MSC_VER) && !defined(__clang__)) ? (_HAS_EXCEPTIONS) : (__EXCEPTIONS))
#include <cstdlib>
#endif
@@ -24,7 +24,7 @@ template <class T> class AlignedVector {
#ifdef _MSC_VER
mem_ = static_cast<T*>(_aligned_malloc(size * sizeof(T), alignment));
if (!mem_) {
-# if _HAS_EXCEPTIONS
+# if (defined(_MSC_VER) && !defined(__clang__)) ? (_HAS_EXCEPTIONS) : (__EXCEPTIONS)
throw std::bad_alloc();
# else
std::abort();
@@ -32,7 +32,7 @@ template <class T> class AlignedVector {
}
#else
if (posix_memalign(reinterpret_cast<void **>(&mem_), alignment, size * sizeof(T))) {
-# if __EXCEPTIONS
+# if (defined(_MSC_VER) && !defined(__clang__)) ? (_HAS_EXCEPTIONS) : (__EXCEPTIONS)
throw std::bad_alloc();
# else
std::abort();
diff --git a/intgemm/intgemm.cc b/intgemm/intgemm.cc
index d374aa0..31370e2 100644
--- a/intgemm/intgemm.cc
+++ b/intgemm/intgemm.cc
@@ -117,7 +117,7 @@ CPUType GetCPUID() {
const CPUType kCPU = GetCPUID();
void UnsupportedCPUError() {
-#if defined(_MSC_VER) ? (_HAS_EXCEPTIONS) : (__EXCEPTIONS)
+#if (defined(_MSC_VER) && !defined(__clang__)) ? (_HAS_EXCEPTIONS) : (__EXCEPTIONS)
throw UnsupportedCPU();
#else
std::cerr << "intgemm does not support this CPU" << std::endl;