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))        \
  {                                                                       \
+    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~

Reply via email to