Re: Weirdness in parsing cpp macros

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

 




On Wed, 20 Mar 2024, Jani Nikula wrote:

> On Wed, 20 Mar 2024, Julia Lawall <julia.lawall@xxxxxxxx> wrote:
> > On Wed, 20 Mar 2024, Jani Nikula wrote:
> >> 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.
>
> I've tried, but it doesn't seem to work in the + side:
>
> plus: parse error:
>   File "/tmp/tmp.clvvc812Qe", line 20, column 2, charpos = 254
>   around = '#define fn(',
>   whole content = + #define fn(p, ......) __fn(__to_intel_display(p), __VA_ARGS__)

OK, maybe it doesn't work for macros.  I will take a look.

julia



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

  Powered by Linux