[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 0/3] target: Rename headers using .def extension to .h.inc

From: Peter Maydell
Subject: Re: [PATCH 0/3] target: Rename headers using .def extension to .h.inc
Date: Thu, 27 Oct 2022 18:24:16 +0100

On Thu, 27 Oct 2022 at 18:17, Markus Armbruster <armbru@redhat.com> wrote:
> Peter Maydell <peter.maydell@linaro.org> writes:
> > On Thu, 27 Oct 2022 at 15:40, Markus Armbruster <armbru@redhat.com> wrote:
> >> I wonder why we use any of .def, .h.inc, .inc.h, .c.inc, .inc.c.  Why
> >> not .h and call it a day?  No need to configure each and every editor to
> >> tread these as C code.
> >
> > It says "this isn't actually a header in the usual sense". That's
> > useful for automated scripted checks (eg we don't want
> > scripts/clean-header-guards.pl to add the standard #include header
> > guards to this sort of file) and for humans (if you see one of these
> > files included as part of the normal #include block at the top of
> > a .c file that's probably a mistake; if you see it being used then
> > you know there's likely multiple-inclusion shenanigans going on.)
> scripts/clean-header-guards.pl needs exclude patterns anyway.

Yes, in theory instead of having a systematic convention for
filenames we could instead give the files names that don't
let you easily distinguish them from plain old header files and
require every use like this to update clean-header-guards.pl,
but that seems to me to be clearly worse than maintaining the
filename convention that we already have.

> Comments would likely work better for humans than obscure naming
> conventions.
> Make them stylized, and they work for scripts, too.

We already have a stylized convention, it's the filename...
Comments inside the .inc file are also helpful, of course.

-- PMM

reply via email to

[Prev in Thread] Current Thread [Next in Thread]