Date: Mon, 1 Jul 2024 17:09:24 -0600 From: Warner Losh <imp@bsdimp.com> To: John Baldwin <jhb@freebsd.org> Cc: Warner Losh <imp@freebsd.org>, src-committers <src-committers@freebsd.org>, "<dev-commits-src-all@freebsd.org>" <dev-commits-src-all@freebsd.org>, "<dev-commits-src-main@freebsd.org>" <dev-commits-src-main@freebsd.org> Subject: Re: git: 67d1a1cd9e77 - main - cdefs.h: Remove support for pre gcc 4.0 Message-ID: <CANCZdfrrLWW=JSZ_%2BJcZkbyXnz4Av6dbqn2RBZRyh=8=R6n4zQ@mail.gmail.com> In-Reply-To: <4ecc814d-5df1-4db8-b9e0-4919895c5e6a@FreeBSD.org> References: <202406210241.45L2fOkP057010@gitrepo.freebsd.org> <4ecc814d-5df1-4db8-b9e0-4919895c5e6a@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--000000000000d90221061c37b0ad Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Jul 1, 2024, 3:53=E2=80=AFPM John Baldwin <jhb@freebsd.org> wrote: > On 6/20/24 7:41 PM, Warner Losh wrote: > > The branch main has been updated by imp: > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=3D67d1a1cd9e772e2ef94003579f4fbc2= 71d38be7d > > > > commit 67d1a1cd9e772e2ef94003579f4fbc271d38be7d > > Author: Warner Losh <imp@FreeBSD.org> > > AuthorDate: 2024-06-20 23:02:56 +0000 > > Commit: Warner Losh <imp@FreeBSD.org> > > CommitDate: 2024-06-21 02:41:08 +0000 > > > > cdefs.h: Remove support for pre gcc 4.0 > > > > All supported compilers support the gcc 3 attribute extensions. > Remove > > the #else clauses for this. Also, latter-day pcc compilers also > define > > __GNUC__, so there's not need to also test for __PCC__. > > > > Reviewed by: brooks > > Differential Revision: https://reviews.freebsd.org/D45654 > > Sponsored by: Netflix > > --- > > sys/sys/cdefs.h | 42 ++++-------------------------------------- > > 1 file changed, 4 insertions(+), 38 deletions(-) > > > > diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h > > index 88019819eb35..a6ecdca5d8b9 100644 > > --- a/sys/sys/cdefs.h > > +++ b/sys/sys/cdefs.h > > @@ -408,15 +389,10 @@ > > * assign pointer x to a local variable, to check that its type is > > * compatible with member m. > > */ > > -#if __GNUC_PREREQ__(3, 1) > > #define __containerof(x, s, m) ({ > \ > > const volatile __typeof(((s *)0)->m) *__x =3D (x); = \ > > __DEQUALIFY(s *, (const volatile char *)__x - __offsetof(s, m));\ > > }) > > -#else > > -#define __containerof(x, s, m) > \ > > - __DEQUALIFY(s *, (const volatile char *)(x) - __offsetof(s, m)) > > -#endif > > > > /* > > * Compiler-dependent macros to declare that functions take printf-li= ke > > @@ -434,14 +410,8 @@ > > #define __strftimelike(fmtarg, firstvararg) \ > > __attribute__((__format__ (__strftime__, fmtarg, firstvararg)= )) > > > > -/* Compiler-dependent macros that rely on FreeBSD-specific extensions. > */ > > -#if defined(__FreeBSD_cc_version) && __FreeBSD_cc_version >=3D 300001 = && \ > > - defined(__GNUC__) > > #define __printf0like(fmtarg, firstvararg) \ > > __attribute__((__format__ (__printf0__, fmtarg, firstvararg))= ) > > -#else > > -#define __printf0like(fmtarg, firstvararg) > > -#endif > > Does this still work with external GCC? I didn't think printf0 was > supported > by external GCC (or maybe I had to readd it in the port and that's what I > remember). Ah, yes, printf0 is a local patch in the devel/freebsd-gccX > ports, but is not available in stock GCC (e.g. lang/gcc does not support > it). > Ah. That would explain why it just worked for me. That's what I tested with. Clang also seemed happy with it. But that was the in tree clang. Is there a similar issue? Gnuc is defined for both. Warner --=20 > John Baldwin > > --000000000000d90221061c37b0ad Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"auto"><div><br><br><div class=3D"gmail_quote"><div dir=3D"ltr" = class=3D"gmail_attr">On Mon, Jul 1, 2024, 3:53=E2=80=AFPM John Baldwin <= <a href=3D"mailto:jhb@freebsd.org">jhb@freebsd.org</a>> wrote:<br></div>= <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex">On 6/20/24 7:41 PM, Warner Losh wrote:<br> > The branch main has been updated by imp:<br> > <br> > URL: <a href=3D"https://cgit.FreeBSD.org/src/commit/?id=3D67d1a1cd9e77= 2e2ef94003579f4fbc271d38be7d" rel=3D"noreferrer noreferrer" target=3D"_blan= k">https://cgit.FreeBSD.org/src/commit/?id=3D67d1a1cd9e772e2ef94003579f4fbc= 271d38be7d</a><br> > <br> > commit 67d1a1cd9e772e2ef94003579f4fbc271d38be7d<br> > Author:=C2=A0 =C2=A0 =C2=A0Warner Losh <imp@FreeBSD.org><br> > AuthorDate: 2024-06-20 23:02:56 +0000<br> > Commit:=C2=A0 =C2=A0 =C2=A0Warner Losh <imp@FreeBSD.org><br> > CommitDate: 2024-06-21 02:41:08 +0000<br> > <br> >=C2=A0 =C2=A0 =C2=A0 cdefs.h: Remove support for pre gcc 4.0<br> >=C2=A0 =C2=A0 =C2=A0 <br> >=C2=A0 =C2=A0 =C2=A0 All supported compilers support the gcc 3 attribut= e extensions. Remove<br> >=C2=A0 =C2=A0 =C2=A0 the #else clauses for this. Also, latter-day pcc c= ompilers also define<br> >=C2=A0 =C2=A0 =C2=A0 __GNUC__, so there's not need to also test for= __PCC__.<br> >=C2=A0 =C2=A0 =C2=A0 <br> >=C2=A0 =C2=A0 =C2=A0 Reviewed by:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 brooks<br> >=C2=A0 =C2=A0 =C2=A0 Differential Revision:=C2=A0 <a href=3D"https://re= views.freebsd.org/D45654" rel=3D"noreferrer noreferrer" target=3D"_blank">h= ttps://reviews.freebsd.org/D45654</a><br> >=C2=A0 =C2=A0 =C2=A0 Sponsored by:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0Netflix<br> > ---<br> >=C2=A0 =C2=A0sys/sys/cdefs.h | 42 ++++---------------------------------= -----<br> >=C2=A0 =C2=A01 file changed, 4 insertions(+), 38 deletions(-)<br> > <br> > diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h<br> > index 88019819eb35..a6ecdca5d8b9 100644<br> > --- a/sys/sys/cdefs.h<br> > +++ b/sys/sys/cdefs.h<br> > @@ -408,15 +389,10 @@<br> >=C2=A0 =C2=A0 * assign pointer x to a local variable, to check that its= type is<br> >=C2=A0 =C2=A0 * compatible with member m.<br> >=C2=A0 =C2=A0 */<br> > -#if __GNUC_PREREQ__(3, 1)<br> >=C2=A0 =C2=A0#define=C2=A0 =C2=A0 =C2=A0__containerof(x, s, m) ({=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 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\<br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0const volatile __typeof(((s *)0)->m) *__x= =3D (x);=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \<br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0__DEQUALIFY(s *, (const volatile char *)__x = - __offsetof(s, m));\<br> >=C2=A0 =C2=A0})<br> > -#else<br> > -#define=C2=A0 =C2=A0 =C2=A0 __containerof(x, s, m)=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 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \<br> > -=C2=A0 =C2=A0 =C2=A0__DEQUALIFY(s *, (const volatile char *)(x) - __o= ffsetof(s, m))<br> > -#endif<br> >=C2=A0 =C2=A0<br> >=C2=A0 =C2=A0/*<br> >=C2=A0 =C2=A0 * Compiler-dependent macros to declare that functions tak= e printf-like<br> > @@ -434,14 +410,8 @@<br> >=C2=A0 =C2=A0#define=C2=A0 =C2=A0 =C2=A0__strftimelike(fmtarg, firstvar= arg) \<br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__attribute__((__format__ (__s= trftime__, fmtarg, firstvararg)))<br> >=C2=A0 =C2=A0<br> > -/* Compiler-dependent macros that rely on FreeBSD-specific extensions= . */<br> > -#if defined(__FreeBSD_cc_version) && __FreeBSD_cc_version >= ;=3D 300001 && \<br> > -=C2=A0 =C2=A0 defined(__GNUC__)<br> >=C2=A0 =C2=A0#define=C2=A0 =C2=A0 =C2=A0__printf0like(fmtarg, firstvara= rg) \<br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__attribute__((__format__ (__p= rintf0__, fmtarg, firstvararg)))<br> > -#else<br> > -#define=C2=A0 =C2=A0 =C2=A0 __printf0like(fmtarg, firstvararg)<br> > -#endif<br> <br> Does this still work with external GCC?=C2=A0 I didn't think printf0 wa= s supported<br> by external GCC (or maybe I had to readd it in the port and that's what= I<br> remember).=C2=A0 Ah, yes, printf0 is a local patch in the devel/freebsd-gcc= X<br> ports, but is not available in stock GCC (e.g. lang/gcc does not support it= ).<br></blockquote></div></div><div dir=3D"auto"><br></div><div dir=3D"auto= ">Ah. That would explain why it just worked for me. That's what I teste= d with. Clang also seemed happy with it. But that was the in tree clang. Is= there a similar issue? Gnuc is defined for both.</div><div dir=3D"auto"><b= r></div><div dir=3D"auto">Warner</div><div dir=3D"auto"><br></div><div dir= =3D"auto"><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" styl= e=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> -- <br> John Baldwin<br> <br> </blockquote></div></div></div> --000000000000d90221061c37b0ad--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfrrLWW=JSZ_%2BJcZkbyXnz4Av6dbqn2RBZRyh=8=R6n4zQ>