From nobody Tue Jul 02 16:30:03 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WD7gF5y83z5Nh11 for ; Tue, 02 Jul 2024 16:30:17 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WD7gD6KGcz4Cy4 for ; Tue, 2 Jul 2024 16:30:16 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-pj1-x1033.google.com with SMTP id 98e67ed59e1d1-2c7bf925764so3217303a91.0 for ; Tue, 02 Jul 2024 09:30:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20230601.gappssmtp.com; s=20230601; t=1719937815; x=1720542615; darn=freebsd.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=v3dB22oSaRx4YTp6pS6wENk7E//T+T7NNvOn6tc/RS8=; b=gXW4OmAew/GdA5PyDxfFIYvKy3dI1+eDTew2tjWsWC2r59v3NFrpLntPRyr9QbB+AO U1ohTtnPK0dWpC3ckHN6CoevlkkxiM2w4gNk2tbC/gA8JIYsaI1F3KoLeDo/bXpf4Bga vXI2zOzLPtoI+zoex4VVFyEUodXxnoq1o0YMBMuRicivGZPHFTbbK/Mj7/FkaQ0lB0DM CMMd6bprwerBV4D1ssxz5huZ2jUGXtVxbAv0pFG4Og/5xq8IaG8Q2fZh9Jdt46PLxQtM BwuCoGRpEAL4FnbrIjctyK/BMpCSjyBOvMZNl/jzVH22L8/zt5AqPrrui2dBLORDgFxC LnYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719937815; x=1720542615; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=v3dB22oSaRx4YTp6pS6wENk7E//T+T7NNvOn6tc/RS8=; b=v5xTv2gKdhXaNZ6Lss5pWRaAbL5qcMmd9eFdkuFmCL9MdksBMQNIIBYH+98f4oPn1H ISSbRHzJ5XuENJdV4BROU/OdL2NYyiyWjXYgr32jR6WZ9MiqDvAIFGn+jJcbd2Kk7HQL zfJZY3u0TxK3ZaUmlEchDd2qdHvwzb6PjUgdcKxxajMipwrsLAd0gxx7D/jmLBi9WWBK CZDUMdDNBcQFp7OnzzGisi9pH5LqqgXR908badpjJUrAQng0M7+hWEHXFoNmAKnfrPHv 4YnBLYqM2ksOXdMAyEnB7d8k+SDpFi4oNynCv88VKjaKZ67qjLWBLUZ185QvsYG4/252 w5rw== X-Forwarded-Encrypted: i=1; AJvYcCUorXiXFXTkjCThIdN5r0WO0+ErQSYOKdG2zwyZoRs81D6qUryIyu6W1DDLFX6Xjx0alGgDLpFjvoekSh6sE6+tOETxggG/f/MB12K0897R X-Gm-Message-State: AOJu0Yw2J5il1UARFZYwNIvb/KL52hhYNHfZEo9iJ4P4XakGd3CfSmRB KzReFvL31cT1uL+YUD/iV8Vr4QuBFCd322vuYyHL0qEjhBZRre8Sr2zYNYAjawzXM4+y0cRpz9+ yfNmcGoGLrJ9pLx4I3xshySNrVQiJ0kb3jRKTfw== X-Google-Smtp-Source: AGHT+IGoU/zEg6KnsT+fzeU+tP5ha6HNp+u5J96hqizKO5/FSqnQrQNlEeUZ1ZHTd8gbyW549xh9hep1ZaJoDswlh6M= X-Received: by 2002:a17:90a:883:b0:2c9:2d00:44e with SMTP id 98e67ed59e1d1-2c93d710b9cmr7575037a91.14.1719937814852; Tue, 02 Jul 2024 09:30:14 -0700 (PDT) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 References: <202406210241.45L2fOkP057010@gitrepo.freebsd.org> <4ecc814d-5df1-4db8-b9e0-4919895c5e6a@FreeBSD.org> In-Reply-To: From: Warner Losh Date: Tue, 2 Jul 2024 10:30:03 -0600 Message-ID: Subject: Re: git: 67d1a1cd9e77 - main - cdefs.h: Remove support for pre gcc 4.0 To: John Baldwin Cc: Warner Losh , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: multipart/alternative; boundary="0000000000007d9a9f061c463ae8" X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] X-Rspamd-Queue-Id: 4WD7gD6KGcz4Cy4 --0000000000007d9a9f061c463ae8 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hey John, On Tue, Jul 2, 2024 at 9:44=E2=80=AFAM John Baldwin wrote= : > On 7/1/24 4:09 PM, Warner Losh wrote: > > On Mon, Jul 1, 2024, 3:53=E2=80=AFPM John Baldwin wro= te: > > > >> 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 > >>> AuthorDate: 2024-06-20 23:02:56 +0000 > >>> Commit: Warner Losh > >>> 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-like > >>> @@ -434,14 +410,8 @@ > >>> #define __strftimelike(fmtarg, firstvararg) \ > >>> __attribute__((__format__ (__strftime__, fmtarg, > firstvararg))) > >>> > >>> -/* Compiler-dependent macros that rely on FreeBSD-specific extension= s. > >> */ > >>> -#if defined(__FreeBSD_cc_version) && __FreeBSD_cc_version >=3D 30000= 1 > && \ > >>> - 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 wha= t > I > >> remember). Ah, yes, printf0 is a local patch in the devel/freebsd-gcc= X > >> ports, but is not available in stock GCC (e.g. lang/gcc does not suppo= rt > >> 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. > > So we don't support building the base system with lang/gcc, only > devel/freebsd-gccX (which has a local patch to add printf0 support). > The only question might be, do we support using __printf0like for things > that aren't in the base system that could be built with lang/gcc. If so, > we might need to guard this somehow. I'm not sure though that we care > about random software not in base using a FreeBSD-specific keyword from > . > Yes. The question is "do we use __printf0like in our headers" since we definitely can't build FreeBSD itself w/o at least some of the extensions for other things... and the answer is "yes". err.h uses it, for example, as does setproctitle in stdlib.h The interesting thing for me is that gcc13 will produce no warnings if I include errr.h because -Wsystem-header is off. With it on, warnings crop up too. This is why my testing didn't see it... It looks like clang has it as a builtin for all versions we care about, so I'll create a phab to add some of this back. Maybe we should upstream what we have, for this and freebsd_printf since that's also in clang and one of the small number of patches we have for the lang/gcc* family? Warner --0000000000007d9a9f061c463ae8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hey John,

