On 12/02/2011 07:49 PM, David Malcolm wrote:
I've taken the liberty of adding this to the plugin's
"Success Stories"
page here:
http://gcc-python-plugin.readthedocs.org/en/latest/success.html
Hope that's OK
Sure. Great.
I had a look at LibreOffice's bugzilla, and it struck me that
this might
be something that the plugin could help with: find global variables with
non-trivial constructors:
https://bugs.freedesktop.org/show_bug.cgi?id=38835
You can already see these by examining the built binaries by section,
but it's probably _much_ easier to find and remove them by doing this in
the compiler, so that you get source line information during the
compile. Anyone interested in writing a script to detect these? It may
need a little work to expose more of GCC's C++ internals to the Python
interface.
Sounds like a good one too, yes. Another one I had in mind was to find
unnamed parameters in definitions of non-virtual functions. When we
cleaned up OOo for -Werror back in the day, lots of places where a
function parameter was unused were lazily cleaned up by just removing
the parameter's name to silence the warning, instead of cleaning up the
function declaration and adapting the call sites (which could have a
rippling effect on the code base, identifying further dead code that
could be removed). This generally could not be done for virtual
functions, of course, and it is often difficult to find out whether a
given function declaration is virtual (LO having deep class hierarchies,
and inherited virtual functions not consistently being marked
"virtual"). This would require that the information whether a function
is virtual were exposed by the plugin. (Functions accessed via pointers
would be problematic to change, too, but they are typically much more
obvious in the LO code base, plus the compiler would catch any mistakes
there.)
Maybe it's worth putting together an "ideas" page for
things that people
might want to try using the plugin for?
Do people have other ideas for scripts? (and do I need to do anything to
help e.g. to expose more of GCC's insides to the Python interface?).
What is it that you've always wanted the compiler to do for you? [1]
I had planned to toy around with this further in the future, probably
also taking the next step of looking how to add missing things myself.
But I have no concrete ideas for more checks right now. Anyway, I'll
keep you updated.
Dave
[1] and no,
http://xkcd.com/149/ doesn't count :)
Too bad. :(
Stephan