Skip to content
This repository was archived by the owner on Jan 24, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions include/assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,9 @@ extern FOUNDATION_LIBC_NORETURN void foundation_libc_assert(char const * asserti
#error "bad definition of FOUNDATION_LIBC_ASSERT_DEFAULT!"
#endif

#if !defined(__cplusplus)
#undef static_assert
#define static_assert FOUNDATION_LIBC_STATIC_ASSERT
#endif

#endif
2 changes: 2 additions & 0 deletions include/foundation/builtins.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#define FOUNDATION_LIBC_ASSERT FOUNDATION_LIBC_ASSERT_DEFAULT
#endif

#define FOUNDATION_LIBC_STATIC_ASSERT _Static_assert

#if defined(__clang__)

#define FOUNDATION_LIBC_NORETURN __attribute__((__noreturn__))
Expand Down
4 changes: 4 additions & 0 deletions test/src/assert-validator.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ void assert_ok(void) {
void assert_bad(void) {
assert(0);
}

void assert_static(void) {
static_assert(sizeof(int) == sizeof(int), "int size check");
}
Loading