It is always frustrating to see a compiler complain about something trivial. It is especially annoying since most of the trivial complaints are trivial to fix automatically (eg. superfluous semicolon).
I think this is a bigger problem in the static analysis industry. Vendors/researchers ship their tools with a superiority complex built-in. Most of the error messages produced by error checking tools can be paraphrased as “Gee look, I found some trivial to fix bugs in your code, but I ain’t gonna do nothing about them! Neeener! Go worker-human!”
My policy is to make my tools more polite than that. Starting from prcheck, all of my tools will point out simple errors by suggesting patches (when possible). It is impossible to produce a correct patch every time, but I am not worried about that since developers are quite good at disregarding stupid suggestions.
Now I have a few extra scripts that lay the foundation for regular code inspection via static analysis. PRBool checks are my first step. Here is a sample email:
Subject: Prbool violation in nsPlainTextSerializer.cpp
email@example.com introduced a new PRBool problem in revision 1.1 of nsPlainTextSerializer.cpp.
Commit message: branches: 1.1.2; Error: /content/base/src/nsPlainTextSerializer.cpp: 614:
- PRInt32 semiOffset = style.Find("ch", widthOffset+6); + PRInt32 semiOffset = style.Find("ch", 0 != (widthOffset+6));
This an example of an incorrect suggestion. The actual problem is due to the incorrect method overload being chosen.