From 71212c7d66d495b26584552b13322abbcdf45a6a Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Sat, 6 Jan 2024 14:59:43 +0100 Subject: [PATCH] std.cfg: Added support for invalidFunctionArg check to tgamma(). (#5850) Reference: https://en.cppreference.com/w/cpp/numeric/math/tgamma --- cfg/std.cfg | 9 +++++++++ test/cfg/std.cpp | 24 ++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/cfg/std.cfg b/cfg/std.cfg index 70c05e57b..b32b4cae7 100644 --- a/cfg/std.cfg +++ b/cfg/std.cfg @@ -737,6 +737,7 @@ + @@ -746,8 +747,11 @@ + + !0.0: + @@ -757,8 +761,11 @@ + + !0.0: + @@ -768,6 +775,8 @@ + + !0.0: diff --git a/test/cfg/std.cpp b/test/cfg/std.cpp index 8bb7c29f4..28279b77a 100644 --- a/test/cfg/std.cpp +++ b/test/cfg/std.cpp @@ -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;