Coccinelle archive on lore.kernel.org
 help / color / Atom feed
* [Cocci]  Q: does spatch understand g_autoptr/g_autofree?
@ 2020-02-07  6:26 Pan Nengyuan
  2020-02-07  6:48 ` Julia Lawall
  0 siblings, 1 reply; 3+ messages in thread
From: Pan Nengyuan @ 2020-02-07  6:26 UTC (permalink / raw)
  To: cocci; +Cc: kuhn.chenqun

Hello,

I have an example:

    @@ expression d,p; @@

    - g_autoptr(d) p;
    + g_autoptr(d) p = NULL;

C source code:

    void f(void)
    {
        g_autoptr(Test) *p1;
    }

Then I got this error:
minus: parse error:
  File "test.cocci", line 3, column 15, charpos = 38
  around = 'p',
  whole content = - g_autoptr(d) p;


is it correct?
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

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

* Re: [Cocci] Q: does spatch understand g_autoptr/g_autofree?
  2020-02-07  6:26 [Cocci] Q: does spatch understand g_autoptr/g_autofree? Pan Nengyuan
@ 2020-02-07  6:48 ` Julia Lawall
  2020-02-07  6:53   ` Pan Nengyuan
  0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2020-02-07  6:48 UTC (permalink / raw)
  To: Pan Nengyuan; +Cc: kuhn.chenqun, cocci



On Fri, 7 Feb 2020, Pan Nengyuan wrote:

> Hello,
>
> I have an example:
>
>     @@ expression d,p; @@
>
>     - g_autoptr(d) p;
>     + g_autoptr(d) p = NULL;
>
> C source code:
>
>     void f(void)
>     {
>         g_autoptr(Test) *p1;
>     }
>
> Then I got this error:
> minus: parse error:
>   File "test.cocci", line 3, column 15, charpos = 38
>   around = 'p',
>   whole content = - g_autoptr(d) p;
>
>
> is it correct?

No, Coccinelle knows nothing about these things.  If you don't care about
the types of these variables, you can extend standard.h to say

#define g_autoptr(x) int

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

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

* Re: [Cocci] Q: does spatch understand g_autoptr/g_autofree?
  2020-02-07  6:48 ` Julia Lawall
@ 2020-02-07  6:53   ` Pan Nengyuan
  0 siblings, 0 replies; 3+ messages in thread
From: Pan Nengyuan @ 2020-02-07  6:53 UTC (permalink / raw)
  To: Julia Lawall; +Cc: kuhn.chenqun, cocci



On 2/7/2020 2:48 PM, Julia Lawall wrote:
> 
> 
> On Fri, 7 Feb 2020, Pan Nengyuan wrote:
> 
>> Hello,
>>
>> I have an example:
>>
>>     @@ expression d,p; @@
>>
>>     - g_autoptr(d) p;
>>     + g_autoptr(d) p = NULL;
>>
>> C source code:
>>
>>     void f(void)
>>     {
>>         g_autoptr(Test) *p1;
>>     }
>>
>> Then I got this error:
>> minus: parse error:
>>   File "test.cocci", line 3, column 15, charpos = 38
>>   around = 'p',
>>   whole content = - g_autoptr(d) p;
>>
>>
>> is it correct?
> 
> No, Coccinelle knows nothing about these things.  If you don't care about
> the types of these variables, you can extend standard.h to say
> 
> #define g_autoptr(x) int

OK, thanks. I will try it.

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

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

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-07  6:26 [Cocci] Q: does spatch understand g_autoptr/g_autofree? Pan Nengyuan
2020-02-07  6:48 ` Julia Lawall
2020-02-07  6:53   ` Pan Nengyuan

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
	public-inbox-index cocci

Example config snippet for mirrors

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.git