Fix error: cannot use 'try' with exceptions disabled in Win LLVM Clang#4208
Fix error: cannot use 'try' with exceptions disabled in Win LLVM Clang#4208vitaut merged 1 commit intofmtlib:masterfrom
Conversation
|
Other GCC related macros undefined in LLVM Clang on Windows: #define __GCC_ASM_FLAG_OUTPUTS__ 1
< #define __GCC_ATOMIC_BOOL_LOCK_FREE 2
< #define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 2
< #define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 2
< #define __GCC_ATOMIC_CHAR_LOCK_FREE 2
< #define __GCC_ATOMIC_INT_LOCK_FREE 2
< #define __GCC_ATOMIC_LLONG_LOCK_FREE 2
< #define __GCC_ATOMIC_LONG_LOCK_FREE 2
< #define __GCC_ATOMIC_POINTER_LOCK_FREE 2
< #define __GCC_ATOMIC_SHORT_LOCK_FREE 2
< #define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1
< #define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2
#define __GCC_CONSTRUCTIVE_SIZE 64
#define __GCC_DESTRUCTIVE_SIZE 64
< #define __GCC_HAVE_DWARF2_CFI_ASM 1
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1
< #define __GLIBCXX_BITSIZE_INT_N_0 128
< #define __GLIBCXX_TYPE_INT_N_0 __int128
< #define __GNUC_GNU_INLINE__ 1
< #define __GNUC_MINOR__ 2
< #define __GNUC_PATCHLEVEL__ 1
< #define __GNUC__ 4
< #define __GNUG__ 4
< #define __GXX_ABI_VERSION 1002
< #define __GXX_EXPERIMENTAL_CXX0X__ 1
< #define __GXX_RTTI 1
< #define __GXX_WEAK__ 1
#define __INT16_C_SUFFIX__ |
|
clang-cl seems to define |
|
@mwinterb You are right, Clang uses |
ae23fe5 to
67bb7f5
Compare
|
Please apply clang-format. |
include/fmt/base.h
Outdated
| // Use the provided definition. | ||
| #elif defined(__GNUC__) && !defined(__EXCEPTIONS) | ||
| # define FMT_USE_EXCEPTIONS 0 | ||
| #elif defined(__clang__) && (!defined(__cpp_exceptions) || __cpp_exceptions < 199711L) |
There was a problem hiding this comment.
I wonder why they check against 199711L?
There was a problem hiding this comment.
IDK. As I mentioned, this is how Clang does that C++ exceptions check.
Maybe very older clang set it to some lower value and __cpp_exceptions < 199711L can be removed since such old clang cannot be used with {fmt}.
There was a problem hiding this comment.
I suggest removing the __cpp_exceptions < 199711L part then if it works in your environment.
67bb7f5 to
0557417
Compare
Fixes fmtlib#4207. LLVM Clang on Windows does not define `__GNUC__`. The preprocessor falls to `#elif FMT_MSC_VERSION && !_HAS_EXCEPTIONS` with `_HAS_EXCEPTIONS 1` defined in vcruntime.h:104.
0557417 to
1f14cb0
Compare
Fixes #4207.
LLVM Clang on Windows does not define
__GNUC__. The preprocessor falls to#elif FMT_MSC_VERSION && !_HAS_EXCEPTIONSwith_HAS_EXCEPTIONS 1defined in vcruntime.h:104.