Skip to content

Commit

Permalink
Merge branch 'danmar:main' into chr_Fix12322
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github committed Jan 6, 2024
2 parents e62c282 + e3b3048 commit ff0b9c9
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
9 changes: 9 additions & 0 deletions cfg/std.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,7 @@
<not-uninit/>
</arg>
</function>
<!-- https://en.cppreference.com/w/cpp/numeric/math/tgamma -->
<!-- double tgamma(double x); -->
<function name="tgamma,std::tgamma">
<use-retval/>
Expand All @@ -746,8 +747,11 @@
<leak-ignore/>
<arg nr="1" direction="in">
<not-uninit/>
<!-- If x is zero or a negative integer for which the function is asymptotic, it may cause a pole error (depending on implementation).-->
<valid>!0.0:</valid>
</arg>
</function>
<!-- https://en.cppreference.com/w/cpp/numeric/math/tgamma -->
<!-- float tgammaf(float x); -->
<function name="tgammaf,std::tgammaf">
<use-retval/>
Expand All @@ -757,8 +761,11 @@
<leak-ignore/>
<arg nr="1" direction="in">
<not-uninit/>
<!-- If x is zero or a negative integer for which the function is asymptotic, it may cause a pole error (depending on implementation).-->
<valid>!0.0:</valid>
</arg>
</function>
<!-- https://en.cppreference.com/w/cpp/numeric/math/tgamma -->
<!-- long double tgammal(long double x); -->
<function name="tgammal,std::tgammal">
<use-retval/>
Expand All @@ -768,6 +775,8 @@
<leak-ignore/>
<arg nr="1" direction="in">
<not-uninit/>
<!-- If x is zero or a negative integer for which the function is asymptotic, it may cause a pole error (depending on implementation).-->
<valid>!0.0:</valid>
</arg>
</function>
<!-- double trunc(double x); -->
Expand Down
24 changes: 24 additions & 0 deletions test/cfg/std.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2406,6 +2406,30 @@ void invalidFunctionArg_lgamma(float f, double d, long double ld)
(void)lgammal(0.1L);
}

void invalidFunctionArg_tgamma(float f, double d, long double ld)
{
(void)tgamma(d);
// cppcheck-suppress invalidFunctionArg
(void)tgamma(-0.1);
// cppcheck-suppress invalidFunctionArg
(void)tgamma(0.0);
(void)tgamma(0.1);

(void)tgammaf(f);
// cppcheck-suppress invalidFunctionArg
(void)tgammaf(-0.1f);
// cppcheck-suppress invalidFunctionArg
(void)tgammaf(0.0f);
(void)tgammaf(0.1f);

(void)tgammal(ld);
// cppcheck-suppress invalidFunctionArg
(void)tgammal(-0.1L);
// cppcheck-suppress invalidFunctionArg
(void)tgammal(0.0L);
(void)tgammal(0.1L);
}

void uninitvar_lgamma(void)
{
float f;
Expand Down
2 changes: 1 addition & 1 deletion test/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ namespace simplecpp {

class givenACodeSampleToTokenize {
private:
Tokenizer tokenizer;
const Settings settings;
Tokenizer tokenizer;

public:
explicit givenACodeSampleToTokenize(const char sample[], bool createOnly = false, bool cpp = true)
Expand Down

0 comments on commit ff0b9c9

Please sign in to comment.