Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Oct 2022 14:50:23 -0600
From:      Warner Losh <imp@bsdimp.com>
To:        John Baldwin <jhb@freebsd.org>
Cc:        src-committers@freebsd.org, dev-commits-src-all@freebsd.org,  dev-commits-src-main@freebsd.org
Subject:   Re: git: ce9e720af2f8 - main - <sys/_pv_entry>: Add a fallback for __LONG_WIDTH__ for older compilers.
Message-ID:  <CANCZdfohv6vpbfi1XuXnLKrfF=cyEWWOXR8JQbDTYWgk7pvTKg@mail.gmail.com>
In-Reply-To: <28566608-eb68-7948-77b5-5e49739d8ec5@FreeBSD.org>
References:  <202210072032.297KWiuG035424@gitrepo.freebsd.org> <28566608-eb68-7948-77b5-5e49739d8ec5@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
--0000000000001d34d305ea77f604
Content-Type: text/plain; charset="UTF-8"

Hey John,

On Fri, Oct 7, 2022 at 2:43 PM John Baldwin <jhb@freebsd.org> wrote:

> On 10/7/22 1:32 PM, John Baldwin wrote:
> > The branch main has been updated by jhb:
> >
> > URL:
> https://cgit.FreeBSD.org/src/commit/?id=ce9e720af2f8fa378e36134bab8a82ebf67c159d
> >
> > commit ce9e720af2f8fa378e36134bab8a82ebf67c159d
> > Author:     John Baldwin <jhb@FreeBSD.org>
> > AuthorDate: 2022-10-07 19:44:31 +0000
> > Commit:     John Baldwin <jhb@FreeBSD.org>
> > CommitDate: 2022-10-07 19:44:31 +0000
> >
> >      <sys/_pv_entry>: Add a fallback for __LONG_WIDTH__ for older
> compilers.
> >
> >      clang only includes a __LONG_WIDTH__ builtin in clang 14 and later.
> > ---
> >   sys/sys/_pv_entry.h | 5 +++++
> >   1 file changed, 5 insertions(+)
> >
> > diff --git a/sys/sys/_pv_entry.h b/sys/sys/_pv_entry.h
> > index 411643cf49ec..3cd0d9c687f6 100644
> > --- a/sys/sys/_pv_entry.h
> > +++ b/sys/sys/_pv_entry.h
> > @@ -77,6 +77,11 @@ typedef struct pv_entry {
> >   #error Unsupported page size
> >   #endif
> >
> > +/* Support clang < 14 */
> > +#ifndef __LONG_WIDTH__
> > +#define      __LONG_WIDTH__  (__CHAR_BIT__ * __SIZEOF_LONG__)
> > +#endif
> > +
>
> This was the smallest change to fix CI breakage.  However, we may want to
> do
> this differently.  We could perhaps add this fallback for __LONG_WIDTH__ to
> <sys/cdefs.h>, or we could change sys/_pv_entry.h to use the expanded form
> always (or pick a different spelling?)
>

I'm inclined to move those 5 lines to sys/cdefs.h since that file generally
tries to provide
either a FreeBSD-specific spelling of compiler-specific things, or provides
the standard
thing when that's not available. __LONG_WIDTH__ is trending towards
standardization,
imho, so it may make sense to standardize FreeBSD's uses there as well.

Warner

--0000000000001d34d305ea77f604
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr">Hey John,<br></div><br><div class=3D"gmai=
l_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Fri, Oct 7, 2022 at 2:43 =
PM John Baldwin &lt;<a href=3D"mailto:jhb@freebsd.org">jhb@freebsd.org</a>&=
gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0=
px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 10=
/7/22 1:32 PM, John Baldwin wrote:<br>
&gt; The branch main has been updated by jhb:<br>
&gt; <br>
&gt; URL: <a href=3D"https://cgit.FreeBSD.org/src/commit/?id=3Dce9e720af2f8=
fa378e36134bab8a82ebf67c159d" rel=3D"noreferrer" target=3D"_blank">https://=
cgit.FreeBSD.org/src/commit/?id=3Dce9e720af2f8fa378e36134bab8a82ebf67c159d<=
/a><br>
&gt; <br>
&gt; commit ce9e720af2f8fa378e36134bab8a82ebf67c159d<br>
&gt; Author:=C2=A0 =C2=A0 =C2=A0John Baldwin &lt;jhb@FreeBSD.org&gt;<br>
&gt; AuthorDate: 2022-10-07 19:44:31 +0000<br>
&gt; Commit:=C2=A0 =C2=A0 =C2=A0John Baldwin &lt;jhb@FreeBSD.org&gt;<br>
&gt; CommitDate: 2022-10-07 19:44:31 +0000<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0 &lt;sys/_pv_entry&gt;: Add a fallback for __LONG_W=
IDTH__ for older compilers.<br>
&gt;=C2=A0 =C2=A0 =C2=A0 <br>
&gt;=C2=A0 =C2=A0 =C2=A0 clang only includes a __LONG_WIDTH__ builtin in cl=
ang 14 and later.<br>
&gt; ---<br>
&gt;=C2=A0 =C2=A0sys/sys/_pv_entry.h | 5 +++++<br>
&gt;=C2=A0 =C2=A01 file changed, 5 insertions(+)<br>
&gt; <br>
&gt; diff --git a/sys/sys/_pv_entry.h b/sys/sys/_pv_entry.h<br>
&gt; index 411643cf49ec..3cd0d9c687f6 100644<br>
&gt; --- a/sys/sys/_pv_entry.h<br>
&gt; +++ b/sys/sys/_pv_entry.h<br>
&gt; @@ -77,6 +77,11 @@ typedef struct pv_entry {<br>
&gt;=C2=A0 =C2=A0#error Unsupported page size<br>
&gt;=C2=A0 =C2=A0#endif<br>
&gt;=C2=A0 =C2=A0<br>
&gt; +/* Support clang &lt; 14 */<br>
&gt; +#ifndef __LONG_WIDTH__<br>
&gt; +#define=C2=A0 =C2=A0 =C2=A0 __LONG_WIDTH__=C2=A0 (__CHAR_BIT__ * __SI=
ZEOF_LONG__)<br>
&gt; +#endif<br>
&gt; +<br>
<br>
This was the smallest change to fix CI breakage.=C2=A0 However, we may want=
 to do<br>
this differently.=C2=A0 We could perhaps add this fallback for __LONG_WIDTH=
__ to<br>
&lt;sys/cdefs.h&gt;, or we could change sys/_pv_entry.h to use the expanded=
 form<br>
always (or pick a different spelling?)<br></blockquote><div><br></div><div>=
I&#39;m inclined to move those 5 lines to sys/cdefs.h since that file gener=
ally tries to provide</div><div>either a FreeBSD-specific spelling of compi=
ler-specific things, or provides the standard</div><div>thing when that&#39=
;s not available. __LONG_WIDTH__ is trending towards standardization,</div>=
<div>imho, so it may make sense to standardize FreeBSD&#39;s uses there as =
well.</div><div><br></div><div>Warner</div></div></div>

--0000000000001d34d305ea77f604--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfohv6vpbfi1XuXnLKrfF=cyEWWOXR8JQbDTYWgk7pvTKg>