Re: [PATCH 1/6] Make _Static_assert() work with GCC in older C++ standards.
Corinna Vinschen <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <[email protected]> |
On Jul 27 09:40, Sebastian Huber wrote: > From: "[email protected]" <[email protected]> > > GCC only activates C11 keywords in C mode, not C++ mode. This means > that when targeting an older C++ standard, we cannot fall back to using > _Static_assert(). In this case, do define _Static_assert() as a macro > that uses a typedef'ed array. > > Discussed in: r322875 commit thread > Reported by: Mark MIllard > MFC after: 1 month > --- > newlib/libc/include/sys/cdefs.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/newlib/libc/include/sys/cdefs.h b/newlib/libc/include/sys/cdefs.h > index b3f8d1965..49be9e062 100644 > --- a/newlib/libc/include/sys/cdefs.h > +++ b/newlib/libc/include/sys/cdefs.h > @@ -314,7 +314,7 @@ > #if (defined(__cplusplus) && __cplusplus >= 201103L) || \ > __has_extension(cxx_static_assert) > #define _Static_assert(x, y) static_assert(x, y) > -#elif __GNUC_PREREQ__(4,6) > +#elif __GNUC_PREREQ__(4,6) && !defined(__cplusplus) > /* Nothing, gcc 4.6 and higher has _Static_assert built-in */ > #elif defined(__COUNTER__) > #define _Static_assert(x, y) __Static_assert(x, __COUNTER__) > -- > 2.13.7 ACK to series. Thanks, Corinna -- Corinna Vinschen Cygwin Maintainer Red Hat
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAltew0IACgkQ9TYGna5E T6BmlRAAk7h0dJdPqHKdWcEcgX3EIuSbkjpdAbcfqdqzvMlcUWx+JW96sEjvytey YvGr5ikDwrn0nNzx9k0W+E131X+Z1JGTrFRvnrvzsZnzF627X3/e2W+DdYvCxwKP aF3b2Lp9uGUFxzPFihRQxeMQZ08DzQaJiTsZ7xGmL3AiXIGybLL+v57pZqNs0PEW o5sY+aWtjcmn7EFDdwc8A2XG7OrM5oRh6snEKlhYTjlG+W//3wN6+j7i4PioahhK H7y/c4Q8M8Yp2tXhS9GfPRFKyRbn6eJfMEMkGgOebsyTSolxYlYjESYdbHpKxDIx upRjMRSK7Ci1fzlpFmkhyxMwjBPiy2BWgBUbw+n4QsZXXBO20mdzeX70KBWy5DGP EaIui9OE3yOcDs1Rb83yBttZhsmgbbewMiwCX0n4dpTmriMUNhDwdARr+CFnMAhr C78z4LcCSfIajYF/ddV3Myfai6JajDNGDUsvB+yvjFbaliBnX4KJiY8Z3lj0fq9J TU7lISZGVtlOhTpi5xYLeK6Vt0hs8bAskD7+1/B4fXCt5ZrPiwVWypvAKWATBpcZ tLtT6Oh3YjJ7V7C6PQgQUJduQ0e2zMCz4pkx5RgJ0XGeBj1IvJOS2Z9bczJq6bDv gJuhDP3Lq4JwNaJOUmlbTbtG3/MeTI0TSg+E1T/lzqlAJ1SCwSE= =b0jw -----END PGP SIGNATURE-----