Integrate Cppcheck with Emacs

Posted by N.N. on Stack Overflow See other posts from Stack Overflow or by N.N.
Published on 2012-06-29T09:46:43Z Indexed on 2012/06/29 15:16 UTC
Read the original article Hit count: 569

Filed under:
|

Is it possible to integrate Cppcheck with Emacs in a more sophisticated way than simply calling the shell command on the current buffer? I would like Emacs to be able to parse Cppcheck's messages and treat them as messages from a compiler (similar to how compile works), such as using C-x ` to visit the targets of Cppcheck's messages.

Here is some example output Cppcheck:

$ cppcheck --enable=all test.cpp 
Checking test.cpp...
[test.cpp:4]: (error) Possible null pointer dereference: p - otherwise it is redundant to check if p is null at line 5
[test.cpp:38]: (style) The scope of the variable 'i' can be reduced
[test.cpp:38]: (style) Variable 'i' is assigned a value that is never used
[test.cpp:23]: (error) Possible null pointer dereference: p
[test.cpp:33]: (error) Possible null pointer dereference: p
Checking usage of global functions..
[test.cpp:36]: (style) The function 'f' is never used
[test.cpp:1]: (style) The function 'f1' is never used
[test.cpp:9]: (style) The function 'f2' is never used
[test.cpp:26]: (style) The function 'f3' is never used

© Stack Overflow or respective owner

Related posts about emacs

Related posts about cppcheck