简体   繁体   English

flycheck cppcheck停止检查unusedStructMember

[英]flycheck cppcheck stop checking unusedStructMember

So I've recently begun using flycheck within emacs. 所以我最近开始在emacs中使用flycheck。 Overall it's working great, but I've been having a small issue with flycheck using cppcheck in c++ mode. 总的来说它工作得很好,但我在c ++模式下使用cppcheck的flycheck问题一直很小。 I'm getting a bunch of unusedStructMember warnings, likely due to not using that member within the present file. 我收到了一堆unusedStructMember警告,可能是由于在当前文件中没有使用该成员。 I was wondering if it is possible to tell flycheck to disable the unusedStructMember warnings from cppcheck, and if so, how would I go about doing so? 我想知道是否有可能告诉flycheck从cppcheck禁用unusedStructMember警告,如果是这样,我将如何这样做? My emacs-lisp skills are mostly non-existent and so far I haven't found anyone with a similar problem. 我的emacs-lisp技能大多不存在,到目前为止我还没有找到任何有类似问题的人。

Thanks! 谢谢!

This is not an emacs configuration but something depends on the backend you use for C++ flycheck (ie cppcheck). 这不是emacs配置,但取决于您用于C ++ flycheck的后端(即cppcheck)。

I just took a look at the manual of cppcheck. 我刚刚看了一下cppcheck的手册。 Obviously you can do it by inline pragmas. 显然你可以通过内联编译指示来完成它。 For example: 例如:

void f() {
    char arr[5];
    // cppcheck-suppress arrayIndexOutOfBounds
    arr[10] = 0;
}

In your case, you'll need something like: 在你的情况下,你需要这样的东西:

// cppcheck-suppress unusedStructMember 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM