From 167f7b8d1b6c710839a02f9c7635ffc8302f3dd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Pedro=20Bol=C3=ADvar=20Puente?= Date: Tue, 17 Sep 2024 14:55:57 +0200 Subject: [PATCH] Detect exceptions in a more cross platform manner Works for Clang, Gcc and MSVC --- lager/config.hpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lager/config.hpp b/lager/config.hpp index 9ad61974..988e93a9 100644 --- a/lager/config.hpp +++ b/lager/config.hpp @@ -21,8 +21,12 @@ #endif #if !defined(LAGER_USE_EXCEPTIONS) && !defined(LAGER_NO_EXCEPTIONS) -#ifdef __has_feature -#if !__has_feature(cxx_exceptions) +#if defined(_MSC_VER) +#if !_HAS_EXCEPTIONS +#define LAGER_NO_EXCEPTIONS +#endif +#else +#if !__cpp_exceptions #define LAGER_NO_EXCEPTIONS #endif #endif @@ -43,4 +47,3 @@ #define LAGER_THROW(expr) throw expr #define LAGER_RETHROW throw #endif -