summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@well-typed.com>2023-01-17 19:45:34 +0000
committerBen Gamari <ben@smart-cactus.org>2023-01-18 11:09:29 -0500
commit54622fb1639ca3aab4479792639a12d353a27b17 (patch)
treeea4b8592980a2b9d6132f387f895bba28c354f37
parentfc02f3bbb5f47f880465e22999ba9794f658d8f6 (diff)
downloadhaskell-wip/T22777.tar.gz
rts: Use C11-compliant static assertion syntaxwip/T22777
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