versat - 2018-04-12

When checking for example the cppcheck-gui with --check-config i get messages like this:

Summary: --check-library: There is no matching configuration for function QFileInfo()

for such code:

if (QFileInfo("/usr/bin/gedit").isExecutable()) {
    //...
}

Cppcheck does not know that there is a QFileInfo class and that the constructor is called here i guess.
So if there would be a configuration for QFileInfo::isExecutable() it would not be used i guess.
My question now is: What is the best way to configure this so Cppcheck gets the relevant info?

I guess that adding a function configuration for QFileInfo() in the qt.cfg is not really a good solution (or is it?).

Adding a header with simple forward declarations could already help a bit i guess, but this must be included automatically if the according library is enabled then. Not sure if this is a elegant solution.

Another idea is to enhance the library configuration with elements like

<classcfg name="QFileInfo"/>

This can then be enhanced so information about derivation and other things can be added.

Other ideas or maybe solutions that already work?

 

Last edit: versat 2018-04-12