From 32cabecca93261edd11a9357254cfb0119598b91 Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Fri, 5 Jan 2024 23:34:08 +0100 Subject: [PATCH] Add support for InvalidFunctionArg lgamma() (#5845) Reference: https://en.cppreference.com/w/cpp/numeric/math/lgamma --- 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 490480a5671..70c05e57b1f 100644 --- a/cfg/std.cfg +++ b/cfg/std.cfg @@ -3035,6 +3035,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun + @@ -3044,8 +3045,11 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun + + !0.0: + @@ -3055,8 +3059,11 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun + + !0.0: + @@ -3066,6 +3073,8 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun + + !0.0: diff --git a/test/cfg/std.cpp b/test/cfg/std.cpp index 1762118c716..8bb7c29f48b 100644 --- a/test/cfg/std.cpp +++ b/test/cfg/std.cpp @@ -2382,6 +2382,30 @@ void uninitvar_ldexp(void) (void)std::ldexp(ldc,e3); } +void invalidFunctionArg_lgamma(float f, double d, long double ld) +{ + (void)lgamma(d); + // cppcheck-suppress invalidFunctionArg + (void)lgamma(-0.1); + // cppcheck-suppress invalidFunctionArg + (void)lgamma(0.0); + (void)lgamma(0.1); + + (void)lgammaf(f); + // cppcheck-suppress invalidFunctionArg + (void)lgammaf(-0.1f); + // cppcheck-suppress invalidFunctionArg + (void)lgammaf(0.0f); + (void)lgammaf(0.1f); + + (void)lgammal(ld); + // cppcheck-suppress invalidFunctionArg + (void)lgammal(-0.1L); + // cppcheck-suppress invalidFunctionArg + (void)lgammal(0.0L); + (void)lgammal(0.1L); +} + void uninitvar_lgamma(void) { float f;