Skip to content

[libc][assert] provide static_assert macro pre-__STDC_VERSION__ == 202311L #123851

@nickdesaulniers

Description

@nickdesaulniers

prior to C23, static_assert was a macro provided by assert.h.

I just hit this trying to build compiler-rt builtins against llvm-libc; we don't provide a definition of static_assert and compiler-rt uses the compiler default language standard (currently -std=c17).

We should add something along the lines of:

#if __STDC_VERSION__ < 202311L
#define static_assert(x, y) _Static_assert((x), y)
#endif

in libc/include/llvm-libc-macros/assert-macros.h. cc @frobtech

Link: #123848

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions