From: Alessandro Di Federico via <qemu-devel@nongnu.org>
To: "Alex Bennée" <alex.bennee@linaro.org>
Cc: qemu-devel@nongnu.org,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Daniel P. Berrangé" <berrange@redhat.com>
Subject: Re: [RFC PATCH] docs: add some details about compilation units to coding style
Date: Tue, 3 Jan 2023 16:35:42 +0100 [thread overview]
Message-ID: <20230103163542.3c3e57e4@orange> (raw)
In-Reply-To: <20230103104758.767266-1-alex.bennee@linaro.org>
Makes sense to me.
Reviewed-by: Alessandro Di Federico <ale@rev.ng>
On Tue, 3 Jan 2023 10:47:58 +0000
Alex Bennée <alex.bennee@linaro.org> wrote:
> +"Templates" and generated code
> +==============================
> +
> +We make heavy use of C's macro facilities combined with multiple
> +inclusion to generate code. This tends to use header files (usually
> +with the .inc suffix) with different #define'd constants. While the
> +use of C11's _Generic keyword has improved things a bit this
> technique +is still best suited to repetitive boiler plate code. If
> more complex +code generation is required consider using a script to
> generate it, +see for example the decodetree and qapi header scripts.
Consider adding reference to an example to make the situation more
explicit and less scary.
Here's an example that hopefully won't become outdated within yesterday:
$ git grep -B10 '#include.*\.inc'
fpu/softfloat.c-#define N 64
fpu/softfloat.c-#define W 128
fpu/softfloat.c-
fpu/softfloat.c:#include "softfloat-parts-addsub.c.inc"
fpu/softfloat.c:#include "softfloat-parts.c.inc"
fpu/softfloat.c-
fpu/softfloat.c-#undef N
fpu/softfloat.c-#undef W
fpu/softfloat.c-#define N 128
fpu/softfloat.c-#define W 256
fpu/softfloat.c-
fpu/softfloat.c:#include "softfloat-parts-addsub.c.inc"
fpu/softfloat.c:#include "softfloat-parts.c.inc"
--
Alessandro Di Federico
rev.ng Labs
prev parent reply other threads:[~2023-01-03 15:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-03 10:47 [RFC PATCH] docs: add some details about compilation units to coding style Alex Bennée
2023-01-03 15:35 ` Alessandro Di Federico via [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=20230103163542.3c3e57e4@orange \
--to=qemu-devel@nongnu.org \
--cc=ale@rev.ng \
--cc=alex.bennee@linaro.org \
--cc=berrange@redhat.com \
--cc=philmd@linaro.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).