On Fri, Sep 18, 2026 at 8:58 AM Richard Henderson <
[email protected]> wrote:
>
> On 9/17/26 14:42, Yonggang Luo wrote:
> > Declare helper_info inside each gen_helper_* body so a comment on
> > DEF_HELPER attaches to gen_helper_*, not helper_info_*. The extern
> > still refers to the global from helper-info.c.inc. Silence
> > -Wnested-externs around the HELPER_H expansion only.
> >
> > Signed-off-by: Yonggang Luo <[email protected]>
> > ---
> > include/exec/helper-gen.h.inc | 24 ++++++++++++++++--------
> > 1 file changed, 16 insertions(+), 8 deletions(-)
>
> Huh? Why does comment placement matter?
>
>
> > #define DEF_HELPER_FLAGS_0(name, flags, ret)
\
> > -extern TCGHelperInfo glue(helper_info_, name);
\
> > static inline void glue(gen_helper_, name)(dh_retvar_decl0(ret))
\
Please look here, this is the implementation in the header already, so we
have no .c file to
comment on it. comments on &glue(helper_info_,name) do not help, because
we are always calling
to gen_helper_$name. The clangd and other auto-tools can not infer comments
from &glue(helper_info_,name).
If we move extern TCGHelperInfo glue(helper_info_, name); into inline
function content, then the comment on
DEF_HELPER_*() macros will take effect.
The static inline void is the source of the issue. I have no other way to
deal with it.
> > {
\
> > + extern TCGHelperInfo glue(helper_info_, name);
\
> > tcg_gen_call0(glue(helper_info_,name).func,
\
> > &glue(helper_info_,name), dh_retvar(ret));
\
> > }
> ...> +/*
> > + * helper_info_* is declared inside gen_helper_* so a comment on
> > + * DEF_HELPER attaches to gen_helper_*, not helper_info_*. That is a
> > + * nested extern; silence -Wnested-externs for this expansion only.
> > + */
> > +#pragma GCC diagnostic push
> > +#pragma GCC diagnostic ignored "-Wnested-externs"
> > #include HELPER_H
> > +#pragma GCC diagnostic pop
> >
> > #undef DEF_HELPER_FLAGS_0
> > #undef DEF_HELPER_FLAGS_1
>
> That you have to have to have this workaround makes me less than
receptive.
>
>
> r~
--
此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo