Weirdness in parsing cpp macros
Julia Lawall
julia.lawall at inria.fr
Wed Mar 20 14:39:23 UTC 2024
On Wed, 20 Mar 2024, Jani Nikula wrote:
> On Wed, 20 Mar 2024, Ville Syrjälä <ville.syrjala at linux.intel.com> wrote:
> > 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.
>
> Okay, I have another one wrt macros. :)
>
> I'm trying to add a completely new variadic macro, but it fails at
> "...". I've tried all sorts of things, but can't seem to be able to add
> a literal "...".
>
> I've tested that my cocci patch works with x's:
>
> + #define fn(p, xxx) foo(__VA_ARGS__)
>
> but when I try to make it actually variadic like:
>
> + #define fn(p, ...) foo(__VA_ARGS__)
>
> it gives me error. Is there a way to escape? Even tried to use a fresh
> identifier vararg = "..."; but cocci made them unique with numbering
> "...0" and "...1" etc.
Put 6 dots. It's silly, but ... is a Coccinelle thing, so we had to use
something else.
julia
More information about the Intel-gfx
mailing list