how to fix MACRO_ARG_REUSE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



on a recent submit to LKML
https://lore.kernel.org/lkml/20230801170255.163237-1-jim.cromie@xxxxxxxxx/

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
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux