Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Jul 2024 15:20:00 -0600
From:      Warner Losh <imp@bsdimp.com>
To:        John Baldwin <jhb@freebsd.org>
Cc:        Warner Losh <imp@freebsd.org>, src-committers@freebsd.org,  dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org
Subject:   Re: git: 6677621bad00 - main - cdefs.h: Fallback to printf0 for __printf0like
Message-ID:  <CANCZdfp_AZWf=V1Oi6vbQsfx0o9eejs4kxBM6MR3a4dCZi%2B4GQ@mail.gmail.com>
In-Reply-To: <bddd5f4c-401a-4169-885d-58a81a7a122a@FreeBSD.org>
References:  <202407061944.466JiiQ3026410@gitrepo.freebsd.org> <a4a051a8-5715-4c5d-b755-83bd4bf8473f@FreeBSD.org> <bddd5f4c-401a-4169-885d-58a81a7a122a@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
--000000000000b78c8a061da0426b
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Wed, Jul 10, 2024 at 12:19=E2=80=AFPM John Baldwin <jhb@freebsd.org> wro=
te:

> On 7/6/24 17:56, John Baldwin wrote:
> > On 7/6/24 15:44, Warner Losh wrote:
> >> The branch main has been updated by imp:
> >>
> >> URL:
> https://cgit.FreeBSD.org/src/commit/?id=3D6677621bad00191dfec1b0a20ae1618=
b92745d9b
> >>
> >> commit 6677621bad00191dfec1b0a20ae1618b92745d9b
> >> Author:     Warner Losh <imp@FreeBSD.org>
> >> AuthorDate: 2024-07-06 19:42:37 +0000
> >> Commit:     Warner Losh <imp@FreeBSD.org>
> >> CommitDate: 2024-07-06 19:45:03 +0000
> >>
> >>       cdefs.h: Fallback to printf0 for __printf0like
> >>
> >>       For some reason, my tests were fine with this like it was, but C=
I
> for
> >>       gcc12 and gcc13 is complaining. Revert to the old form until tha=
t
> can be
> >>       worked out why the mismatch.
> >>
> >>       Fixes: 0b82dac337e7
> >>       Sponsored by:           Netflix
> >> ---
> >>    sys/sys/cdefs.h | 7 +++++--
> >>    1 file changed, 5 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h
> >> index 6b861b1903f6..a56839d57c7a 100644
> >> --- a/sys/sys/cdefs.h
> >> +++ b/sys/sys/cdefs.h
> >> @@ -356,9 +356,12 @@
> >>     * Clang has always had printf and printf0 as aliases. gcc 11.0 now
> follows
> >>     * clang. So now this is an alias for __printflike, or nothing. In
> the future
> >>     * _Nullable or _Nonnull will replace this.
> >> + * XXX Except that doesn't work, so for now revert to printf0 for
> clang and
> >> + * the FreeBSD gcc until I can work this out.
> >>     */
> >> -#if defined(__clang__) || __GNUC_PREREQ__(11, 0)
> >> -#define     __printf0like(fmtarg, firstvararg) __printflike(fmtarg,
> firstvararg)
> >> +#if defined(__clang__) || (defined(__GNUC__) && defined
> (__FreeBSD_cc_version))
> >> +#define     __printf0like(fmtarg, firstvararg) \
> >> +        __attribute__((__format__ (__printf0__, fmtarg, firstvararg))=
)
> >>    #else
> >>    #define   __printf0like(fmtarg, firstvararg)
> >>    #endif
> >
> > It's because my patch for devel/freebsd-gcc{12,13} is kind of wrong.  I
> had a mismerge
> > when updating the printf0 patch from gcc9 to gcc12 that ended up
> re-adding the
> > warn on NULL.  I need to update the ports to remove that part of the
> patch.  I will
> > probably leave printf0 working for now in the ports just as an alias fo=
r
> regular
> > printf to give us some transition time.
>
> FYI, I have merged this fix to the ports, but not sure how we want to
> manage doing
> the patch to cdefs.h.  I kind of think we should apply the change to
> cdefs.h in
> main in another week or so.  I'm less certain of what to do for stable
> branches.
>

I hadn't planned on merging this to stable branches. Is that your concern?
Or something else?
For building on the stable branch, we should be fine since we support a
wider range of
compilers anyway with the older cdefs.h file, and the new file will work
with all supported
stable branch compilers (though maybe not some of the gcc ones, I've not
tested
that at all).

Also it's been just over a week, can I recommit this, or is more time
needed?

Warner

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

<div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote">=
<div dir=3D"ltr" class=3D"gmail_attr">On Wed, Jul 10, 2024 at 12:19=E2=80=
=AFPM 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:0p=
x 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On=
 7/6/24 17:56, John Baldwin wrote:<br>
