Makes sense to me.

Reviewed-by: Alessandro Di Federico <a...@rev.ng>

On Tue,  3 Jan 2023 10:47:58 +0000
Alex Bennée <alex.ben...@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

Reply via email to