Skip site navigation (1)Skip section navigation (2)
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

[-- Attachment #1 --]
On Mon, Jul 1, 2024, 3:53 PM 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=67d1a1cd9e772e2ef94003579f4fbc271d38be7d
> >
> > 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 = (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-like
> > @@ -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 >= 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

-- 
> John Baldwin
>
>

[-- Attachment #2 --]
<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jul 1, 2024, 3:53 PM John Baldwin &lt;<a href="mailto:jhb@freebsd.org">jhb@freebsd.org</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 6/20/24 7:41 PM, Warner Losh wrote:<br>
&gt; The branch main has been updated by imp:<br>
&gt; <br>
&gt; URL: <a href="https://cgit.FreeBSD.org/src/commit/?id=67d1a1cd9e772e2ef94003579f4fbc271d38be7d" rel="noreferrer noreferrer" target="_blank">https://cgit.FreeBSD.org/src/commit/?id=67d1a1cd9e772e2ef94003579f4fbc271d38be7d</a><br>;
&gt; <br>
&gt; commit 67d1a1cd9e772e2ef94003579f4fbc271d38be7d<br>
&gt; Author:     Warner Losh &lt;imp@FreeBSD.org&gt;<br>
&gt; AuthorDate: 2024-06-20 23:02:56 +0000<br>
&gt; Commit:     Warner Losh &lt;imp@FreeBSD.org&gt;<br>
&gt; CommitDate: 2024-06-21 02:41:08 +0000<br>
&gt; <br>
&gt;      cdefs.h: Remove support for pre gcc 4.0<br>
&gt;      <br>
&gt;      All supported compilers support the gcc 3 attribute extensions. Remove<br>
&gt;      the #else clauses for this. Also, latter-day pcc compilers also define<br>
&gt;      __GNUC__, so there&#39;s not need to also test for __PCC__.<br>
&gt;      <br>
&gt;      Reviewed by:            brooks<br>
&gt;      Differential Revision:  <a href="https://reviews.freebsd.org/D45654" rel="noreferrer noreferrer" target="_blank">https://reviews.freebsd.org/D45654</a><br>;
&gt;      Sponsored by:           Netflix<br>
&gt; ---<br>
&gt;   sys/sys/cdefs.h | 42 ++++--------------------------------------<br>
&gt;   1 file changed, 4 insertions(+), 38 deletions(-)<br>
&gt; <br>
&gt; diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h<br>
&gt; index 88019819eb35..a6ecdca5d8b9 100644<br>
&gt; --- a/sys/sys/cdefs.h<br>
&gt; +++ b/sys/sys/cdefs.h<br>
&gt; @@ -408,15 +389,10 @@<br>
&gt;    * assign pointer x to a local variable, to check that its type is<br>
&gt;    * compatible with member m.<br>
&gt;    */<br>
&gt; -#if __GNUC_PREREQ__(3, 1)<br>
&gt;   #define     __containerof(x, s, m) ({                                       \<br>
&gt;       const volatile __typeof(((s *)0)-&gt;m) *__x = (x);                \<br>
&gt;       __DEQUALIFY(s *, (const volatile char *)__x - __offsetof(s, m));\<br>
&gt;   })<br>
&gt; -#else<br>
&gt; -#define      __containerof(x, s, m)                                          \<br>
&gt; -     __DEQUALIFY(s *, (const volatile char *)(x) - __offsetof(s, m))<br>
&gt; -#endif<br>
&gt;   <br>
&gt;   /*<br>
&gt;    * Compiler-dependent macros to declare that functions take printf-like<br>
&gt; @@ -434,14 +410,8 @@<br>
&gt;   #define     __strftimelike(fmtarg, firstvararg) \<br>
&gt;           __attribute__((__format__ (__strftime__, fmtarg, firstvararg)))<br>
&gt;   <br>
&gt; -/* Compiler-dependent macros that rely on FreeBSD-specific extensions. */<br>
&gt; -#if defined(__FreeBSD_cc_version) &amp;&amp; __FreeBSD_cc_version &gt;= 300001 &amp;&amp; \<br>
&gt; -    defined(__GNUC__)<br>
&gt;   #define     __printf0like(fmtarg, firstvararg) \<br>
&gt;           __attribute__((__format__ (__printf0__, fmtarg, firstvararg)))<br>
&gt; -#else<br>
&gt; -#define      __printf0like(fmtarg, firstvararg)<br>
&gt; -#endif<br>
<br>
Does this still work with external GCC?  I didn&#39;t think printf0 was supported<br>
by external GCC (or maybe I had to readd it in the port and that&#39;s what I<br>
remember).  Ah, yes, printf0 is a local patch in the devel/freebsd-gccX<br>
ports, but is not available in stock GCC (e.g. lang/gcc does not support it).<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Ah. That would explain why it just worked for me. That&#39;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.</div><div dir="auto"><br></div><div dir="auto">Warner</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
-- <br>
John Baldwin<br>
<br>
</blockquote></div></div></div>

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfrrLWW=JSZ_%2BJcZkbyXnz4Av6dbqn2RBZRyh=8=R6n4zQ>