summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@well-typed.com>2023-01-17 19:45:34 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2023-01-27 05:01:24 -0500
commite480fbc2c6fdcb252847fc537ab7ec50d1dc2dfd (patch)
tree5236b1cbb7975f5fe25d976fbcb95b31d4eb451d
parent6932cfc798ea8f50d16b4876e9a2127e3e47046d (diff)
downloadhaskell-e480fbc2c6fdcb252847fc537ab7ec50d1dc2dfd.tar.gz
rts: Use C11-compliant static assertion syntax
Previously we used `static_assert` which is only available in C23. By contrast, C11 only provides `_Static_assert`. Fixes #22777
-rw-r--r--rts/include/Rts.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/rts/include/Rts.h b/rts/include/Rts.h
index 90d8e5b324..516c4683da 100644
--- a/rts/include/Rts.h
+++ b/rts/include/Rts.h
@@ -167,7 +167,10 @@ void _warnFail(const char *filename, unsigned int linenum);
#endif /* DEBUG */
#if __STDC_VERSION__ >= 201112L
-#define GHC_STATIC_ASSERT(x, msg) static_assert((x), msg)
+// `_Static_assert` is provided by C11 but is deprecated and replaced by
+// `static_assert` in C23. Perhaps some day we should instead use the latter.
+// See #22777.
+#define GHC_STATIC_ASSERT(x, msg) _Static_assert((x), msg)
#else
#define GHC_STATIC_ASSERT(x, msg)
#endif