[Git][ghc/ghc][master] rts: Use C11-compliant static assertion syntax

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Fri Jan 27 10:01:42 UTC 2023



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
e480fbc2 by Ben Gamari at 2023-01-27T05:01:24-05:00
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

- - - - -


1 changed file:

- rts/include/Rts.h


Changes:

=====================================
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



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e480fbc2c6fdcb252847fc537ab7ec50d1dc2dfd

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e480fbc2c6fdcb252847fc537ab7ec50d1dc2dfd
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230127/71cd1e28/attachment.html>


More information about the ghc-commits mailing list