&gt; On 7/6/24 15:44, Warner Losh wrote:<br>
&gt;&gt; The branch main has been updated by imp:<br>
&gt;&gt;<br>
&gt;&gt; URL: <a href=3D"https://cgit.FreeBSD.org/src/commit/?id=3D6677621b=
ad00191dfec1b0a20ae1618b92745d9b" rel=3D"noreferrer" target=3D"_blank">http=
s://cgit.FreeBSD.org/src/commit/?id=3D6677621bad00191dfec1b0a20ae1618b92745=
d9b</a><br>
&gt;&gt;<br>
&gt;&gt; commit 6677621bad00191dfec1b0a20ae1618b92745d9b<br>
&gt;&gt; Author:=C2=A0 =C2=A0 =C2=A0Warner Losh &lt;imp@FreeBSD.org&gt;<br>
&gt;&gt; AuthorDate: 2024-07-06 19:42:37 +0000<br>
&gt;&gt; Commit:=C2=A0 =C2=A0 =C2=A0Warner Losh &lt;imp@FreeBSD.org&gt;<br>
&gt;&gt; CommitDate: 2024-07-06 19:45:03 +0000<br>
&gt;&gt;<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0cdefs.h: Fallback to printf0 for __print=
f0like<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0For some reason, my tests were fine with=
 this like it was, but CI for<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0gcc12 and gcc13 is complaining. Revert t=
o the old form until that can be<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0worked out why the mismatch.<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0Fixes: 0b82dac337e7<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0Sponsored by:=C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0Netflix<br>
&gt;&gt; ---<br>
&gt;&gt;=C2=A0 =C2=A0 sys/sys/cdefs.h | 7 +++++--<br>
&gt;&gt;=C2=A0 =C2=A0 1 file changed, 5 insertions(+), 2 deletions(-)<br>
&gt;&gt;<br>
&gt;&gt; diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h<br>
&gt;&gt; index 6b861b1903f6..a56839d57c7a 100644<br>
&gt;&gt; --- a/sys/sys/cdefs.h<br>
&gt;&gt; +++ b/sys/sys/cdefs.h<br>
&gt;&gt; @@ -356,9 +356,12 @@<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0* Clang has always had printf and printf0 as al=
iases. gcc 11.0 now follows<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0* clang. So now this is an alias for __printfli=
ke, or nothing. In the future<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0* _Nullable or _Nonnull will replace this.<br>
&gt;&gt; + * XXX Except that doesn&#39;t work, so for now revert to printf0=
 for clang and<br>
&gt;&gt; + * the FreeBSD gcc until I can work this out.<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0*/<br>
&gt;&gt; -#if defined(__clang__) || __GNUC_PREREQ__(11, 0)<br>
&gt;&gt; -#define=C2=A0 =C2=A0 =C2=A0__printf0like(fmtarg, firstvararg) __p=
rintflike(fmtarg, firstvararg)<br>
&gt;&gt; +#if defined(__clang__) || (defined(__GNUC__) &amp;&amp; defined (=
__FreeBSD_cc_version))<br>
&gt;&gt; +#define=C2=A0 =C2=A0 =C2=A0__printf0like(fmtarg, firstvararg) \<b=
r>
&gt;&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 __attribute__((__format__ (__printf0_=
_, fmtarg, firstvararg)))<br>
&gt;&gt;=C2=A0 =C2=A0 #else<br>
&gt;&gt;=C2=A0 =C2=A0 #define=C2=A0 =C2=A0__printf0like(fmtarg, firstvararg=
)<br>
&gt;&gt;=C2=A0 =C2=A0 #endif<br>
&gt; <br>
&gt; It&#39;s because my patch for devel/freebsd-gcc{12,13} is kind of wron=
g.=C2=A0 I had a mismerge<br>
&gt; when updating the printf0 patch from gcc9 to gcc12 that ended up re-ad=
ding the<br>
&gt; warn on NULL.=C2=A0 I need to update the ports to remove that part of =
the patch.=C2=A0 I will<br>
&gt; probably leave printf0 working for now in the ports just as an alias f=
or regular<br>
&gt; printf to give us some transition time.<br>
<br>
FYI, I have merged this fix to the ports, but not sure how we want to manag=
e doing<br>
the patch to cdefs.h.=C2=A0 I kind of think we should apply the change to c=
defs.h in<br>
main in another week or so.=C2=A0 I&#39;m less certain of what to do for st=
able branches.<br></blockquote><div><br></div><div>I hadn&#39;t planned on =
merging this to stable branches. Is that your concern? Or something else?</=
div><div>For building on the stable branch, we should be fine since we supp=
ort a wider range of</div><div>compilers anyway with the older cdefs.h file=
, and the new file will work with all supported</div><div>stable branch com=
pilers (though maybe not some of the gcc ones, I&#39;ve not tested</div><di=
v>that at all).</div><div><br></div><div>Also it&#39;s been just over a wee=
k, can I recommit this, or is more time needed?</div><div><br></div><div>Wa=
rner</div></div></div>

--000000000000b78c8a061da0426b--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfp_AZWf=V1Oi6vbQsfx0o9eejs4kxBM6MR3a4dCZi%2B4GQ>