From 1df9b1148221806b54d087c5f047373ee71a3c44 Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Fri, 5 Jan 2024 22:59:12 +0100 Subject: [PATCH 1/2] std.cfg: Added support for invalidFunctionArg for 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..d2b03a973d5 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; From ac1ed8a8c6693d15d8f102330cd11c4aa787a5e0 Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Fri, 5 Jan 2024 22:59:37 +0100 Subject: [PATCH 2/2] Format --- test/cfg/std.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/test/cfg/std.cpp b/test/cfg/std.cpp index d2b03a973d5..8bb7c29f48b 100644 --- a/test/cfg/std.cpp +++ b/test/cfg/std.cpp @@ -2384,26 +2384,26 @@ void uninitvar_ldexp(void) void invalidFunctionArg_lgamma(float f, double d, long double ld) { - (void)lgamma(d); + (void)lgamma(d); // cppcheck-suppress invalidFunctionArg - (void)lgamma(-0.1); + (void)lgamma(-0.1); // cppcheck-suppress invalidFunctionArg - (void)lgamma(0.0); + (void)lgamma(0.0); (void)lgamma(0.1); - - (void)lgammaf(f); + + (void)lgammaf(f); // cppcheck-suppress invalidFunctionArg - (void)lgammaf(-0.1f); + (void)lgammaf(-0.1f); // cppcheck-suppress invalidFunctionArg - (void)lgammaf(0.0f); - (void)lgammaf(0.1f); - - (void)lgammal(ld); + (void)lgammaf(0.0f); + (void)lgammaf(0.1f); + + (void)lgammal(ld); // cppcheck-suppress invalidFunctionArg - (void)lgammal(-0.1L); + (void)lgammal(-0.1L); // cppcheck-suppress invalidFunctionArg - (void)lgammal(0.0L); - (void)lgammal(0.1L); + (void)lgammal(0.0L); + (void)lgammal(0.1L); } void uninitvar_lgamma(void)