miguel azevedo
miguel azevedo

Reputation: 577

CppCheck suppress obsolete function

I cannot inline suppress obsoleteFunctiosgets warning from cppcheck. I tried:

// cppcheck-suppress obsoleteFunctionsgets

with no success.

Did any of you experience this warning? Any hint? Thanks.

Upvotes: 1

Views: 716

Answers (1)

Daniel Marjamäki
Daniel Marjamäki

Reputation: 3037

Use --inline-suppr on the command line also. Otherwise the comment is ignored.

daniel@dator:~/cppcheck$ ./cppcheck --enable=all 1.c
Checking 1.c...
[1.c:4]: (style) Obsolete function 'gets' called. It is recommended to use the function 'fgets' instead.
daniel@dator:~/cppcheck$ ./cppcheck --enable=all --inline-suppr 1.c
Checking 1.c...
daniel@dator:~/cppcheck$

Personally.. I prefer to use --suppress or --suppressions-list instead of --inline-suppr. I don't like to clutter my code with such comments.

Upvotes: 2

Related Questions