Skip to content

Commit 0c15f20

Browse files
committed
added tests for gnu.cfg bit op funcs
1 parent 09585d4 commit 0c15f20

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

‎test/cfg/gnu.c‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,29 @@ void knownConditionTrueFalse_ffsll(long long i)
197197
if (ffsll(i) == 0) {}
198198
}
199199

200+
int uninitvar_popcount() {
201+
unsigned int a;
202+
// cppcheck-suppress uninitvar
203+
int b = __builtin_popcount(a); // popcount requires init arg
204+
return b;
205+
}
206+
207+
int invalidFunctionArg_clz() {
208+
// cppcheck-suppress invalidFunctionArg
209+
return __builtin_clz(0);
210+
}
211+
212+
int invalidFunctionArgBool_ctzg(unsigned int a, unsigned int b) {
213+
// cppcheck-suppress invalidFunctionArgBool
214+
return __builtin_ctzg(a, a % b == 0);
215+
}
216+
217+
int useRetval_stdc_width(size_t n) {
218+
// cppcheck-suppress ignoredReturnValue
219+
__builtin_stdc_bit_width(n);
220+
return 0;
221+
}
222+
200223
#if !defined(__APPLE__)
201224
int nullPointer_semtimedop(int semid, struct sembuf *sops, size_t nsops, const struct timespec *timeout)
202225
{

0 commit comments

Comments
 (0)