cocci.inria.fr archive mirror
 help / color / mirror / 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, other threads:[~2020-02-07  6:55 UTC | newest]

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).