about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-09-10 13:18:36 +0200
committerFlorian Weimer <fweimer@redhat.com>2021-09-10 13:18:36 +0200
commitc9fef4b7d1d0f2dad192c74f06102752247677a9 (patch)
tree4fa2fad11e23962a872e08a4251017c464eef83c
parent27ae52e4d149fc2dc5ef109426753ad3d5126582 (diff)
downloadglibc-c9fef4b7d1d0f2dad192c74f06102752247677a9.tar.gz
glibc-c9fef4b7d1d0f2dad192c74f06102752247677a9.tar.xz
glibc-c9fef4b7d1d0f2dad192c74f06102752247677a9.zip
_Static_assert needs two arguments for compatibility with GCC before 9
This macro definition enforces two arguments even with newer compilers
that accept the single-argument form, too.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
-rw-r--r--include/sys/cdefs.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h
index 6a76160ed4..56adb231aa 100644
--- a/include/sys/cdefs.h
+++ b/include/sys/cdefs.h
@@ -1,5 +1,12 @@
 #ifndef _SYS_CDEFS_H
 
+/* This is outside of _ISOMAC to enforce that _Static_assert always
+   uses the two-argument form.  This can be removed once the minimum
+   GCC version used to compile glibc is GCC 9.1.  */
+#ifndef __cplusplus
+# define _Static_assert(expr, diagnostic) _Static_assert (expr, diagnostic)
+#endif
+
 #include <misc/sys/cdefs.h>
 
 #ifndef _ISOMAC