how to fix MACRO_ARG_REUSE

[email protected]
Newsgroups org.kernelnewbies.kernelnewbies
Message-ID <CAJfuBxwOHo756697Nk0psHdB1TiSRmcY2gFcb7BzZeK1hhCo2w@mail.gmail.com>
on a recent submit to LKML
https://lore.kernel.org/lkml/[email protected]/

I got a Patchwork CI warning in report:
https://patchwork.freedesktop.org/series/113363/


1a864a4fe7ce dyndbg-API: fix CONFIG_DRM_USE_DYNAMIC_DEBUG regression

-:445: CHECK:MACRO_ARG_REUSE: Macro argument reuse '_var' - possible
side-effects?
#445: FILE: include/linux/dynamic_debug.h:120:
+#define DYNDBG_CLASSMAP_USE_(_var, _uname) \
+    extern struct ddebug_class_map _var; \
+    struct ddebug_class_user __used \
+        __section("__dyndbg_class_users") _uname = { \
+              .user_mod_name = KBUILD_MODNAME, \
+              .map = &_var, \
  }

_var is expanded 2x, the "extra" time is to declare it as "extern",
meaning its exported elsewhere.

the usual fix for macro problems like this is __typeof();
something like:
#define foo(a,b,...) \
  typeof(a) _a = a; \
  ...

but I dont see how to use it -
I need _var to name the struct exported from another module,
and I need to take its &-address.

Is there a trick / technique I can use ?

_______________________________________________
Kernelnewbies mailing list
[email protected]
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.