是否可以以比简单地在当前缓冲区上调用 shell 命令更复杂的方式将 Cppcheck 与 Emacs 集成?我希望 Emacs 能够解析 Cppcheck 的消息并将它们视为来自编译器的消息(类似于compile
工作原理),例如C-x `用于访问 Cppcheck 消息的目标。
这是一些示例输出 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