Wireshark-dev: Re: [Wireshark-dev] [Wireshark-commits] rev 47326: / /trunk/tools/: checkhf-v2.p
From: Bill Meier <wmeier@xxxxxxxxxxx>
Date: Thu, 31 Jan 2013 13:23:09 -0500
On 1/28/2013 3:31 PM, Evan Huus wrote:
Tangentially, CppCheck [1] has support for custom checks using
plugins. I've never had time to investigate properly, but I suspect
that implementing the three check scripts (checkhf, checkAPIs,
checkfiltername) as CppCheck plugins would be a major win, primarily
because we'd get real C grammar parsing for free.

Cheers,
Evan

[1] http://cppcheck.sourceforge.net/

After looking at the cppcheck docs about writing rules & sampling the developer's cppcheck forum a bit, lets just say that I don't really get a warm feeling about trying to do our special tests with cppcheck.

The basic mechanism for adding rules appears to be nothing more than using regexs to pick out patterns on a tokenised version of the source program.

One can write rules using C++ code to traverse a tokenised version of the code; This doesn't seem much better.

I didn't see anything about plugins (other than cppcheck being used as a plugin by various IDE's). Maybe I missed something....

I imagine that there's much more capability if I want to really dig into the code and see how the existing capability is provided and how more comples rules might be written.


OTOH, using the CLang library[1] sounds quite interesting. It might be that it's possible to fairly easily do what is needed.


[1]http://amnoid.de/tmp/clangtut/tut.html

Bill