2019-10-17 21:29:32 +02:00
|
|
|
|
|
|
|
// Test library configuration for kde.cfg
|
|
|
|
//
|
|
|
|
// Usage:
|
2023-03-09 20:04:20 +01:00
|
|
|
// $ cppcheck --check-library --library=kde --enable=style,information --inconclusive --error-exitcode=1 --disable=missingInclude --inline-suppr test/cfg/kde.cpp
|
2019-10-17 21:29:32 +02:00
|
|
|
// =>
|
|
|
|
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
|
|
|
|
//
|
|
|
|
|
|
|
|
#include <cstdio>
|
|
|
|
#include <KDE/KGlobal>
|
|
|
|
#include <KDE/KConfigGroup>
|
|
|
|
|
|
|
|
class k_global_static_testclass1 {};
|
|
|
|
K_GLOBAL_STATIC(k_global_static_testclass1, k_global_static_testinstance1);
|
|
|
|
|
2021-04-18 21:42:27 +02:00
|
|
|
void valid_code(const KConfigGroup& cfgGroup)
|
2019-10-17 21:29:32 +02:00
|
|
|
{
|
2023-08-05 18:48:43 +02:00
|
|
|
const k_global_static_testclass1 * pk_global_static_testclass1 = k_global_static_testinstance1;
|
2019-10-17 21:29:32 +02:00
|
|
|
printf("%p", pk_global_static_testclass1);
|
|
|
|
|
|
|
|
bool entryTest = cfgGroup.readEntry("test", false);
|
|
|
|
if (entryTest) {}
|
|
|
|
}
|
|
|
|
|
2021-04-18 21:42:27 +02:00
|
|
|
void ignoredReturnValue(const KConfigGroup& cfgGroup)
|
2019-10-17 21:29:32 +02:00
|
|
|
{
|
|
|
|
// cppcheck-suppress ignoredReturnValue
|
|
|
|
cfgGroup.readEntry("test", "default");
|
|
|
|
// cppcheck-suppress ignoredReturnValue
|
|
|
|
cfgGroup.readEntry("test");
|
|
|
|
}
|