From e0ccfea0274b3830501175db262b5f42642ca273 Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Sun, 1 May 2022 15:29:35 +0200 Subject: [PATCH] gnu.cfg: Improved configuration of ffsl() and ffsll() --- cfg/gnu.cfg | 3 ++- test/cfg/gnu.c | 20 ++++++++++++++++++++ test/cfg/posix.c | 2 +- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/cfg/gnu.cfg b/cfg/gnu.cfg index 675c4f896..7cb66e5ce 100644 --- a/cfg/gnu.cfg +++ b/cfg/gnu.cfg @@ -1161,7 +1161,8 @@ int ffsll(long long int i); --> - + + arg1==0 &0 false diff --git a/test/cfg/gnu.c b/test/cfg/gnu.c index 5690b126a..545ef8cad 100644 --- a/test/cfg/gnu.c +++ b/test/cfg/gnu.c @@ -22,6 +22,26 @@ #include #endif +#include + +void knownConditionTrueFalse_ffsl(long i) +{ + // ffs() returns the position of the first bit set, or 0 if no bits are set in i. + const int x = ffsl(0); + // cppcheck-suppress knownConditionTrueFalse + if (x == 0) {} + if (ffsl(i) == 0) {} +} + +void knownConditionTrueFalse_ffsll(long long i) +{ + // ffs() returns the position of the first bit set, or 0 if no bits are set in i. + const int x = ffsll(0); + // cppcheck-suppress knownConditionTrueFalse + if (x == 0) {} + if (ffsll(i) == 0) {} +} + int nullPointer_semtimedop(int semid, struct sembuf *sops, size_t nsops, const struct timespec *timeout) { (void) semtimedop(semid, sops, nsops, NULL); // If the timeout argument is NULL, then semtimedop() behaves exactly like semop(). diff --git a/test/cfg/posix.c b/test/cfg/posix.c index e6bc4dedb..6b2d13fb4 100644 --- a/test/cfg/posix.c +++ b/test/cfg/posix.c @@ -31,8 +31,8 @@ #define _XOPEN_SOURCE #include #include - #include + void knownConditionTrueFalse_ffs(int i) { // ffs() returns the position of the first bit set, or 0 if no bits are set in i.