Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Nov 2023 11:13:27 -0700
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: 17a238a15fbe - main - cdefs: Remove __func__ define
Message-ID:  <CANCZdfrt7nJROjjD0RfNKTwY4=g=tiTBdLu=2UkFN%2BhznrCENA@mail.gmail.com>
In-Reply-To: <136388c6-424f-427f-8584-fededcf1cede@FreeBSD.org>
References:  <202311270525.3AR5PK1V067372@gitrepo.freebsd.org> <136388c6-424f-427f-8584-fededcf1cede@FreeBSD.org>

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

On Mon, Nov 27, 2023 at 10:50=E2=80=AFAM John Baldwin <jhb@freebsd.org> wro=
te:

> On 11/26/23 9:25 PM, Warner Losh wrote:
> > The branch main has been updated by imp:
> >
> > URL:
> https://cgit.FreeBSD.org/src/commit/?id=3D17a238a15fbed01477fbc54744d35cb=
ccdb65871
> >
> > commit 17a238a15fbed01477fbc54744d35cbccdb65871
> > Author:     Warner Losh <imp@FreeBSD.org>
> > AuthorDate: 2023-11-20 23:34:22 +0000
> > Commit:     Warner Losh <imp@FreeBSD.org>
> > CommitDate: 2023-11-27 05:24:02 +0000
> >
> >      cdefs: Remove __func__ define
> >
> >      We require an ANSI-C compiler to build the base system. It's
> required
> >      that __func__ work. Remove this define since the only known proble=
m
> >      compilers are ancient history (gcc 2.6 from 1994, almost pre-datin=
g
> the
> >      project). 3rd party code that used this define will now need to
> provide
> >      it via some other means when using non-ansi-c compilers.
> >
> >      PR: 275221 (exp-run)
> >      Sponsored by:           Netflix
> > ---
> >   sys/sys/cdefs.h                    | 40
> ++------------------------------------
> >   tests/sys/opencrypto/cryptodevh.py |  4 ----
> >   2 files changed, 2 insertions(+), 42 deletions(-)
> >
> > diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h
> > index c5b6190077b3..bcbf418f9323 100644
> > --- a/sys/sys/cdefs.h
> > +++ b/sys/sys/cdefs.h
> > @@ -96,14 +96,9 @@
> >   /*
> >    * The __CONCAT macro is used to concatenate parts of symbol names,
> e.g.
> >    * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfo=
o.
> > - * The __CONCAT macro is a bit tricky to use if it must work in non-AN=
SI
> > - * mode -- there must be no spaces between its arguments, and for nest=
ed
> > - * __CONCAT's, all the __CONCAT's must be at the left.  __CONCAT can
> also
> > - * concatenate double-quoted strings produced by the __STRING macro, b=
ut
> > - * this only works with ANSI C.
> >    *
> >    * __XSTRING is like __STRING, but it expands any macros in its
> argument
> > - * first.  It is only available with ANSI C.
> > + * first.
> >    */
> >   #if defined(__STDC__) || defined(__cplusplus)
> >   #define     __P(protos)     protos          /* full-blown ANSI C */
> > @@ -122,33 +117,7 @@
> >   #define     __inline                        /* delete GCC keyword */
> >   #endif /* ! __CC_SUPPORTS___INLINE */
> >   #endif /* !__cplusplus */
> > -
> > -#else        /* !(__STDC__ || __cplusplus) */
> > -#define      __P(protos)     ()              /* traditional C
> preprocessor */
> > -#define      __CONCAT(x,y)   x/**/y
> > -#define      __STRING(x)     "x"
> > -
> > -#if !defined(__CC_SUPPORTS___INLINE)
> > -#define      __const                         /* delete pseudo-ANSI C
> keywords */
> > -#define      __inline
> > -#define      __signed
> > -#define      __volatile
> > -/*
> > - * In non-ANSI C environments, new programs will want ANSI-only C
> keywords
> > - * deleted from the program and old programs will want them left alone=
.
> > - * When using a compiler other than gcc, programs using the ANSI C
> keywords
> > - * const, inline etc. as normal identifiers should define
> -DNO_ANSI_KEYWORDS.
> > - * When using "gcc -traditional", we assume that this is the intent; i=
f
> > - * __GNUC__ is defined but __STDC__ is not, we leave the new keywords
> alone.
> > - */
> > -#ifndef      NO_ANSI_KEYWORDS
> > -#define      const                           /* delete ANSI C keywords
> */
> > -#define      inline
> > -#define      signed
> > -#define      volatile
> > -#endif       /* !NO_ANSI_KEYWORDS */
> > -#endif       /* !__CC_SUPPORTS___INLINE */
> > -#endif       /* !(__STDC__ || __cplusplus) */
> > +#endif       /* __STDC__ || __cplusplus */
> >
> >   /*
> >    * Compiler-dependent macros to help declare dead (non-returning) and
> > @@ -343,11 +312,6 @@
> >   #define     __unreachable() ((void)0)
> >   #endif
> >
> > -/* XXX: should use `#if __STDC_VERSION__ < 199901'. */
> > -#if !__GNUC_PREREQ__(2, 7)
> > -#define      __func__        NULL
> > -#endif
> > -
> >   #if (defined(__GNUC__) && __GNUC__ >=3D 2) && !defined(__STRICT_ANSI_=
_)
> || __STDC_VERSION__ >=3D 199901
> >   #define     __LONG_LONG_SUPPORTED
> >   #endif
>
> This removed a lot more than just __func__?
>

