From nobody Tue Jul 02 17:58:16 2024 X-Original-To: dev-commits-src-main@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 4WD9d14sFvz5Nvhy for ; Tue, 02 Jul 2024 17:58:29 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) (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 4WD9d10Bw2z4SXK for ; Tue, 2 Jul 2024 17:58:29 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20230601.gappssmtp.com header.s=20230601 header.b=gYqubMqi; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::435) smtp.mailfrom=wlosh@bsdimp.com Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-706738c209bso2729741b3a.3 for ; Tue, 02 Jul 2024 10:58:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20230601.gappssmtp.com; s=20230601; t=1719943107; x=1720547907; 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=kg8+wh+GyM079h6A9LD6SNRYl5PVcgITK3wsoj4NS3U=; b=gYqubMqivcuoZrrVhW1elshoTW0jM41BAc7HFGiBUQ+jmqphKzcnnfTiozZekIclJ+ Ig1V71DMvOQF1zJjsepZjWkRZa3V2flrr+QUHBvGSXMUQ0qaE9nz5NAYc1ANC1/1IQiv 12YPfVLPrSrEXKFeGUYHU5S6NkPxcTmhLBc4oq+KvqLKhc1ggcNCKsQI8wJ18HLl1/HI m9yosxEuoG13vf5m0CRac75EjNPp6rMwnAkNBtMmBxhgnoK6RYsXKwQ3xxBRILXL2Ej9 FmxKdUTViTU/0yf3yR53136HzyyI+7+6AEJgtL3gRAYJs9wdgaXXTL13ei8dw96pT6pP hUig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719943107; x=1720547907; 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=kg8+wh+GyM079h6A9LD6SNRYl5PVcgITK3wsoj4NS3U=; b=k4kQ6mGja9BybBJC393mXbpK4+j/KZj+Fwvm/eGSNMeKKhQaPvtY28i0x0s0Fz1Ocp pFgSTsQUyAEEqCi9AEW0Sh2O0VLMgv1xBImUte1yBWMEsegPi3a4CjX8TZ4/jmLEacME g0Cis2oTM3hW8kjN1Z61QSvYTEwR4HBubQKH0U+3U0v4X3hMfgZd68HTDVdgqaQ3fYOo p5AAHLCgvUIdkWdYmiw7l9cqU66KdUAg/OaHR1BYqHsloY2t7ukgx3eJnkd5wV8+i4Hb UIa66UspKQgK3eELQQFt+vE7kAqECVz0Zuqd5nwp0THBHoVGzWWm7M4foWo2L5BNn4NK zAqA== X-Forwarded-Encrypted: i=1; AJvYcCXc73EIa1HuEjCRjEHrpZPS7/XFJTkSj7TbiKiUeKHm88KRsRl9/vllqVDupiM9aQkSVfTFL4ZIVlykDaIUIGELiO9gc517qDI/IXPlUw2FHA== X-Gm-Message-State: AOJu0Yx7s4sz6PDMgEIC59JhPQjdmY5sHzTMTX8UTAudZ/m4scYoCFQs pdI9uy6sbZB7T+295pARAj5rnTqaJyeXqnhb2sCueL0HaUlZ7LYHAHvyRPqhuXpieaAookTiT0f TALXay38ysPvM6fE1fK1vJuNHoi/zV1MzQ0fvHXiqIhYIpmpWJDgyBQ== X-Google-Smtp-Source: AGHT+IEgjbtLqnmEHP6ytABTJYal8Rubu+jruhJIRssyR4M0YDVpfK37pQiVeMMppRizhOstvmm3JtGVA/O9VNcj7aU= X-Received: by 2002:a05:6a20:2d11:b0:1be:d032:efff with SMTP id adf61e73a8af0-1bef62283cbmr9574139637.57.1719943107191; Tue, 02 Jul 2024 10:58:27 -0700 (PDT) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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 11:58:16 -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="000000000000f04164061c477510" X-Spamd-Bar: -- X-Spamd-Result: default: False [-3.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20230601.gappssmtp.com:s=20230601]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_ONE(0.00)[1]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; MISSING_XM_UA(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::435:from]; DMARC_NA(0.00)[bsdimp.com]; MLMMJ_DEST(0.00)[dev-commits-src-main@freebsd.org]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; R_SPF_NA(0.00)[no SPF record]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-main@freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_TLS_LAST(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20230601.gappssmtp.com:+] X-Rspamd-Queue-Id: 4WD9d10Bw2z4SXK --000000000000f04164061c477510 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Jul 2, 2024 at 10:30=E2=80=AFAM Warner Losh wrote: > Hey John, > > On Tue, Jul 2, 2024 at 9:44=E2=80=AFAM John Baldwin wro= te: > >> On 7/1/24 4:09 PM, Warner Losh wrote: >> > On Mon, Jul 1, 2024, 3:53=E2=80=AFPM John Baldwin wr= ote: >> > >> >> 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=3D67d1a1cd9e772e2ef94003579f4fbc= 271d38be7d >> >>> >> >>> 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 als= o >> >> 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 i= s >> >>> * 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 >> extensions. >> >> */ >> >>> -#if defined(__FreeBSD_cc_version) && __FreeBSD_cc_version >=3D 3000= 01 >> && \ >> >>> - 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-gc= cX >> >> 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. >> >> 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, s= o > 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? > https://reviews.freebsd.org/D45836 Warner --000000000000f04164061c477510 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Tue, Jul 2, 2024 at 10:30=E2=80=AF= AM Warner Losh <imp@bsdimp.com>= wrote:
Hey John,

On Tue, Jul 2, 2024 at 9:44=E2=80=AF= AM John Baldwin <jh= b@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=
--000000000000f04164061c477510--