Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
所以我最近开始在 emacs 中使用 flycheck。总的来说,它工作得很好,但我在 c++ 模式下使用 cppcheck 时遇到了一个小问题。我收到一堆未使用的StructMember 警告,可能是由于没有在当前文件中使用该成员。我想知道是否可以告诉 flycheck 从 cppcheck 禁用未使用的StructMember 警告,如果可以,我将如何去做?我的 emacs-lisp 技能大多不存在,到目前为止我还没有找到任何有类似问题的人。
谢谢!
这不是 emacs 配置,但取决于您用于 C++ flycheck 的后端(即 cppcheck)。
我只是看了一下cppcheck的手册。显然,您可以通过内联编译指示来做到这一点。例如:
void f() { char arr[5]; // cppcheck-suppress arrayIndexOutOfBounds arr[10] = 0; }
在你的情况下,你需要类似的东西:
// cppcheck-suppress unusedStructMember