The macOS assert.h header does not define static_assert when compiling in
C99 mode. To fix this compile with -std=c11.
Details
Details
- Reviewers
delphij emaste - Commits
- rS364765: Fix makefs bootstrap on macOS after D25563
Diff Detail
Diff Detail
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 33138 Build 30497: arc lint + arc unit
Event Timeline
Comment Actions
I'm not sure but if I'm reading it right:
#ifndef __cplusplus #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L #define static_assert _Static_assert #endif /* __STDC_VERSION__ */ #endif /* !__cplusplus */
It's basically saying, if we are not compiling for C++ and if -std=c11 was used, static_assert is defined as an alias of _Static_assert? Will saying CSTD=c11 fix this on macOS?
Comment Actions
Yeah using C11 should also fix it since C11 requires assert.h to define static_assert.
Comment Actions
I'd slightly prefer compiling as C11 and spelling it the sensible (static_assert) way, but either way is acceptable to me.
Comment Actions
As an aside, we should put CSTD in style.Makefile(5). Looking at a few other examples this order seems to be common -- WARNS, CSTD, CFLAGS
Comment Actions
I searched for CSTD and it seems most uses are after WARNS, so I did the same here. I wasn't aware of style.Makefile(5) but if you'd like I can add CSTD between warns and CFLAGS?