2015-02-16 22:06:08 +01:00
|
|
|
|
|
|
|
// Test library configuration for gnu.cfg
|
|
|
|
//
|
|
|
|
// Usage:
|
2015-02-16 22:19:51 +01:00
|
|
|
// $ cppcheck --check-library --library=gnu --enable=information --enable=style --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/gnu.c
|
2015-02-16 22:06:08 +01:00
|
|
|
// =>
|
|
|
|
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
|
|
|
|
//
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
2015-08-14 01:36:44 +02:00
|
|
|
void leakReturnValNotUsed()
|
|
|
|
{
|
|
|
|
// cppcheck-suppress unreadVariable
|
|
|
|
char* ptr = (char*)strdupa("test");
|
|
|
|
// cppcheck-suppress ignoredReturnValue
|
|
|
|
strdupa("test");
|
|
|
|
// cppcheck-suppress unreadVariable
|
|
|
|
char* ptr2 = (char*)strndupa("test", 1);
|
|
|
|
// cppcheck-suppress ignoredReturnValue
|
|
|
|
strndupa("test", 1);
|
|
|
|
// cppcheck-suppress ignoredReturnValue
|
|
|
|
// cppcheck-suppress nullPointer
|
|
|
|
strcasestr("test", NULL);
|
|
|
|
|
2016-07-20 12:21:00 +02:00
|
|
|
// cppcheck-suppress knownConditionTrueFalse
|
|
|
|
// cppcheck-suppress duplicateExpression
|
2015-08-14 01:36:44 +02:00
|
|
|
if (42 == __builtin_expect(42, 0))
|
|
|
|
return;
|
2015-02-16 22:06:08 +01:00
|
|
|
}
|