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

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Wed Jan 18 16:09:35 UTC 2023



Ben Gamari pushed to branch wip/T22777 at Glasgow Haskell Compiler / GHC


Commits:
54622fb1 by Ben Gamari at 2023-01-18T11:09:29-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/54622fb1639ca3aab4479792639a12d353a27b17

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/54622fb1639ca3aab4479792639a12d353a27b17
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/20230118/6297e6c7/attachment.html>


More information about the ghc-commits mailing list