I'm trying to use cppcheck with some large libs. For this, writing a custom .cfg file generally works for me.
But three questions remain, that I could resolve neither with the included .cfg files nor with the PDF doc.
I created a fictitious code snipped to illustrate the points:
Enum: How can I declare the type "garden::fruit" in the cfg file?
Class without specifying implementations: How do I declare the class "garden::tool" in a cfg file?
Operators: What is the syntax for overloaded operators in a class? '|' in "garden::openwork"
If not defined in the cfg file, all the cases lead to "--check-library: There is no matching configuration for function ...", when a function in the scanned code takes the unknown enum, class, calculation result as parameter.
Regards,
Tim
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It is not yet possible to configure enums via the library configuration.
There is a feature request for this: https://trac.cppcheck.net/ticket/8183
As a workaround you can simply copy the enum to a header file and let Cppcheck include it before everything else via the --include= option.
It is not yet possible to configure classes in the library files. I have created a feature request for this: https://trac.cppcheck.net/ticket/9031
As a workaround you can for example forward declare such a class in a header file that is included first (see 1.).
AFAIK it is not possible to configure overloaded operators in the configuration. I guess this is a special case. Maybe we should create a ticket with a feature request for this too.
Regards
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi everyone,
I'm trying to use cppcheck with some large libs. For this, writing a custom .cfg file generally works for me.
But three questions remain, that I could resolve neither with the included .cfg files nor with the PDF doc.
I created a fictitious code snipped to illustrate the points:
If not defined in the cfg file, all the cases lead to "--check-library: There is no matching configuration for function ...", when a function in the scanned code takes the unknown enum, class, calculation result as parameter.
Regards,
Tim
Hi,
It is not yet possible to configure
enum
s via the library configuration.There is a feature request for this: https://trac.cppcheck.net/ticket/8183
As a workaround you can simply copy the
enum
to a header file and let Cppcheck include it before everything else via the--include=
option.It is not yet possible to configure
class
es in the library files. I have created a feature request for this: https://trac.cppcheck.net/ticket/9031As a workaround you can for example forward declare such a
class
in a header file that is included first (see 1.).AFAIK it is not possible to configure overloaded operators in the configuration. I guess this is a special case. Maybe we should create a ticket with a feature request for this too.
Regards
Hi versat,
Thanks for the reply.
Good, that the points are already beeing tracked - bad that the enum feature is open already for two years.
I made a work-around with a the following declarations for 1. This comes close for the behavior, but its not exactly the same (size of the type).
For the class declerations (2.) I don't see an easy work-around, so ticket #9031 gets a push from my side.
Regards
Tim
Last edit: SAT 2019-08-21