Static Analysis and Refactoring Tooling Updates
July 9th, 2008
Hydras
I am close to landing a flow check. Turns out, it is super-easy to introduce new analyses into Mozilla due to a very nice build system hooks setup by bsmedberg.
Since coming back from the GCC summit I have forward-ported our GCC patches to GCC trunk. The FSF legal paperwork came through today so I posted the first and biggest patch to the GCC for review.
I am not sure if I mentioned this before, but the C port of Dehydra is somewhat operational. It doesn’t yet have access to function bodies, but type traversal should work. Unfortunately, the C frontend has less features(pretty printing sucks, locations are even less reliable, etc) and thus is less awesome to work with than the C++ frontend.
jst was awesome enough to list some interfaces that need some outparamdelling. The list is here (in the content/ section). This lead me to spent some time making outparamdel’s output prettier. There are still some improvements to be made, and I will be making them in the near future. However if someone is interested in refactoring of this kind land in the near future, they could easily complete outparamdel’s work with some clever scripting and a bit of manual labour. Sure beats doing the entire thing manually. From outparamdel’s perspective last 10% appear to be slightly painful and might take some time.
Here is a patch that takes about 30seconds to produce.
Another exciting aspect of this is that a certain emacs wizard has confirmed that it would be possible to feed emacs such a patch file and have it correct indentation for the affected areas only.
I am also very excited that a certain volunteer came forward and decided to start improving some of the stomach-turning areas of Pork. Hopefully in the near future we’ll modernize the C++ a little bit and a user’s first reaction wont be: “What the hell, why can’t I do ‘using namespace std;’”.
To this end I have filed a bug to write a renamer tool so we can dogfood renaming of unfortunately named pieces of code.
OSCON
The plan is to have some sort of a minisession on our static analysis efforts at Mozilla. So if you are attending OSCON and are interested in doing exciting things to depressingly large amounts of code, drop me a line.
July 10th, 2008 at 7:17 am
Looking at the patch, I have a few questions:
1) How easy would it be to nix the (nsINodeInfo*) casts? They don’t seem to be needed…
2) Can we convert the NS_ENSURE_ARG into an NS_ASSERTION instead of just removing it?
3) Why NS_ERROR_NO_INTERFACE?
July 10th, 2008 at 7:20 am
1) known bug
2) new bug, typically NS_ENSURE_ARG is used for outparams. thanks
3) it’s just a default error setting ever since I did the queryinterface rewrite. It’s not meant to be used in the final patch.