Page MenuHomeFreeBSD

config: make changes to allow some parts to build as C++
ClosedPublic

Authored by kevans on Jan 30 2023, 3:54 PM.
Tags
None
Referenced Files
F103695675: D38274.id116044.diff
Thu, Nov 28, 3:40 AM
F103695672: D38274.id.diff
Thu, Nov 28, 3:40 AM
F103695651: D38274.id116757.diff
Thu, Nov 28, 3:39 AM
F103694278: D38274.diff
Thu, Nov 28, 3:10 AM
Unknown Object (File)
Fri, Nov 15, 11:37 AM
Unknown Object (File)
Fri, Nov 15, 10:31 AM
Unknown Object (File)
Fri, Nov 15, 8:51 AM
Unknown Object (File)
Sep 27 2024, 2:23 AM
Subscribers

Details

Summary

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.

Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kevans created this revision.

This looks good and is quite mechanical.
My only question is implicit reliance on sys/cdefs.h being included... but that's going to give a compile error if that becomes not the case in the future.

usr.sbin/config/config.h
45

Do we know for sure sys/cdefs.h has been included?

usr.sbin/config/main.c
701

It's unfortunate we have to do this :(

This revision is now accepted and ready to land.Jan 30 2023, 4:41 PM
usr.sbin/config/config.h
45

We do in the sense that sys/types.h unconditionally includes it, but I' can go ahead and make it explicit