Paolo Bonzini wrote:
For example, gdb has function that in the past could return null, but
which now cannot. So, I'd like to find all places where the return
result is checked.
Or, gdb has a TRY_CATCH macro which expands to a couple of nested loops.
It is not ok to 'return' or 'goto' from inside the inner loop, as this
causes hard-to-find bugs. So, it would be nice to find any place that
tries this.
Or, there is a data type in gdb that used to be freed using 'xfree', but
which now requires a special function to be called instead. So, it
would be nice to find any place where xfree is passed an argument of
this type.
MELT looks extremely cool! You may want to use this too, however:
http://lwn.net/Articles/315686/
This is about Coccinelle so http://coccinelle.lip6.fr/ is a better link.
Indeed, Tom Tromey might also try Coccinelle. However, MELT is a
different beast: above all, it is tightly integrated inside GCC, and is
designed & useful to write (or at least prototype) GCC passes (mostly in
the middle end); while Coccinnelle is a tool unrelated to GCC (except
for the input language, i.e. C).
Since MELT works on GCC internal representations, it should be able to
deal with all the source languages GCC is able to compile.
So I would say that MELT is complementary to Coccinelle.
BTW, people interested in static analysis for C (not C++ or Ada) might
look at FramaC http://frama-c.cea.fr/ which is unrelated to GCC (except
for its use of the preprocessor).
I believe MELT could be best viewed as a tool for GCC plugins, either
"analysis" plugins -which don't change the code and don't influence the
GCC generated object code, or "transformation" or "optimisation"
plugins, which do change the GCC code generation.
For people able to review patches, my most desirable patch is
http://gcc.gnu.org/ml/gcc-patches/2009-07/msg00507.html (a patch for
gengtype). Currently, MELT can be compiled as a plugin to an unmodified
GCC-trunk (ie 4.5) binary, but to compile MELT you need this patch
(which improves the C code generated by gengtype in plugin mode).
Regards.
PS. In a few days, I'm leaving on vacation for almost 3 weeks without
email access.
--
Basile STARYNKEVITCH http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***