Fix C2x use of static_assert

This commit is contained in:
ISSOtm
2020-08-18 16:53:31 +02:00
parent ac011fe69f
commit 71a0a42cfb
2 changed files with 3 additions and 2 deletions

View File

@@ -387,7 +387,8 @@ void fstk_Init(char *mainPath, uint32_t maxRecursionDepth)
#else #else
/* If this holds, then GCC raises a warning about the `if` above being dead code */ /* If this holds, then GCC raises a warning about the `if` above being dead code */
static_assert(UINT32_MAX static_assert(UINT32_MAX
<= (SIZE_MAX - sizeof(*contextStack)) / sizeof(contextStack->reptIters[0])); <= (SIZE_MAX - sizeof(*contextStack)) / sizeof(contextStack->reptIters[0]),
"Please enable recursion depth capping");
if (0) { if (0) {
#endif #endif
error("Recursion depth may not be higher than %zu, defaulting to 64\n", error("Recursion depth may not be higher than %zu, defaulting to 64\n",

View File

@@ -234,7 +234,7 @@ static struct KeywordMapping {
#define LEXER_BUF_SIZE 42 /* TODO: determine a sane value for this */ #define LEXER_BUF_SIZE 42 /* TODO: determine a sane value for this */
/* This caps the size of buffer reads, and according to POSIX, passing more than SSIZE_MAX is UB */ /* This caps the size of buffer reads, and according to POSIX, passing more than SSIZE_MAX is UB */
static_assert(LEXER_BUF_SIZE <= SSIZE_MAX); static_assert(LEXER_BUF_SIZE <= SSIZE_MAX, "Lexer buffer size is too large");
struct Expansion { struct Expansion {
struct Expansion *firstChild; struct Expansion *firstChild;