kde.cfg: Add KDE configuration and tests (#2278)
Reference: https://kde.org
This commit is contained in:
parent
99ef64459b
commit
478625c802
|
@ -0,0 +1,51 @@
|
|||
<?xml version="1.0"?>
|
||||
<def format="2">
|
||||
<!-- KDE Library Configuration https://kde.org -->
|
||||
<!-- The KDE library is typically not included by one specific header file, there are many -->
|
||||
<!-- different ones, like for Qt. Examples: "#include <KApplication>" or "#include <KMessageBox>" -->
|
||||
<!-- ########## KDE Types ########## -->
|
||||
<!-- ########## KDE Macros / Defines ########## -->
|
||||
<define name="K_GLOBAL_STATIC_STRUCT_NAME(NAME)" value="_k_##NAME##__LINE__"/>
|
||||
<define name="K_GLOBAL_STATIC(TYPE, NAME)" value="K_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ())"/>
|
||||
<define name="K_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ARGS)" value="static struct K_GLOBAL_STATIC_STRUCT_NAME(NAME) NAME;"/>
|
||||
<define name="KDE_ISLIKELY(x)" value="(x)"/>
|
||||
<define name="KDE_ISUNLIKELY(x)" value="(x)"/>
|
||||
<define name="KDE_IS_VERSION(a, b, c)" value="( KDE_VERSION >= KDE_MAKE_VERSION(a,b,c) )"/>
|
||||
<define name="KDE_EXPORT" value=""/>
|
||||
<define name="KDE_IMPORT" value=""/>
|
||||
<define name="KDE_MAKE_VERSION(a, b, c)" value="(((a) << 16) | ((b) << 8) | (c))"/>
|
||||
<define name="KDE_MUST_USE_RESULT" value="__attribute__((__warn_unused_result__))"/>
|
||||
<define name="KDE_NO_DEPRECATED" value=""/>
|
||||
<define name="KDE_NO_EXPORT" value=""/>
|
||||
<define name="KDE_PACKED" value=""/>
|
||||
<define name="KDE_VERSION" value="KDE_MAKE_VERSION(KDE_VERSION_MAJOR,KDE_VERSION_MINOR,KDE_VERSION_RELEASE)"/>
|
||||
<define name="KDE_WEAK_SYMBOL" value=""/>
|
||||
<!-- ########## KDE Allocation / Deallocation ########## -->
|
||||
<!-- ########## KDE Functions ########## -->
|
||||
<!-- template<typename T > T KConfigGroup::readEntry ( const QString & key, const T & aDefault ) const -->
|
||||
<!-- template<typename T > T KConfigGroup::readEntry ( const char * key, const T & aDefault ) const -->
|
||||
<!-- QVariant KConfigGroup::readEntry ( const QString & key, const QVariant & aDefault ) const -->
|
||||
<!-- QVariant KConfigGroup::readEntry ( const char * key, const QVariant & aDefault ) const -->
|
||||
<!-- QString KConfigGroup::readEntry ( const QString & key, const QString & aDefault ) const -->
|
||||
<!-- QString KConfigGroup::readEntry ( const char * key, const QString & aDefault ) const -->
|
||||
<!-- QString KConfigGroup::readEntry ( const QString & key, const char * aDefault = 0 ) const -->
|
||||
<!-- QString KConfigGroup::readEntry ( const char * key, const char * aDefault = 0 ) const -->
|
||||
<!-- QVariantList KConfigGroup::readEntry ( const QString & key, const QVariantList & aDefault ) const -->
|
||||
<!-- QVariantList KConfigGroup::readEntry ( const char * key, const QVariantList & aDefault ) const -->
|
||||
<!-- QStringList KConfigGroup::readEntry ( const QString & key, const QStringList & aDefault ) const -->
|
||||
<!-- QStringList KConfigGroup::readEntry ( const char * key, const QStringList & aDefault ) const -->
|
||||
<!-- template<typename T > QList<T> KConfigGroup::readEntry ( const QString & key, const QList< T > & aDefault ) const -->
|
||||
<!-- template<typename T > QList<T> KConfigGroup::readEntry ( const char * key, const QList< T > & aDefault ) const -->
|
||||
<function name="KConfigGroup::readEntry">
|
||||
<noreturn>false</noreturn>
|
||||
<use-retval/>
|
||||
<leak-ignore/>
|
||||
<const/>
|
||||
<arg nr="1" direction="in">
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
<arg nr="2" direction="in" default="0">
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
</function>
|
||||
</def>
|
|
@ -0,0 +1,32 @@
|
|||
|
||||
// Test library configuration for kde.cfg
|
||||
//
|
||||
// Usage:
|
||||
// $ cppcheck --check-library --enable=information --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/kde.cpp
|
||||
// =>
|
||||
// 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);
|
||||
|
||||
void valid_code(KConfigGroup &cfgGroup)
|
||||
{
|
||||
k_global_static_testclass1 * pk_global_static_testclass1 = k_global_static_testinstance1;
|
||||
printf("%p", pk_global_static_testclass1);
|
||||
|
||||
bool entryTest = cfgGroup.readEntry("test", false);
|
||||
if (entryTest) {}
|
||||
}
|
||||
|
||||
void ignoredReturnValue(KConfigGroup & cfgGroup)
|
||||
{
|
||||
// cppcheck-suppress ignoredReturnValue
|
||||
cfgGroup.readEntry("test", "default");
|
||||
// cppcheck-suppress ignoredReturnValue
|
||||
cfgGroup.readEntry("test");
|
||||
}
|
|
@ -282,6 +282,36 @@ ${CPPCHECK} ${CPPCHECK_OPT} --library=cairo ${DIR}cairo.c
|
|||
|
||||
${CPPCHECK} ${CPPCHECK_OPT} --inconclusive --library=googletest ${DIR}googletest.cpp
|
||||
|
||||
# kde.cpp
|
||||
set +e
|
||||
set -x
|
||||
KDECONFIG=$(kde4-config --path include)
|
||||
KDECONFIG_RETURNCODE=$?
|
||||
set -e
|
||||
if [ $KDECONFIG_RETURNCODE -ne 0 ]; then
|
||||
echo "kde4-config does not work, skipping syntax check."
|
||||
else
|
||||
set +e
|
||||
KDEQTCONFIG=$(pkg-config --cflags QtCore)
|
||||
KDEQTCONFIG_RETURNCODE=$?
|
||||
set -e
|
||||
if [ $KDEQTCONFIG_RETURNCODE -ne 0 ]; then
|
||||
echo "Suitable Qt not present, Qt is necessary for KDE. Skipping syntax check."
|
||||
else
|
||||
set +e
|
||||
echo -e "#include <KDE/KGlobal>\n" | ${CXX} ${CXX_OPT} -I${KDECONFIG} ${KDEQTCONFIG} -x c++ -
|
||||
KDECHECK_RETURNCODE=$?
|
||||
set -e
|
||||
if [ $KDECHECK_RETURNCODE -ne 0 ]; then
|
||||
echo "KDE headers not completely present or not working, skipping syntax check with ${CXX}."
|
||||
else
|
||||
echo "KDE found, checking syntax with ${CXX} now."
|
||||
${CXX} ${CXX_OPT} -I${KDECONFIG} ${KDEQTCONFIG} ${DIR}kde.cpp
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
${CPPCHECK} ${CPPCHECK_OPT} --inconclusive --library=kde ${DIR}kde.cpp
|
||||
|
||||
# Check the syntax of the defines in the configuration files
|
||||
set +e
|
||||
xmlstarlet --version
|
||||
|
|
|
@ -451,6 +451,7 @@ def get_libraries():
|
|||
'cppunit': ['<cppunit/'],
|
||||
'googletest': ['<gtest/gtest.h>'],
|
||||
'gtk': ['<gtk/gtk.h>', '<glib.h>', '<glib/', '<gnome.h>'],
|
||||
# 'kde': ['<KGlobal>', '<KApplication>', '<KDE/'], <= enable after release of version 1.90
|
||||
'libcerror': ['<libcerror.h>'],
|
||||
'libcurl': ['<curl/curl.h>'],
|
||||
'lua': ['<lua.h>', '"lua.h"'],
|
||||
|
|
Loading…
Reference in New Issue