From d77b0b3b9d0d07b63c40a910ef6ce1c5c22995ac Mon Sep 17 00:00:00 2001 From: matt335672 <30179339+matt335672@users.noreply.github.com> Date: Fri, 23 Jun 2023 14:56:41 +0100 Subject: [PATCH] Bump cppcheck to v2.11 This fixes the following errors:- sesman/tools/authtest.c:64:14: error: syntax error [syntaxError] g_printf("xrdp auth module tester v" PACKAGE_VERSION "\n"); ^ sesman/tools/sesrun.c:165:14: error: syntax error [syntaxError] g_printf("xrdp session starter v" PACKAGE_VERSION "\n"); ^ vrplayer/decoder.h:35:12: error: There is an unknown macro here somewhere. Configuration is required. If slots is a macro then please configure it. [unknownMacro] public slots: ^ vrplayer/playaudio.h:45:12: error: There is an unknown macro here somewhere. Configuration is required. If slots is a macro then please configure it. [unknownMacro] public slots: ^ vrplayer/dlgabout.h:22:13: error: There is an unknown macro here somewhere. Configuration is required. If slots is a macro then please configure it. [unknownMacro] private slots: ^ vrplayer/playvideo.h:49:12: error: There is an unknown macro here somewhere. Configuration is required. If slots is a macro then please configure it. [unknownMacro] public slots: ^ Additionally, cppcheck now makes use of all available CPUs --- .github/workflows/build.yml | 2 +- librfxcodec | 2 +- scripts/run_cppcheck.sh | 8 +++++++- sesman/tools/authtest.c | 5 +++++ sesman/tools/sesrun.c | 5 +++++ vrplayer/decoder.h | 2 +- vrplayer/dlgabout.h | 2 +- vrplayer/playaudio.h | 2 +- vrplayer/playvideo.h | 2 +- 9 files changed, 23 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 979a851b..949fccab 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -165,7 +165,7 @@ jobs: CC: gcc # This is required to use a version of cppcheck other than that # supplied with the operating system - CPPCHECK_VER: "2.10" + CPPCHECK_VER: "2.11" CPPCHECK_REPO: https://github.com/danmar/cppcheck.git steps: # Set steps.os.outputs.image to the specific OS (e.g. 'ubuntu20') diff --git a/librfxcodec b/librfxcodec index 30f6ce18..25f61280 160000 --- a/librfxcodec +++ b/librfxcodec @@ -1 +1 @@ -Subproject commit 30f6ce185c84edc6350bce0d6eae1a16edd2b1a3 +Subproject commit 25f6128026bddf7d3588f5f5466603c87ac6c0b3 diff --git a/scripts/run_cppcheck.sh b/scripts/run_cppcheck.sh index adad9d48..545af41b 100755 --- a/scripts/run_cppcheck.sh +++ b/scripts/run_cppcheck.sh @@ -45,10 +45,16 @@ if [ -z "$CPPCHECK_FLAGS" ]; then CPPCHECK_FLAGS="--quiet --force --std=c11 --std=c++11 --inline-suppr \ --enable=warning --error-exitcode=1 -i third_party" fi +CPPCHECK_FLAGS="$CPPCHECK_FLAGS -D__cppcheck__" # Any options/directories specified? if [ $# -eq 0 ]; then - set -- -j 2 . + if [ -f /proc/cpuinfo ]; then + cpus=$(grep '^processor' /proc/cpuinfo | wc -l) + else + cpus=2 + fi + set -- -j $cpus . fi # Display the cppcheck version and command for debugging diff --git a/sesman/tools/authtest.c b/sesman/tools/authtest.c index 48d8cca2..9224204b 100644 --- a/sesman/tools/authtest.c +++ b/sesman/tools/authtest.c @@ -35,6 +35,11 @@ #include "os_calls.h" #include "string_calls.h" +// cppcheck doesn't always set this macro to something in double-quotes +#if defined(__cppcheck__) +#undef PACKAGE_VERSION +#endif + #if !defined(PACKAGE_VERSION) #define PACKAGE_VERSION "???" #endif diff --git a/sesman/tools/sesrun.c b/sesman/tools/sesrun.c index 46df4e4a..e326b073 100644 --- a/sesman/tools/sesrun.c +++ b/sesman/tools/sesrun.c @@ -42,6 +42,11 @@ #include "tools_common.h" +// cppcheck doesn't always set this macro to something in double-quotes +#if defined(__cppcheck__) +#undef PACKAGE_VERSION +#endif + #if !defined(PACKAGE_VERSION) #define PACKAGE_VERSION "???" #endif diff --git a/vrplayer/decoder.h b/vrplayer/decoder.h index d66b9214..c295b698 100644 --- a/vrplayer/decoder.h +++ b/vrplayer/decoder.h @@ -32,7 +32,7 @@ class Decoder : public QObject signals: - public slots: + public slots: // cppcheck-suppress unknownMacro void onGeometryChanged(QRect *geometry); }; diff --git a/vrplayer/dlgabout.h b/vrplayer/dlgabout.h index 1960670a..9706e3e3 100644 --- a/vrplayer/dlgabout.h +++ b/vrplayer/dlgabout.h @@ -19,7 +19,7 @@ class DlgAbout : public QDialog private: Ui::DlgAbout *ui; - private slots: + private slots: // cppcheck-suppress unknownMacro void onOk(); }; diff --git a/vrplayer/playaudio.h b/vrplayer/playaudio.h index 0a05d41f..8e91dcc5 100644 --- a/vrplayer/playaudio.h +++ b/vrplayer/playaudio.h @@ -42,7 +42,7 @@ class PlayAudio : public QObject void setVcrOp(int op); - public slots: + public slots: // cppcheck-suppress unknownMacro void play(); private: diff --git a/vrplayer/playvideo.h b/vrplayer/playvideo.h index b63bc180..e0285d5e 100644 --- a/vrplayer/playvideo.h +++ b/vrplayer/playvideo.h @@ -46,7 +46,7 @@ class PlayVideo : public QObject //void setVcrOp(int op); //void onMediaRestarted(); - public slots: + public slots: // cppcheck-suppress unknownMacro void play(); //signals: