summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@well-typed.com>2023-01-17 19:45:34 +0000
committerMatthew Pickering <matthewtpickering@gmail.com>2023-02-01 13:18:46 +0000
commit9cdab037831153bb0f9730178e8035db44b335e5 (patch)
tree7ef4703614f469d28da54fc524930ca0db6d1e05
parent686350e9a0dca5d144a830a7df086d05ec58d8cd (diff)
downloadhaskell-9cdab037831153bb0f9730178e8035db44b335e5.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 (cherry picked from commit e480fbc2c6fdcb252847fc537ab7ec50d1dc2dfd)
-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