Coccinelle archive on lore.kernel.org
 help / Atom feed
* [Cocci] matching concatenated preprocessor tokens
@ 2019-01-23  3:22 Guenter Roeck
  2019-01-23  6:35 ` Julia Lawall
  0 siblings, 1 reply; 5+ messages in thread
From: Guenter Roeck @ 2019-01-23  3:22 UTC (permalink / raw)
  To: cocci

Hi,

I am trying to match a construct such as

#define func(a,b,c) \
     some_call(a##b, c, NULL)

to replace it with, for example,

#define func(a,b,c) \
    some_other_call(a##b, c)

Is this possible with coccinelle ?
I tried several variants, but I don't seem to be able to match "a##b".

Thanks,
Guenter
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

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

* Re: [Cocci] matching concatenated preprocessor tokens
  2019-01-23  3:22 [Cocci] matching concatenated preprocessor tokens Guenter Roeck
@ 2019-01-23  6:35 ` Julia Lawall
  2019-01-23 14:11   ` Guenter Roeck
  0 siblings, 1 reply; 5+ messages in thread
From: Julia Lawall @ 2019-01-23  6:35 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: cocci



On Tue, 22 Jan 2019, Guenter Roeck wrote:

> Hi,
>
> I am trying to match a construct such as
>
> #define func(a,b,c) \
>     some_call(a##b, c, NULL)
>
> to replace it with, for example,
>
> #define func(a,b,c) \
>    some_other_call(a##b, c)
>
> Is this possible with coccinelle ?
> I tried several variants, but I don't seem to be able to match "a##b".

I doubt that ## is supported in the matching language.  I will add it.

julia

>
> Thanks,
> Guenter
> _______________________________________________
> Cocci mailing list
> Cocci@systeme.lip6.fr
> https://systeme.lip6.fr/mailman/listinfo/cocci
>
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

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

* Re: [Cocci] matching concatenated preprocessor tokens
  2019-01-23  6:35 ` Julia Lawall
@ 2019-01-23 14:11   ` Guenter Roeck
  2019-01-23 14:41     ` Julia Lawall
  0 siblings, 1 reply; 5+ messages in thread
From: Guenter Roeck @ 2019-01-23 14:11 UTC (permalink / raw)
  To: Julia Lawall; +Cc: cocci

Hi Julia,

On 1/22/19 10:35 PM, Julia Lawall wrote:
> 
> 
> On Tue, 22 Jan 2019, Guenter Roeck wrote:
> 
>> Hi,
>>
>> I am trying to match a construct such as
>>
>> #define func(a,b,c) \
>>      some_call(a##b, c, NULL)
>>
>> to replace it with, for example,
>>
>> #define func(a,b,c) \
>>     some_other_call(a##b, c)
>>
>> Is this possible with coccinelle ?
>> I tried several variants, but I don't seem to be able to match "a##b".
> 
> I doubt that ## is supported in the matching language.  I will add it.
> 

All I was able to find about the subject was in the Coccinelle change log:

20.4 Internals:
"reorganize the way we parse C identifiers, especially concatenated cpp
  identifiers as in a##b. This may lead to some regressions as we may not
  parse as much code as before."

Thanks,
Guenter
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

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

* Re: [Cocci] matching concatenated preprocessor tokens
  2019-01-23 14:11   ` Guenter Roeck
@ 2019-01-23 14:41     ` Julia Lawall
  2019-01-23 17:49       ` Guenter Roeck
  0 siblings, 1 reply; 5+ messages in thread
From: Julia Lawall @ 2019-01-23 14:41 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: cocci



On Wed, 23 Jan 2019, Guenter Roeck wrote:

> Hi Julia,
>
> On 1/22/19 10:35 PM, Julia Lawall wrote:
> >
> >
> > On Tue, 22 Jan 2019, Guenter Roeck wrote:
> >
> > > Hi,
> > >
> > > I am trying to match a construct such as
> > >
> > > #define func(a,b,c) \
> > >      some_call(a##b, c, NULL)
> > >
> > > to replace it with, for example,
> > >
> > > #define func(a,b,c) \
> > >     some_other_call(a##b, c)
> > >
> > > Is this possible with coccinelle ?
> > > I tried several variants, but I don't seem to be able to match "a##b".
> >
> > I doubt that ## is supported in the matching language.  I will add it.
> >
>
> All I was able to find about the subject was in the Coccinelle change log:
>
> 20.4 Internals:
> "reorganize the way we parse C identifiers, especially concatenated cpp
>  identifiers as in a##b. This may lead to some regressions as we may not
>  parse as much code as before."

Yeah, it's supported on the C side, but not on the pattern matching side.
I'm working on that.

julia
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

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

* Re: [Cocci] matching concatenated preprocessor tokens
  2019-01-23 14:41     ` Julia Lawall
@ 2019-01-23 17:49       ` Guenter Roeck
  0 siblings, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2019-01-23 17:49 UTC (permalink / raw)
  To: Julia Lawall; +Cc: cocci

On Wed, Jan 23, 2019 at 03:41:24PM +0100, Julia Lawall wrote:
> 
> 
> On Wed, 23 Jan 2019, Guenter Roeck wrote:
> 
> > Hi Julia,
> >
> > On 1/22/19 10:35 PM, Julia Lawall wrote:
> > >
> > >
> > > On Tue, 22 Jan 2019, Guenter Roeck wrote:
> > >
> > > > Hi,
> > > >
> > > > I am trying to match a construct such as
> > > >
> > > > #define func(a,b,c) \
> > > >      some_call(a##b, c, NULL)
> > > >
> > > > to replace it with, for example,
> > > >
> > > > #define func(a,b,c) \
> > > >     some_other_call(a##b, c)
> > > >
> > > > Is this possible with coccinelle ?
> > > > I tried several variants, but I don't seem to be able to match "a##b".
> > >
> > > I doubt that ## is supported in the matching language.  I will add it.
> > >
> >
> > All I was able to find about the subject was in the Coccinelle change log:
> >
> > 20.4 Internals:
> > "reorganize the way we parse C identifiers, especially concatenated cpp
> >  identifiers as in a##b. This may lead to some regressions as we may not
> >  parse as much code as before."
> 
> Yeah, it's supported on the C side, but not on the pattern matching side.
> I'm working on that.
> 
Thanks!

Guenter
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

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

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-23  3:22 [Cocci] matching concatenated preprocessor tokens Guenter Roeck
2019-01-23  6:35 ` Julia Lawall
2019-01-23 14:11   ` Guenter Roeck
2019-01-23 14:41     ` Julia Lawall
2019-01-23 17:49       ` Guenter Roeck

Coccinelle archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/cocci/0 cocci/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 cocci cocci/ https://lore.kernel.org/cocci \
		cocci@systeme.lip6.fr cocci@archiver.kernel.org
	public-inbox-index cocci


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/fr.lip6.systeme.cocci


AGPL code for this site: git clone https://public-inbox.org/ public-inbox