Hi,
i was trying to add library configuration for my methods, but cppcheck always says that there is no configuration.
I really don't know what is wrong, maybe just a stupid error.
In the manual it says:
"For functions in namespaces or classes, just provide
their fully qualified name. For example: <function name="memcpy,std::memcpy">"
My understanding is to add a configuration for <function name="foo::bar"> if i have a method called bar in a class foo.
Here is a reduced example:
I believe we have tweaked this since 1.81 was released. The --check-library was tweaked so it will match the actual library behaviour better. I don't see those warning messages with latest git head.
as far as I remember we currently skip library configuration if the function implementation is seen. To avoid that the wrong configuration is used. For instance if you define your own local exit() function then you don't want that the exit configuration in std.cfg is used for that. maybe we could add some element/attribute so cppcheck will know that it is expected that the implementation is seen. Feel free to create a ticket about that.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You are right, with the latest git head i do not get the --check-library message for the configured method any longer.
When changing the configuration a bit so it only allows specific values and the method is called with an invalid one, there is no warning message (because the method definition is seen and the library configuration ignored).
This is indeed not what i expected:
At least some (debug) message that the library configuration is ignored because the implementation is seen would be great.
Or maybe an inconclusive warning that the parameter value could be invalid according to the library config, with a hint that the implementation is seen and the configuration may be not suitible.
I will see if i can create a useful ticket.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
i was trying to add library configuration for my methods, but cppcheck always says that there is no configuration.
I really don't know what is wrong, maybe just a stupid error.
In the manual it says:
"For functions in namespaces or classes, just provide
their fully qualified name. For example: <function name="memcpy,std::memcpy">"
My understanding is to add a configuration for <function name="foo::bar"> if i have a method called bar in a class foo.
Here is a reduced example:
Last edit: versat 2017-11-28
I see nothing wrong with your configuration.
I believe we have tweaked this since 1.81 was released. The --check-library was tweaked so it will match the actual library behaviour better. I don't see those warning messages with latest git head.
as far as I remember we currently skip library configuration if the function implementation is seen. To avoid that the wrong configuration is used. For instance if you define your own local exit() function then you don't want that the exit configuration in std.cfg is used for that. maybe we could add some element/attribute so cppcheck will know that it is expected that the implementation is seen. Feel free to create a ticket about that.
You are right, with the latest git head i do not get the --check-library message for the configured method any longer.
When changing the configuration a bit so it only allows specific values and the method is called with an invalid one, there is no warning message (because the method definition is seen and the library configuration ignored).
This is indeed not what i expected:
At least some (debug) message that the library configuration is ignored because the implementation is seen would be great.
Or maybe an inconclusive warning that the parameter value could be invalid according to the library config, with a hint that the implementation is seen and the configuration may be not suitible.
I will see if i can create a useful ticket.
I created the following ticket:
https://trac.cppcheck.net/ticket/8290