Weirdness in parsing cpp macros

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

 



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



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux