Date: Wed, 22 Mar 2023 04:07:50 +0100 From: Warner Losh <imp@bsdimp.com> To: Warner Losh <imp@freebsd.org> Cc: src-committers <src-committers@freebsd.org>, "<dev-commits-src-all@freebsd.org>" <dev-commits-src-all@freebsd.org>, dev-commits-src-main@freebsd.org Subject: Re: git: ed52baf51bd1 - main - _endian.h: Include sys/ctypes.h for visibility macros Message-ID: <CANCZdfogyesYVTnhqGB8zyYBMFEbzdX97oeFbqTjchqrS_RM=g@mail.gmail.com> In-Reply-To: <202303220226.32M2QLoe029463@gitrepo.freebsd.org> References: <202303220226.32M2QLoe029463@gitrepo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--000000000000d00d4605f7747732 Content-Type: text/plain; charset="UTF-8" Doh. Should have changed ctypes.h to cdefs.h, but rushed a bit and forgot. Warner On Wed, Mar 22, 2023, 3:26 AM Warner Losh <imp@freebsd.org> wrote: > The branch main has been updated by imp: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=ed52baf51bd142b5e32701842346452a7ebe37a5 > > commit ed52baf51bd142b5e32701842346452a7ebe37a5 > Author: Warner Losh <imp@FreeBSD.org> > AuthorDate: 2023-03-22 02:25:58 +0000 > Commit: Warner Losh <imp@FreeBSD.org> > CommitDate: 2023-03-22 02:25:58 +0000 > > _endian.h: Include sys/ctypes.h for visibility macros > > BYTE_ORDER, LITTLE_ENDIAN and BIG_ENDIAN will be required by the > forthcoming POSIX Issue 8. In addition, they are provided in the BSD > compilation environments. However, depending on the order includes > happend, sys/cdefs.h may or may not be included when endian.h is > included. Include it here so we can safely test __BSD_VISIBLE. Add > visibility when we're compiling in the future for issue 8, but since > the > date number for issue 8 hasn't been fixed, use strictly greater than > the > issue 7 date.of 200809. > > This had the side effect of sometimes (in the traditional BSD > compliation environment) > #if BYTE_ORDER == LITTLE_ENDIAN > and > #if BYTE_ORDER == BIG_ENDIAN > both being true because none of these were defined. This fixes > that. It also fixes including it after <stdio.h> but not before. > > PR: 269249 > MFC After: 1d (build related) > Reviewed by: kib, emaste > Differential Revision: https://reviews.freebsd.org/D39176 > > Sponsored by: Netflix > --- > sys/sys/_endian.h | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/sys/sys/_endian.h b/sys/sys/_endian.h > index 7ac39386e2e1..3b4460472eb6 100644 > --- a/sys/sys/_endian.h > +++ b/sys/sys/_endian.h > @@ -36,6 +36,8 @@ > #error "sys/_endian.h should not be included directly" > #endif > > +#include <sys/cdefs.h> /* visibility macros */ > + > /* BSD Compatiblity */ > #define _BYTE_ORDER __BYTE_ORDER__ > > @@ -66,10 +68,11 @@ > #endif > > /* > - * Deprecated variants that don't have enough underscores to be useful in > more > - * strict namespaces. > + * POSIX Issue 8 will require these for endian.h. Define them there and > in the > + * traditional BSD compilation environment. Since issue 8 doesn't yet > have an > + * assigned date, use strictly greater than issue 7's date. > */ > -#if __BSD_VISIBLE > +#if __BSD_VISIBLE || _POSIX_C_SOURCE > 200809 > #define LITTLE_ENDIAN _LITTLE_ENDIAN > #define BIG_ENDIAN _BIG_ENDIAN > #define PDP_ENDIAN _PDP_ENDIAN > --000000000000d00d4605f7747732 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"auto">Doh. Should have changed ctypes.h to cdefs.h, but rushed = a bit and forgot.<div dir=3D"auto"><br></div><div dir=3D"auto">Warner=C2=A0= </div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_= attr">On Wed, Mar 22, 2023, 3:26 AM Warner Losh <<a href=3D"mailto:imp@f= reebsd.org">imp@freebsd.org</a>> wrote:<br></div><blockquote class=3D"gm= ail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-le= ft:1ex">The branch main has been updated by imp:<br> <br> URL: <a href=3D"https://cgit.FreeBSD.org/src/commit/?id=3Ded52baf51bd142b5e= 32701842346452a7ebe37a5" rel=3D"noreferrer noreferrer" target=3D"_blank">ht= tps://cgit.FreeBSD.org/src/commit/?id=3Ded52baf51bd142b5e32701842346452a7eb= e37a5</a><br> <br> commit ed52baf51bd142b5e32701842346452a7ebe37a5<br> Author:=C2=A0 =C2=A0 =C2=A0Warner Losh <imp@FreeBSD.org><br> AuthorDate: 2023-03-22 02:25:58 +0000<br> Commit:=C2=A0 =C2=A0 =C2=A0Warner Losh <imp@FreeBSD.org><br> CommitDate: 2023-03-22 02:25:58 +0000<br> <br> =C2=A0 =C2=A0 _endian.h: Include sys/ctypes.h for visibility macros<br> <br> =C2=A0 =C2=A0 BYTE_ORDER, LITTLE_ENDIAN and BIG_ENDIAN will be required by = the<br> =C2=A0 =C2=A0 forthcoming POSIX Issue 8. In addition, they are provided in = the BSD<br> =C2=A0 =C2=A0 compilation environments. However, depending on the order inc= ludes<br> =C2=A0 =C2=A0 happend, sys/cdefs.h may or may not be included when endian.h= is<br> =C2=A0 =C2=A0 included. Include it here so we can safely test __BSD_VISIBLE= .=C2=A0 Add<br> =C2=A0 =C2=A0 visibility when we're compiling in the future for issue 8= , but since the<br> =C2=A0 =C2=A0 date number for issue 8 hasn't been fixed, use strictly g= reater than the<br> =C2=A0 =C2=A0 issue 7 date.of 200809.<br> <br> =C2=A0 =C2=A0 This had the side effect of sometimes (in the traditional BSD= <br> =C2=A0 =C2=A0 compliation environment)<br> =C2=A0 =C2=A0 =C2=A0#if BYTE_ORDER =3D=3D LITTLE_ENDIAN<br> =C2=A0 =C2=A0 and<br> =C2=A0 =C2=A0 =C2=A0#if BYTE_ORDER =3D=3D BIG_ENDIAN<br> =C2=A0 =C2=A0 both being true because none of these were defined. This fixe= s<br> =C2=A0 =C2=A0 that. It also fixes including it after <stdio.h> but no= t before.<br> <br> =C2=A0 =C2=A0 PR:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0269249<br> =C2=A0 =C2=A0 MFC After:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 1d= (build related)<br> =C2=A0 =C2=A0 Reviewed by:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 kib, em= aste<br> =C2=A0 =C2=A0 Differential Revision:=C2=A0 <a href=3D"https://reviews.freeb= sd.org/D39176" rel=3D"noreferrer noreferrer" target=3D"_blank">https://revi= ews.freebsd.org/D39176</a><br> <br> =C2=A0 =C2=A0 Sponsored by:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Netflix= <br> ---<br> =C2=A0sys/sys/_endian.h | 9 ++++++---<br> =C2=A01 file changed, 6 insertions(+), 3 deletions(-)<br> <br> diff --git a/sys/sys/_endian.h b/sys/sys/_endian.h<br> index 7ac39386e2e1..3b4460472eb6 100644<br> --- a/sys/sys/_endian.h<br> +++ b/sys/sys/_endian.h<br> @@ -36,6 +36,8 @@<br> =C2=A0#error "sys/_endian.h should not be included directly"<br> =C2=A0#endif<br> <br> +#include <sys/cdefs.h>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* visibility macros */<br> +<br> =C2=A0/* BSD Compatiblity */<br> =C2=A0#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 _BYTE_ORDER=C2=A0 =C2=A0 =C2=A0__B= YTE_ORDER__<br> <br> @@ -66,10 +68,11 @@<br> =C2=A0#endif<br> <br> =C2=A0/*<br> - * Deprecated variants that don't have enough underscores to be useful= in more<br> - * strict namespaces.<br> + * POSIX Issue 8 will require these for endian.h. Define them there and in= the<br> + * traditional BSD compilation environment. Since issue 8 doesn't yet = have an<br> + * assigned date, use strictly greater than issue 7's date.<br> =C2=A0 */<br> -#if __BSD_VISIBLE<br> +#if __BSD_VISIBLE || _POSIX_C_SOURCE > 200809<br> =C2=A0#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 LITTLE_ENDIAN=C2=A0 =C2=A0_LITTLE_= ENDIAN<br> =C2=A0#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 BIG_ENDIAN=C2=A0 =C2=A0 =C2=A0 _BI= G_ENDIAN<br> =C2=A0#define=C2=A0 =C2=A0 =C2=A0 =C2=A0 PDP_ENDIAN=C2=A0 =C2=A0 =C2=A0 _PD= P_ENDIAN<br> </blockquote></div> --000000000000d00d4605f7747732--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfogyesYVTnhqGB8zyYBMFEbzdX97oeFbqTjchqrS_RM=g>