Skip to content

Commit

Permalink
inform clang-analyzer about noreturn of assertion failures
Browse files Browse the repository at this point in the history
  • Loading branch information
stedolan committed Jul 31, 2024
1 parent be26469 commit cd7f011
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion runtime/caml/misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,15 @@ typedef char char_os;
from the callsite, making debuggers able to see it. */
#define CAMLassert(x) \
(CAMLlikely(x) ? (void) 0 : caml_failed_assert ( #x , __OSFILE__, __LINE__))
CAMLextern void caml_failed_assert (char *, char_os *, int);
CAMLextern void caml_failed_assert (char *, char_os *, int)
#if defined(__has_feature)
/* However, we do inform clang-analyzer that this function never returns,
since that improves analysis without breaking debugging */
#if __has_feature(attribute_analyzer_noreturn)
__attribute__((analyzer_noreturn))
#endif
#endif
;
#else
#define CAMLassert(x) ((void) 0)
#endif
Expand Down

0 comments on commit cd7f011

Please sign in to comment.