shithub: rgbds

Download patch

ref: 71a0a42cfb482929834973fd206f5dcc1bdbdaae
parent: ac011fe69f009152eb3bc87707d6140620995547
author: ISSOtm <[email protected]>
date: Tue Aug 18 12:53:31 EDT 2020

Fix C2x use of `static_assert`

--- a/src/asm/fstack.c
+++ b/src/asm/fstack.c
@@ -387,7 +387,8 @@
 #else
 	/* If this holds, then GCC raises a warning about the `if` above being dead code */
 	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) {
 #endif
 		error("Recursion depth may not be higher than %zu, defaulting to 64\n",
--- a/src/asm/lexer.c
+++ b/src/asm/lexer.c
@@ -234,7 +234,7 @@
 
 #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 */
-static_assert(LEXER_BUF_SIZE <= SSIZE_MAX);
+static_assert(LEXER_BUF_SIZE <= SSIZE_MAX, "Lexer buffer size is too large");
 
 struct Expansion {
 	struct Expansion *firstChild;