2

So I've recently begun using flycheck within emacs. Overall it's working great, but I've been having a small issue with flycheck using cppcheck in c++ mode. I'm getting a bunch of unusedStructMember warnings, likely due to not using that member within the present file. 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? My emacs-lisp skills are mostly non-existent and so far I haven't found anyone with a similar problem.

Thanks!

David
  • 163
  • 6

1 Answers1

3

This is not an emacs configuration but something depends on the backend you use for C++ flycheck (i.e. cppcheck).

I just took a look at the manual of 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 
Lungang Fang
  • 1,427
  • 12
  • 14