Skip to content

Commit 73f13fa

Browse files
fk u, msvc.
1 parent 86b89f8 commit 73f13fa

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

include/fast_io_dsal/impl/misc/pop_macros.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Please keep it in reverse order with the macros in push_macros.h
22

3+
#pragma pop_macro("FAST_IO_CPP_EXCEPTIONS")
34
#pragma pop_macro("FAST_IO_HAS_BUILTIN")
45
#pragma pop_macro("FAST_IO_TRIVIALLY_RELOCATABLE_IF_ELIGIBLE")
56
#pragma pop_macro("FAST_IO_ASSERT")

include/fast_io_dsal/impl/misc/push_macros.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,19 @@ Internal assert macros for fuzzing fast_io.
220220
#pragma push_macro("FAST_IO_HAS_BUILTIN")
221221
#undef FAST_IO_HAS_BUILTIN
222222
#ifdef __has_builtin
223-
# define FAST_IO_HAS_BUILTIN(...) __has_builtin(__VA_ARGS__)
223+
#define FAST_IO_HAS_BUILTIN(...) __has_builtin(__VA_ARGS__)
224224
#else
225-
# define FAST_IO_HAS_BUILTIN(...) 0
225+
#define FAST_IO_HAS_BUILTIN(...) 0
226+
#endif
227+
228+
#pragma push_macro("FAST_IO_CPP_EXCEPTIONS")
229+
#undef FAST_IO_CPP_EXCEPTIONS
230+
#if defined (_MSC_VER) && !defined(__clang__)
231+
#if defined(_CPPUNWIND)
232+
#define FAST_IO_CPP_EXCEPTIONS
233+
#endif
234+
#else
235+
#if __cpp_exceptions >= 199711L
236+
#define FAST_IO_CPP_EXCEPTIONS
237+
#endif
226238
#endif

include/fast_io_freestanding_impl/io_buffer/destroy.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ inline constexpr void destroy_basic_io_buffer(T &t) noexcept
3737
constexpr auto mode{traits_type::mode};
3838
if constexpr ((mode & buffer_mode::out) == buffer_mode::out)
3939
{
40-
#if __cpp_exceptions >= 199711L
40+
#ifdef FAST_IO_CPP_EXCEPTIONS
4141
try
42-
#endif
4342
{
43+
#endif
4444
::fast_io::details::close_basic_io_buffer(t);
45+
#ifdef FAST_IO_CPP_EXCEPTIONS
4546
}
46-
#if __cpp_exceptions >= 199711L
4747
catch (...)
4848
{
4949
}

0 commit comments

Comments
 (0)