]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
_Static_assert needs two arguments for compatibility with GCC before 9
authorFlorian Weimer <fweimer@redhat.com>
Fri, 10 Sep 2021 11:18:36 +0000 (13:18 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Fri, 10 Sep 2021 11:18:36 +0000 (13:18 +0200)
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>
include/sys/cdefs.h

index 6a76160ed4e4cabbf8a70249beba4a3b01130043..56adb231aa8f8cbe911480532efddb87f057b195 100644 (file)
@@ -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