Hi,

I have a main.cpp

class A {
 public:
  void foo(){}
};

int main() {
  A a;
  a.foo();
}

a CMakeLists.txt

cmake_minimum_required(VERSION 2.8.9)
project (hello)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
add_executable(hello main.cpp)

and a suppressfile.txt :

functionStatic:*main.cpp

Please, run :

mkdir build; cd build
cmake ..

Test without the suppressfile, you can see you have a warning about functionStatic :

cppcheck --inconclusive --enable=all --project=compile_commands.json

Checking /tmp/cppchecktest/main.cpp ...
[/tmp/cppchecktest/main.cpp:3]: (performance, inconclusive) Technically the member function 'A::foo' can be static (but you may consider moving to unnamed namespace).

Test with the suppressfile, you can see the warning disappears but you now have a wrong "Unmatched suppression"

cppcheck --inconclusive --enable=all --project=compile_commands.json --suppressions-list=../suppressfile.txt

Checking /tmp/cppchecktest/main.cpp ...
[*main.cpp]: (information) Unmatched suppression: functionStatic

The problem appears only with --project=compile_commands.json.

If I do a direct verification of main.cpp :

cppcheck --inconclusive --enable=all ../main.cpp
Checking ../main.cpp ...
[../main.cpp:3]: (performance, inconclusive) Technically the member function 'A::foo' can be static (but you may consider moving to unnamed namespace).

and with the suppressfile :

cppcheck --inconclusive --enable=all ../main.cpp --suppressions-list=../suppressfile.txt
Checking ../main.cpp ...

By the way, is it possible to have a trac account with the mail cppcheck[@]le-garrec(.)fr
Thanks