Skip to content

Commit 89c54b6

Browse files
committed
add __attribute__((__noreturn__)) on _mi_assert_fail
1 parent 175ba36 commit 89c54b6

File tree

1 file changed

+11
-1
lines changed
  • Include/internal/mimalloc/mimalloc

1 file changed

+11
-1
lines changed

Include/internal/mimalloc/mimalloc/types.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,16 @@ terms of the MIT license. A copy of the license can be found in the file
5050
#define mi_decl_cache_align
5151
#endif
5252

53+
#if (MI_DEBUG)
54+
#if defined(_MSC_VER)
55+
#define mi_decl_noreturn __declspec(noreturn)
56+
#elif (defined(__GNUC__) && (__GNUC__ >= 3)) || defined(__clang__)
57+
#define mi_decl_noreturn __attribute__((__noreturn__))
58+
#else
59+
#define mi_decl_noreturn
60+
#endif
61+
#endif
62+
5363
// ------------------------------------------------------
5464
// Variants
5565
// ------------------------------------------------------
@@ -582,7 +592,7 @@ struct mi_heap_s {
582592

583593
#if (MI_DEBUG)
584594
// use our own assertion to print without memory allocation
585-
void _mi_assert_fail(const char* assertion, const char* fname, unsigned int line, const char* func );
595+
mi_decl_noreturn void _mi_assert_fail(const char* assertion, const char* fname, unsigned int line, const char* func);
586596
#define mi_assert(expr) ((expr) ? (void)0 : _mi_assert_fail(#expr,__FILE__,__LINE__,__func__))
587597
#else
588598
#define mi_assert(x)

0 commit comments

Comments
 (0)