[Cocci] question on parsing g_assert_cmpint() macro

Julia Lawall julia.lawall at lip6.fr
Wed Apr 5 16:18:17 CEST 2017



On Wed, 5 Apr 2017, Eric Blake wrote:

> On 04/05/2017 12:25 AM, Julia Lawall wrote:
>
> >> What is the trick for teaching coccinelle about what g_assert_cmpint()
> >> expands to, and/or completely ignoring the use of that macro, so that I
> >> don't have to manually look for spots that the cleanup missed?
> >
> > Try adding
> >
> > #define g_assert_cmpint(x,y,z)
> >
> > to the macro definition file standard.h.  Or you can make your own macro
> > definition file for qemu and give it as an argument --macro-file file.h
> >
> > Write back if that does not solve the problem.
>
> Thanks. I didn't realize qemu already had a scripts/cocci-macro-file.h
> designed just for this purpose, and it includes
>
> #define g_assert_cmpint(a, op, b)   g_assert(a op b)

This definition looks fine too.

julia

>
> which indeed solves the problem.
>
> --
> Eric Blake   eblake redhat com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>
>


More information about the Cocci mailing list