aboutsummaryrefslogtreecommitdiffhomepage
path: root/c.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2023-06-26 17:24:51 +0200
committerlemon <lsof@mailbox.org>2023-06-26 17:25:04 +0200
commit3b96204593b9812674126bad8de14419009682c8 (patch)
treeec5a470ad20e36ed227178eb4ac91754c3d57dff /c.c
parent80ee6292c33b6342e97c46af9577a588f9fabd4a (diff)
also C23 static_assert
Diffstat (limited to 'c.c')
-rw-r--r--c.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/c.c b/c.c
index bb3b064..7da19b4 100644
--- a/c.c
+++ b/c.c
@@ -1678,9 +1678,9 @@ pstaticassert(struct comp *cm, struct span *span)
joinspan(&span->ex, tk.span.ex);
if (!msg.t && ccopt.cstd == STDC11)
- warn(span, "_Static_assert without message is a C23 extension");
+ warn(span, "static assert without message is a C23 extension");
if (!eval(&ex, EVINTCONST)) {
- error(&ex.span, "_Static_assert expression is not an integer constant");
+ error(&ex.span, "static assert expression is not an integer constant");
} else if (iszero(ex)) {
if (msg.t)
error(&ex.span, "static assertion failed: %'S", msg.s, msg.len);
@@ -1703,7 +1703,7 @@ pdecl(struct declstate *st, struct comp *cm) {
}
if (!st->base.t) {
- if (staticassertok && match(cm, &tk, TKW_Static_assert)) {
+ if (staticassertok && (match(cm, &tk, TKW_Static_assert) || match(cm, &tk, TKWstatic_assert))) {
pstaticassert(cm, &tk.span);
return decl = (struct decl){0};
}