qemu-trivial
[Top][All Lists]
Advanced

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

Re: [Qemu-trivial] [Qemu-devel] clang-tidy: use g_new() family of functi


From: Kevin Wolf
Subject: Re: [Qemu-trivial] [Qemu-devel] clang-tidy: use g_new() family of functions
Date: Wed, 6 Sep 2017 10:52:59 +0200
User-agent: Mutt/1.8.3 (2017-05-23)

Am 05.09.2017 um 17:33 hat Markus Armbruster geschrieben:
> Marc-André Lureau <address@hidden> writes:
> > code base). I find it easier to write a tidy check, and more friendly
> > command line / output etc:
> >
> > /tmp/test.c:3:17: warning: use g_new() instead [qemu-use-gnew]
> >         int *f = (int*)malloc(sizeof(int) * 2);
> >                  ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
> >                  g_new(int, 2)
> >
> > clang-tidy should also respect clang-format rules when modifying the code
> > (see also
> > https://lists.nongnu.org/archive/html/qemu-devel/2017-08/msg05762.html).
> >
> > I also imagine it should be possible to integrate to clang warnings in the
> > future (similar to libreoffice clang plugins for ex). All in all,
> > coccinelle or clang-tidy are probably both capable of doing this job, but
> > clang-tidy is snappier and has more potentials for toolchain integration.
> 
> Suggest you show us cool things you can do with clang-tidy that haven't
> been done with Coccinelle :)

Well, I don't really know clang-tidy, but if the above is what it does,
that _is_ cool. With Coccinelle scripts you run the script from time to
time and remove any new offenders. But if clang-tidy allows us to turn
any new offender into a build error so that they don't even make it into
master, then to me that's way superior.

Not all users are using clang, obviously, so even if we can
automatically enable this for clang, not everyone would see the
warnings. But if we can make some patchew hosts use it, that would
already be enough to catch those things.

Unless I'm misinterpreting what Marc-André is saying and running
clang-tidy actually requires more than is reasonable for patchew.

Kevin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]