[cfe-commits] [PATCH] strnlen checker

Ted Kremenek kremenek at apple.com
Wed Mar 30 14:23:46 PDT 2011


On Mar 29, 2011, at 12:42 PM, Lenny Maiorani wrote:

> Ted,
> 
> I am finally getting around to implementing this and the checkNonNull subchecker working for memcpy(), but the unit tests fail. This is because I am putting out the string 'Null pointer argument in call to X' where X is the name of the function. memcpy() has a variant defined as __memcpy_chk() so I cannot properly have an expected output in the unit test file because it changes. Is there a way to do this?

The user doesn't explicitly write __memcpy_chk().  Isn't that generated by codegen, or does that appear in the actual AST?

> 
> Also, looking around at other checkers, this does not seem to be the convention. Most of them simply describe the error in the description instead of describing the error including the name of the function. I am going to scrap this and instead attempt to make the description strings more meaningful. This will probably take some significant re-writing though. The architecture of the CStringChecker doesn't allow for some of the things I want to do.

That seems a reasonable approach to me as well.

> 
> Does this all make sense?

Absolutely.  The whole point of the diagnostics is for the user to understand the issue.  It's a fine balance between being succinct (but uninformative) and too verbose.



More information about the cfe-commits mailing list