All of lore.kernel.org
 help / color / mirror / Atom feed
* Weirdness in parsing cpp macros
@ 2024-03-20 12:37 Ville Syrjälä
  2024-03-20 13:24 ` Julia Lawall
  2024-03-21  9:31 ` ✗ Fi.CI.BUILD: failure for " Patchwork
  0 siblings, 2 replies; 10+ messages in thread
From: Ville Syrjälä @ 2024-03-20 12:37 UTC (permalink / raw)
  To: cocci; +Cc: Julia Lawall, Jani Nikula, intel-gfx

Hi Julia et al,

In Linux drm/i915 driver (drivers/gpu/drm/i915/display/intel_pps.[ch])
we have a magic macro like this:

#define with_intel_pps_lock(dp, wf) \
        for ((wf) = intel_pps_lock(dp); (wf); (wf) = intel_pps_unlock((dp), (wf)))


which we can then use like so:
...
with_intel_pps_lock(intel_dp, wakeref)
	wait_panel_power_cycle(intel_dp);
...


If I try to modify this code with eg.

@@
@@
- wait_panel_power_cycle
+ _wait_panel_power_cycle

spatch fails to parse the macro and won't do the changes here.


While experimenting with this I discovered that
I can make it work by:
- moving the macro definition into intel_pps.c file from intel_pps.h
- renaming the macro to contain the substring "for" (doesn't matter
  where in the macro name the "for" appears)

What on earth is going on here?

-- 
Ville Syrjälä
Intel

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-03-21  9:48 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-20 12:37 Weirdness in parsing cpp macros Ville Syrjälä
2024-03-20 13:24 ` Julia Lawall
2024-03-20 13:31   ` Ville Syrjälä
2024-03-20 13:42     ` Jani Nikula
2024-03-20 14:39       ` Julia Lawall
2024-03-20 15:52         ` Jani Nikula
2024-03-20 16:44           ` Julia Lawall
2024-03-21  8:21           ` Julia Lawall
2024-03-21  9:48             ` Jani Nikula
2024-03-21  9:31 ` ✗ Fi.CI.BUILD: failure for " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.