From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Julia Lawall <julia.lawall@inria.fr>
Cc: cocci@systeme.lip6.fr, Jani Nikula <jani.nikula@linux.intel.com>,
intel-gfx@lists.freedesktop.org
Subject: Re: Weirdness in parsing cpp macros
Date: Wed, 20 Mar 2024 15:31:27 +0200 [thread overview]
Message-ID: <ZfrlLw3W00-cnH1U@intel.com> (raw)
In-Reply-To: <c22ade0-6b91-3386-a32d-19bcb8cc3d7@inria.fr>
On Wed, Mar 20, 2024 at 02:24:08PM +0100, Julia Lawall wrote:
>
>
> On Wed, 20 Mar 2024, Ville Syrjälä wrote:
>
> > 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) \
>
> Did you try declaring:
>
> iterator name with_intel_pps_lock;
>
> up with the metavariables?
Nope, didn't know about that one.
Seems to work fine with that. Thanks.
>
> julia
>
>
> > 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
> >
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2024-03-20 13:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
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ä [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZfrlLw3W00-cnH1U@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=cocci@systeme.lip6.fr \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=julia.lawall@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox