All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
	qemu-devel@nongnu.org, "David Hildenbrand" <david@redhat.com>,
	"Bastian Koppelmann" <kbastian@mail.uni-paderborn.de>,
	"Thomas Huth" <thuth@redhat.com>,
	qemu-s390x@nongnu.org,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Laurent Vivier" <laurent@vivier.eu>,
	"Cornelia Huck" <cohuck@redhat.com>,
	qemu-trivial@nongnu.org
Subject: Re: [PATCH 0/3] target: Rename headers using .def extension to .h.inc
Date: Fri, 28 Oct 2022 06:37:13 +0200	[thread overview]
Message-ID: <87pmecimx2.fsf@pond.sub.org> (raw)
In-Reply-To: <CAFEAcA_-udYfzGNzfARvK1G2ZVKCP+_spEUKa3THroRQ+9SMMQ@mail.gmail.com> (Peter Maydell's message of "Thu, 27 Oct 2022 18:24:16 +0100")

Peter Maydell <peter.maydell@linaro.org> writes:

> 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.

Handle that just like for plain .h: when you re-run the script, you fix
its complaints either by fixing the header or by adding it to the
exclude pattern.

>> 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...

True.  But its opaque both for tools (editors mostly) and humans.  Tools
need to be configured, and humans need to be taught.

Moreover, we don't have *a* stylized convention, we have *two*: funny
filenames (several patterns, but that's fixable), and exclude patterns.

> Comments inside the .inc file are also helpful, of course.

Let's add a third!  Stylized comments!

I'll shut up now :)



      reply	other threads:[~2022-10-28  4:37 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-25 23:50 [PATCH 0/3] target: Rename headers using .def extension to .h.inc Philippe Mathieu-Daudé
2022-10-25 23:50 ` [PATCH 1/3] target/m68k: Rename qregs.def -> qregs.h.inc Philippe Mathieu-Daudé
2022-10-26  9:54   ` Laurent Vivier
2022-11-02 18:29   ` Laurent Vivier
2022-10-25 23:50 ` [PATCH 2/3] target/s390x: Rename insn-data/format.def -> insn-data/format.h.inc Philippe Mathieu-Daudé
2022-10-27  6:45   ` Thomas Huth
2022-11-02 18:30   ` Laurent Vivier
2022-10-25 23:50 ` [PATCH 3/3] target/tricore: Rename csfr.def -> csfr.h.inc Philippe Mathieu-Daudé
2022-10-26  8:21   ` Bastian Koppelmann
2022-11-02 18:30   ` Laurent Vivier
2022-10-26  9:45 ` [PATCH 0/3] target: Rename headers using .def extension to .h.inc Alex Bennée
     [not found] ` <8d197b71-937a-5693-3b7f-ea4bded8c360@redhat.com>
2022-10-27 14:12   ` Philippe Mathieu-Daudé
2022-10-27 15:25     ` Thomas Huth
2022-10-27 14:39 ` Markus Armbruster
2022-10-27 15:01   ` Peter Maydell
2022-10-27 17:17     ` Markus Armbruster
2022-10-27 17:24       ` Peter Maydell
2022-10-28  4:37         ` Markus Armbruster [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pmecimx2.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=kbastian@mail.uni-paderborn.de \
    --cc=laurent@vivier.eu \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.