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>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --] 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 > [-- Attachment #2 --] <div dir="auto">Doh. Should have changed ctypes.h to cdefs.h, but rushed a bit and forgot.<div dir="auto"><br></div><div dir="auto">Warner </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Mar 22, 2023, 3:26 AM Warner Losh <<a href="mailto:imp@freebsd.org">imp@freebsd.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The branch main has been updated by imp:<br> <br> URL: <a href="https://cgit.FreeBSD.org/src/commit/?id=ed52baf51bd142b5e32701842346452a7ebe37a5" rel="noreferrer noreferrer" target="_blank">https://cgit.FreeBSD.org/src/commit/?id=ed52baf51bd142b5e32701842346452a7ebe37a5</a><br> <br> commit ed52baf51bd142b5e32701842346452a7ebe37a5<br> Author: Warner Losh <imp@FreeBSD.org><br> AuthorDate: 2023-03-22 02:25:58 +0000<br> Commit: Warner Losh <imp@FreeBSD.org><br> CommitDate: 2023-03-22 02:25:58 +0000<br> <br> _endian.h: Include sys/ctypes.h for visibility macros<br> <br> BYTE_ORDER, LITTLE_ENDIAN and BIG_ENDIAN will be required by the<br> forthcoming POSIX Issue 8. In addition, they are provided in the BSD<br> compilation environments. However, depending on the order includes<br> happend, sys/cdefs.h may or may not be included when endian.h is<br> included. Include it here so we can safely test __BSD_VISIBLE. Add<br> visibility when we're compiling in the future for issue 8, but since the<br> date number for issue 8 hasn't been fixed, use strictly greater than the<br> issue 7 date.of 200809.<br> <br> This had the side effect of sometimes (in the traditional BSD<br> compliation environment)<br> #if BYTE_ORDER == LITTLE_ENDIAN<br> and<br> #if BYTE_ORDER == BIG_ENDIAN<br> both being true because none of these were defined. This fixes<br> that. It also fixes including it after <stdio.h> but not before.<br> <br> PR: 269249<br> MFC After: 1d (build related)<br> Reviewed by: kib, emaste<br> Differential Revision: <a href="https://reviews.freebsd.org/D39176" rel="noreferrer noreferrer" target="_blank">https://reviews.freebsd.org/D39176</a><br> <br> Sponsored by: Netflix<br> ---<br> sys/sys/_endian.h | 9 ++++++---<br> 1 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> #error "sys/_endian.h should not be included directly"<br> #endif<br> <br> +#include <sys/cdefs.h> /* visibility macros */<br> +<br> /* BSD Compatiblity */<br> #define _BYTE_ORDER __BYTE_ORDER__<br> <br> @@ -66,10 +68,11 @@<br> #endif<br> <br> /*<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> */<br> -#if __BSD_VISIBLE<br> +#if __BSD_VISIBLE || _POSIX_C_SOURCE > 200809<br> #define LITTLE_ENDIAN _LITTLE_ENDIAN<br> #define BIG_ENDIAN _BIG_ENDIAN<br> #define PDP_ENDIAN _PDP_ENDIAN<br> </blockquote></div>help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfogyesYVTnhqGB8zyYBMFEbzdX97oeFbqTjchqrS_RM=g>