Damn. It looks like future work got folded in here by accident...  This is
the 'remove support for
pure K&R compilers' stuff I've talked about elsewhere. I'll revert and fix.

Warner

--000000000000e2515f060b264230
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 Mon, Nov 27, 2023 at 10:50=E2=80=
=AFAM 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=
 11/26/23 9:25 PM, Warner Losh wrote:<br>
&gt; The branch main has been updated by imp:<br>
&gt; <br>
&gt; URL: <a href=3D"https://cgit.FreeBSD.org/src/commit/?id=3D17a238a15fbe=
d01477fbc54744d35cbccdb65871" rel=3D"noreferrer" target=3D"_blank">https://=
cgit.FreeBSD.org/src/commit/?id=3D17a238a15fbed01477fbc54744d35cbccdb65871<=
/a><br>
&gt; <br>
&gt; commit 17a238a15fbed01477fbc54744d35cbccdb65871<br>
&gt; Author:=C2=A0 =C2=A0 =C2=A0Warner Losh &lt;imp@FreeBSD.org&gt;<br>
&gt; AuthorDate: 2023-11-20 23:34:22 +0000<br>
&gt; Commit:=C2=A0 =C2=A0 =C2=A0Warner Losh &lt;imp@FreeBSD.org&gt;<br>
&gt; CommitDate: 2023-11-27 05:24:02 +0000<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0 cdefs: Remove __func__ define<br>
&gt;=C2=A0 =C2=A0 =C2=A0 <br>
&gt;=C2=A0 =C2=A0 =C2=A0 We require an ANSI-C compiler to build the base sy=
stem. It&#39;s required<br>
&gt;=C2=A0 =C2=A0 =C2=A0 that __func__ work. Remove this define since the o=
nly known problem<br>
&gt;=C2=A0 =C2=A0 =C2=A0 compilers are ancient history (gcc 2.6 from 1994, =
almost pre-dating the<br>
&gt;=C2=A0 =C2=A0 =C2=A0 project). 3rd party code that used this define wil=
l now need to provide<br>
&gt;=C2=A0 =C2=A0 =C2=A0 it via some other means when using non-ansi-c comp=
ilers.<br>
&gt;=C2=A0 =C2=A0 =C2=A0 <br>
&gt;=C2=A0 =C2=A0 =C2=A0 PR: 275221 (exp-run)<br>
&gt;=C2=A0 =C2=A0 =C2=A0 Sponsored by:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0Netflix<br>
&gt; ---<br>
&gt;=C2=A0 =C2=A0sys/sys/cdefs.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 | 40 ++------------------------------------<br>
&gt;=C2=A0 =C2=A0tests/sys/opencrypto/cryptodevh.py |=C2=A0 4 ----<br>
&gt;=C2=A0 =C2=A02 files changed, 2 insertions(+), 42 deletions(-)<br>
&gt; <br>
&gt; diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h<br>
&gt; index c5b6190077b3..bcbf418f9323 100644<br>
&gt; --- a/sys/sys/cdefs.h<br>
&gt; +++ b/sys/sys/cdefs.h<br>
&gt; @@ -96,14 +96,9 @@<br>
&gt;=C2=A0 =C2=A0/*<br>
&gt;=C2=A0 =C2=A0 * The __CONCAT macro is used to concatenate parts of symb=
ol names, e.g.<br>
&gt;=C2=A0 =C2=A0 * with &quot;#define OLD(foo) __CONCAT(old,foo)&quot;, OL=
D(foo) produces oldfoo.<br>
&gt; - * The __CONCAT macro is a bit tricky to use if it must work in non-A=
NSI<br>
&gt; - * mode -- there must be no spaces between its arguments, and for nes=
ted<br>
&gt; - * __CONCAT&#39;s, all the __CONCAT&#39;s must be at the left.=C2=A0 =
__CONCAT can also<br>
&gt; - * concatenate double-quoted strings produced by the __STRING macro, =
but<br>
&gt; - * this only works with ANSI C.<br>
&gt;=C2=A0 =C2=A0 *<br>
&gt;=C2=A0 =C2=A0 * __XSTRING is like __STRING, but it expands any macros i=
n its argument<br>
&gt; - * first.=C2=A0 It is only available with ANSI C.<br>
&gt; + * first.<br>
&gt;=C2=A0 =C2=A0 */<br>
&gt;=C2=A0 =C2=A0#if defined(__STDC__) || defined(__cplusplus)<br>
&gt;=C2=A0 =C2=A0#define=C2=A0 =C2=A0 =C2=A0__P(protos)=C2=A0 =C2=A0 =C2=A0=
protos=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* full-blown ANSI C */<br>
&gt; @@ -122,33 +117,7 @@<br>
&gt;=C2=A0 =C2=A0#define=C2=A0 =C2=A0 =C2=A0__inline=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* delete GC=
C keyword */<br>
&gt;=C2=A0 =C2=A0#endif /* ! __CC_SUPPORTS___INLINE */<br>
&gt;=C2=A0 =C2=A0#endif /* !__cplusplus */<br>
&gt; -<br>
&gt; -#else=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* !(__STDC__ || __cplusplus) */<br>
&gt; -#define=C2=A0 =C2=A0 =C2=A0 __P(protos)=C2=A0 =C2=A0 =C2=A0()=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* traditional C preprocessor */<=
br>
&gt; -#define=C2=A0 =C2=A0 =C2=A0 __CONCAT(x,y)=C2=A0 =C2=A0x/**/y<br>
&gt; -#define=C2=A0 =C2=A0 =C2=A0 __STRING(x)=C2=A0 =C2=A0 =C2=A0&quot;x&qu=
ot;<br>
&gt; -<br>
&gt; -#if !defined(__CC_SUPPORTS___INLINE)<br>
&gt; -#define=C2=A0 =C2=A0 =C2=A0 __const=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/* delete pseudo-AN=
SI C keywords */<br>
&gt; -#define=C2=A0 =C2=A0 =C2=A0 __inline<br>
&gt; -#define=C2=A0 =C2=A0 =C2=A0 __signed<br>
&gt; -#define=C2=A0 =C2=A0 =C2=A0 __volatile<br>
&gt; -/*<br>
&gt; - * In non-ANSI C environments, new programs will want ANSI-only C key=
words<br>
&gt; - * deleted from the program and old programs will want them left alon=
e.<br>
&gt; - * When using a compiler other than gcc, programs using the ANSI C ke=
ywords<br>
&gt; - * const, inline etc. as normal identifiers should define -DNO_ANSI_K=
EYWORDS.<br>
&gt; - * When using &quot;gcc -traditional&quot;, we assume that this is th=
e intent; if<br>
&gt; - * __GNUC__ is defined but __STDC__ is not, we leave the new keywords=
 alone.<br>
&gt; - */<br>
&gt; -#ifndef=C2=A0 =C2=A0 =C2=A0 NO_ANSI_KEYWORDS<br>
&gt; -#define=C2=A0 =C2=A0 =C2=A0 const=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/* delete ANS=
I C keywords */<br>
&gt; -#define=C2=A0 =C2=A0 =C2=A0 inline<br>
&gt; -#define=C2=A0 =C2=A0 =C2=A0 signed<br>
&gt; -#define=C2=A0 =C2=A0 =C2=A0 volatile<br>
&gt; -#endif=C2=A0 =C2=A0 =C2=A0 =C2=A0/* !NO_ANSI_KEYWORDS */<br>
&gt; -#endif=C2=A0 =C2=A0 =C2=A0 =C2=A0/* !__CC_SUPPORTS___INLINE */<br>
&gt; -#endif=C2=A0 =C2=A0 =C2=A0 =C2=A0/* !(__STDC__ || __cplusplus) */<br>
&gt; +#endif=C2=A0 =C2=A0 =C2=A0 =C2=A0/* __STDC__ || __cplusplus */<br>
&gt;=C2=A0 =C2=A0<br>
&gt;=C2=A0 =C2=A0/*<br>
&gt;=C2=A0 =C2=A0 * Compiler-dependent macros to help declare dead (non-ret=
urning) and<br>
&gt; @@ -343,11 +312,6 @@<br>
&gt;=C2=A0 =C2=A0#define=C2=A0 =C2=A0 =C2=A0__unreachable() ((void)0)<br>
&gt;=C2=A0 =C2=A0#endif<br>
&gt;=C2=A0 =C2=A0<br>
&gt; -/* XXX: should use `#if __STDC_VERSION__ &lt; 199901&#39;. */<br>
&gt; -#if !__GNUC_PREREQ__(2, 7)<br>
&gt; -#define=C2=A0 =C2=A0 =C2=A0 __func__=C2=A0 =C2=A0 =C2=A0 =C2=A0 NULL<=
br>
&gt; -#endif<br>
&gt; -<br>
&gt;=C2=A0 =C2=A0#if (defined(__GNUC__) &amp;&amp; __GNUC__ &gt;=3D 2) &amp=
;&amp; !defined(__STRICT_ANSI__) || __STDC_VERSION__ &gt;=3D 199901<br>
&gt;=C2=A0 =C2=A0#define=C2=A0 =C2=A0 =C2=A0__LONG_LONG_SUPPORTED<br>
&gt;=C2=A0 =C2=A0#endif<br>
<br>
This removed a lot more than just __func__?<br></blockquote><div><br></div>=
<div>Damn. It looks like future work got folded in here by accident...=C2=
=A0 This is the &#39;remove support for</div><div>pure K&amp;R compilers&#3=
9; stuff I&#39;ve talked about elsewhere. I&#39;ll revert and fix.</div><di=
v><br></div><div>Warner=C2=A0</div></div></div>

--000000000000e2515f060b264230--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfrt7nJROjjD0RfNKTwY4=g=tiTBdLu=2UkFN%2BhznrCENA>