On Tue, Jul 2, 2024 at 9:44= =E2=80=AFAM John Baldwin <jhb@freebsd= .org> wrote:
On 7/1/24 4:09 PM, Warner Losh wrote:
> 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://c= git.FreeBSD.org/src/commit/?id=3D67d1a1cd9e772e2ef94003579f4fbc271d38be7d
>>>
>>> commit 67d1a1cd9e772e2ef94003579f4fbc271d38be7d
>>> Author:=C2=A0 =C2=A0 =C2=A0Warner Losh <imp@FreeBSD.org>=
>>> AuthorDate: 2024-06-20 23:02:56 +0000
>>> Commit:=C2=A0 =C2=A0 =C2=A0Warner Losh <imp@FreeBSD.org>=
>>> CommitDate: 2024-06-21 02:41:08 +0000
>>>
>>>=C2=A0 =C2=A0 =C2=A0 =C2=A0cdefs.h: Remove support for pre gcc = 4.0
>>>
>>>=C2=A0 =C2=A0 =C2=A0 =C2=A0All supported compilers support the = gcc 3 attribute extensions.
>> Remove
>>>=C2=A0 =C2=A0 =C2=A0 =C2=A0the #else clauses for this. Also, la= tter-day pcc compilers also
>> define
>>>=C2=A0 =C2=A0 =C2=A0 =C2=A0__GNUC__, so there's not need to= also test for __PCC__.
>>>
>>>=C2=A0 =C2=A0 =C2=A0 =C2=A0Reviewed by:=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 brooks
>>>=C2=A0 =C2=A0 =C2=A0 =C2=A0Differential Revision:=C2=A0
https://reviews.freebsd.org/D45654
>>>=C2=A0 =C2=A0 =C2=A0 =C2=A0Sponsored by:=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0Netflix
>>> ---
>>>=C2=A0 =C2=A0 sys/sys/cdefs.h | 42 ++++------------------------= --------------
>>>=C2=A0 =C2=A0 1 file changed, 4 insertions(+), 38 deletions(-)<= br> >>>
>>> 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 @@
>>>=C2=A0 =C2=A0 =C2=A0* assign pointer x to a local variable, to = check that its type is
>>>=C2=A0 =C2=A0 =C2=A0* compatible with member m.
>>>=C2=A0 =C2=A0 =C2=A0*/
>>> -#if __GNUC_PREREQ__(3, 1)
>>>=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 const volatile __typeof(((s *)0)-&g= t;m) *__x =3D (x);=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \=
>>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 __DEQUALIFY(s *, (const volatile ch= ar *)__x - __offsetof(s, m));\
>>>=C2=A0 =C2=A0 })
>>> -#else
>>> -#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__DEQUALIFY(s *, (const volatile char *)(= x) - __offsetof(s, m))
>>> -#endif
>>>
>>>=C2=A0 =C2=A0 /*
>>>=C2=A0 =C2=A0 =C2=A0* Compiler-dependent macros to declare that= functions take printf-like
>>> @@ -434,14 +410,8 @@
>>>=C2=A0 =C2=A0 #define=C2=A0 =C2=A0 =C2=A0__strftimelike(fmtarg,= firstvararg) \
>>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 __attribute__((__form= at__ (__strftime__, fmtarg, firstvararg)))
>>>
>>> -/* Compiler-dependent macros that rely on FreeBSD-specific ex= tensions.
>> */
>>> -#if defined(__FreeBSD_cc_version) && __FreeBSD_cc_ver= sion >=3D 300001 && \
>>> -=C2=A0 =C2=A0 defined(__GNUC__)
>>>=C2=A0 =C2=A0 #define=C2=A0 =C2=A0 =C2=A0__printf0like(fmtarg, = firstvararg) \
>>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 __attribute__((__form= at__ (__printf0__, fmtarg, firstvararg)))
>>> -#else
>>> -#define=C2=A0 =C2=A0 =C2=A0 __printf0like(fmtarg, firstvararg= )
>>> -#endif
>>
>> Does this still work with external GCC?=C2=A0 I didn't think p= rintf0 was
>> supported
>> by external GCC (or maybe I had to readd it in the port and that&#= 39;s what I
>> remember).=C2=A0 Ah, yes, printf0 is a local patch in the devel/fr= eebsd-gccX
>> ports, but is not available in stock GCC (e.g. lang/gcc does not s= upport
>> it).
>>
>
> Ah. That would explain why it just worked for me. That's what I te= sted
> with. Clang also seemed happy with it. But that was the in tree clang.= Is
> there a similar issue? Gnuc is defined for both.

So we don't support building the base system with lang/gcc, only
devel/freebsd-gccX (which has a local patch to add printf0 support).
The only question might be, do we support using __printf0like for things that aren't in the base system that could be built with lang/gcc.=C2=A0= If so,
we might need to guard this somehow.=C2=A0 I'm not sure though that we = care
about random software not in base using a FreeBSD-specific keyword from
<sys/cdefs.h>.

Yes. The question = is "do we use __printf0like=C2=A0 in our headers" since we defini= tely
can't build FreeBSD itself w/o at least some of the exte= nsions for other things...
and the answer is "yes". err= .h uses it, for example, as does setproctitle in stdlib.h

The interesting thing for me is that gcc13 will produce no warnings= if I include errr.h=C2=A0
because -Wsystem-header=C2=A0is off. W= ith it on, warnings crop up too. This is why my testing
didn'= t see it...

It looks like clang has it as a builti= n for all versions we care about, so I'll create a phab to add some
of this back. Maybe we should upstream what we have, for this and fr= eebsd_printf since that's also
in clang and one of the small = number of patches we have for the lang/gcc* family?

Warner
--0000000000007d9a9f061c463ae8--