Skip to content

Commit 9fd399a

Browse files
Mark detail::assert_fail as weak symbol
That way one can provide ones own implementation.
1 parent 93f0395 commit 9fd399a

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

include/fmt/base.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,12 @@
215215
# define FMT_VISIBILITY(value)
216216
#endif
217217

218+
#if FMT_GCC_VERSION || FMT_CLANG_VERSION
219+
# define FMT_WEAK __attribute__((weak))
220+
#else
221+
# define FMT_WEAK
222+
#endif
223+
218224
// Detect pragmas.
219225
#define FMT_PRAGMA_IMPL(x) _Pragma(#x)
220226
#if FMT_GCC_VERSION >= 504 && !defined(__NVCOMPILER)

include/fmt/format-inl.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
FMT_BEGIN_NAMESPACE
3434
namespace detail {
3535

36-
FMT_FUNC void assert_fail(const char* file, int line, const char* message) {
36+
FMT_FUNC FMT_WEAK void assert_fail(const char* file, int line,
37+
const char* message) {
3738
// Use unchecked std::fprintf to avoid triggering another assertion when
3839
// writing to stderr fails.
3940
fprintf(stderr, "%s:%d: assertion failed: %s", file, line, message);

0 commit comments

Comments
 (0)