how to fix MACRO_ARG_REUSE
jim.cromie at gmail.com
jim.cromie at gmail.com
Wed Aug 23 19:45:34 EDT 2023
on a recent submit to LKML
https://lore.kernel.org/lkml/20230801170255.163237-1-jim.cromie@gmail.com/
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 ?
More information about the Kernelnewbies
mailing list