Re: git: 2ffdc21324bd - main - config: make changes to allow some parts to build as C++

From: Warner Losh <imp_at_bsdimp.com>
Date: Wed, 08 Feb 2023 15:24:33 UTC
On Wed, Feb 8, 2023, 8:09 AM Kyle Evans <kevans@freebsd.org> wrote:

> On Wed, Feb 8, 2023 at 7:12 AM Konstantin Belousov <kostikbel@gmail.com>
> wrote:
> >
> > On Wed, Feb 08, 2023 at 06:10:23AM +0000, Kyle Evans wrote:
> > > The branch main has been updated by kevans:
> > >
> > > URL:
> https://cgit.FreeBSD.org/src/commit/?id=2ffdc21324bd1772fa2f40efed3987afecabf5cb
> > >
> > > commit 2ffdc21324bd1772fa2f40efed3987afecabf5cb
> > > Author:     Kyle Evans <kevans@FreeBSD.org>
> > > AuthorDate: 2023-02-08 06:02:56 +0000
> > > Commit:     Kyle Evans <kevans@FreeBSD.org>
> > > CommitDate: 2023-02-08 06:09:10 +0000
> > >
> > >     config: make changes to allow some parts to build as C++
> > >
> > >     Highlights:
> > >     - Avoid keywords (this, not) as variable names
> > >     - Move yyparse into config.h with other declarations
> > >     - All declarations in config.h are assumed guilty until proven
> innocent
> > >     - Some const-correctness
> > >     - Casting malloc/calloc returns
> > >
> > >     Note that we're not building any C++ here yet, this will be
> introduced
> > >     in other commits to replace some of the lib dependencies.
> Reducing the
> > >     number of FreeBSD-specific dependencies we have reduces some
> friction
> > >     for building our bootstrap tools independently in other
> environments.
> > >
> > >     Reviewed by:    imp
> > >     Sponsored by:   Klara, Inc.
> > >     Sponsored by:   NetApp, Inc.
> > >     Differential Revision:  https://reviews.freebsd.org/D38274
> > > ---
> > >  usr.sbin/config/config.h     |  6 ++++++
> > >  usr.sbin/config/main.c       | 19 ++++++++++---------
> > >  usr.sbin/config/mkmakefile.c | 44
> ++++++++++++++++++++++----------------------
> > >  usr.sbin/config/mkoptions.c  | 28 ++++++++++++++--------------
> > >  4 files changed, 52 insertions(+), 45 deletions(-)
> > >
> > > diff --git a/usr.sbin/config/config.h b/usr.sbin/config/config.h
> > > index 79d0a788bae7..7d97d66979e2 100644
> > > --- a/usr.sbin/config/config.h
> > > +++ b/usr.sbin/config/config.h
> > > @@ -35,12 +35,15 @@
> > >  /*
> > >   * Config.
> > >   */
> > > +#include <sys/cdefs.h>       /* __BEGIN_DECLS/__END_DECLS */
> > But sys/types.h already includes sys/cdefs.h (as most of our headers).
> >
>
> Indeed, I couldn't recall if we can/should rely on the implicit
> inclusion or not and added it anyways. I'll fold removal into the last
> config(8) change along these lines[0], which I'll probably land
> tonight if I don't get any major complaints from the ones I've already
> landed.
>

Sounds good. I meant to give feedback on that then got the creeping crude
for a couple of days.  I was going to make the same suggestion since I
asked in the review .

Warner


> Thanks,
>
> Kyle Evans
>
> [0] https://reviews.freebsd.org/D38276
>