Commit 028bffa 1 parent 86741b3 commit 028bffa Copy full SHA for 028bffa
File tree 3 files changed +15
-15
lines changed
3 files changed +15
-15
lines changed Original file line number Diff line number Diff line change @@ -279,6 +279,17 @@ import std;
279
279
# define FMT_UNICODE 1
280
280
#endif
281
281
282
+ // Check if rtti is available.
283
+ #ifndef FMT_USE_RTTI
284
+ // __RTTI is for EDG compilers. _CPPRTTI is for MSVC.
285
+ # if defined(__GXX_RTTI) || FMT_HAS_FEATURE(cxx_rtti) || defined(_CPPRTTI) || \
286
+ defined (__INTEL_RTTI__) || defined(__RTTI)
287
+ # define FMT_USE_RTTI 1
288
+ # else
289
+ # define FMT_USE_RTTI 0
290
+ # endif
291
+ #endif
292
+
282
293
#define FMT_FWD (...) static_cast <decltype(__VA_ARGS__)&&>(__VA_ARGS__)
283
294
284
295
// Enable minimal optimizations for more compact code in debug mode.
Original file line number Diff line number Diff line change @@ -44,12 +44,12 @@ auto get_file(std::filebuf&) -> FILE*;
44
44
inline auto write_ostream_unicode (std::ostream& os, fmt::string_view data)
45
45
-> bool {
46
46
FILE* f = nullptr ;
47
- #if FMT_MSC_VERSION
47
+ #if FMT_MSC_VERSION && FMT_USE_RTTI
48
48
if (auto * buf = dynamic_cast <std::filebuf*>(os.rdbuf ()))
49
49
f = get_file (*buf);
50
50
else
51
51
return false ;
52
- #elif defined(_WIN32) && defined(__GLIBCXX__)
52
+ #elif defined(_WIN32) && defined(__GLIBCXX__) && FMT_USE_RTTI
53
53
auto * rdbuf = os.rdbuf ();
54
54
if (auto * sfbuf = dynamic_cast <__gnu_cxx::stdio_sync_filebuf<char >*>(rdbuf))
55
55
f = sfbuf->file ();
Original file line number Diff line number Diff line change 62
62
# endif
63
63
#endif
64
64
65
- // Check if typeid is available.
66
- #ifndef FMT_USE_TYPEID
67
- // __RTTI is for EDG compilers. _CPPRTTI is for MSVC.
68
- # if defined(__GXX_RTTI) || FMT_HAS_FEATURE(cxx_rtti) || defined(_CPPRTTI) || \
69
- defined (__INTEL_RTTI__) || defined(__RTTI)
70
- # define FMT_USE_TYPEID 1
71
- # else
72
- # define FMT_USE_TYPEID 0
73
- # endif
74
- #endif
75
-
76
65
// For older Xcode versions, __cpp_lib_xxx flags are inaccurately defined.
77
66
#ifndef FMT_CPP_LIB_FILESYSTEM
78
67
# ifdef __cpp_lib_filesystem
@@ -443,7 +432,7 @@ struct formatter<
443
432
if (it == end || *it == ' }' ) return it;
444
433
if (*it == ' t' ) {
445
434
++it;
446
- with_typename_ = FMT_USE_TYPEID != 0 ;
435
+ with_typename_ = FMT_USE_RTTI != 0 ;
447
436
}
448
437
return it;
449
438
}
@@ -455,7 +444,7 @@ struct formatter<
455
444
if (!with_typename_)
456
445
return detail::write_bytes<Char>(out, string_view (ex.what ()));
457
446
458
- #if FMT_USE_TYPEID
447
+ #if FMT_USE_RTTI
459
448
const std::type_info& ti = typeid (ex);
460
449
# ifdef FMT_HAS_ABI_CXA_DEMANGLE
461
450
int status = 0 ;
You can’t perform that action at this time.
0 commit comments