void main()
{
smart_ptr<MS> s ( zaz::create() );
}
and it gives me "error,leakReturnValNotUsed,Return value of allocation function s is not stored."
so i am trying to change the output because it is OK.
but with rule-file
<rule version="1">
<pattern>smart_ptr<MS> s \( zaz::create\(\) \);</pattern><message><id>information</id><severity>information</severity><summary>It is not an error.</summary></message>
</rule>
there is not a change in the output.
I do not want to use suppression on the whole file or suppress the error on exact line.
Just want ot change the error properties .
And debug shows
,debug,debug,Unknown type 'smart_ptr<MS>'.
I tried with --library by defining smart_ptr and MS witout the other attributes. That managed the Unknown type in debug but I have no idea what to do with 's' that is detected as function - i tried to make container definition for smart_ptr because it is almost the same as the example with std::vector but result was still the same.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
What to do for it to not report it or change it from error to information.
I am using something like this:
mypointer<int> myobject (createObj());
where mypointeris a smart pointer and createObj returns a pointer.
Cppcheck dedicates that myobject is a function not an obejct.
I have tried
<?xml version="1.0"?>
<def>
<function name="myobject ">
<memory>
<alloc>malloc</alloc>
<dealloc>free</dealloc>
</memory>
</function>
</def>
with no effect.
and with rules
but it only editing the new rule to the previous report without removing the wrong reports.
I fail to reproduce.
Is it possible to show some example 4-5 lines of code that reproduce the problem?
this is bad configuration. myobject is not a function. don't do this.
void main()
{
smart_ptr<MS> s ( zaz::create() );
}
and it gives me "error,leakReturnValNotUsed,Return value of allocation function s is not stored."
so i am trying to change the output because it is OK.
but with rule-file
<rule version="1">
</rule>
there is not a change in the output.
I do not want to use suppression on the whole file or suppress the error on exact line.
Just want ot change the error properties .
And debug shows
,debug,debug,Unknown type 'smart_ptr<MS>'.
May be this is not the right way to make it.
Tried with config but:
<def>
</def>
again with no difference in the output.
Or my problem is within the pcre.lib and pcre.h. What to do with them to be able to use rules.
Last edit: Teodor Todorov 2015-06-03
I tried with --library by defining smart_ptr and MS witout the other attributes. That managed the Unknown type in debug but I have no idea what to do with 's' that is detected as function - i tried to make container definition for smart_ptr because it is almost the same as the example with std::vector but result was still the same.