aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFaraz Vahedi <kfv@kfv.io>2026-05-17 20:47:49 +0000
committerRobert Clausecker <fuz@FreeBSD.org>2026-05-30 13:43:51 +0000
commitc5c7d18d011830088a2134e1be32f610f1f3e797 (patch)
tree32e7526a8a815a3926bdac0a7b3b3c6e0e314e79
parent64502126e126476456ca2aa60b4f798ed2d0b879 (diff)
libc: Restrict the static_assert macro to pre-C23 modes
Signed-off-by: Faraz Vahedi <kfv@kfv.io> Reviewed by: fuz MFC after: 1 month Pull Request: https://github.com/freebsd/freebsd-src/pull/2203
-rw-r--r--include/assert.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/assert.h b/include/assert.h
index a3dbe933e18f..a089d7b79915 100644
--- a/include/assert.h
+++ b/include/assert.h
@@ -72,8 +72,11 @@
* C++ template parameters may contain commas, even if not enclosed in
* parentheses, causing the _Static_assert macro to be invoked with more
* than two parameters.
+ *
+ * C23 defines static_assert and its obsolescent alternative spelling,
+ * _Static_assert, as keywords.
*/
-#if __ISO_C_VISIBLE >= 2011 && !defined(__cplusplus)
+#if __ISO_C_VISIBLE >= 2011 && __ISO_C_VISIBLE < 2023 && !defined(__cplusplus)
#define static_assert _Static_assert
#endif