[education/rkward/kf5] /: Enable cppcheck suppressions

Thomas Friedrichsmeier null at kde.org
Wed Apr 10 16:12:08 BST 2024


Git commit 4a37288c3804cd88aa9d5bcd07c8f7fc9f792cc7 by Thomas Friedrichsmeier.
Committed on 08/04/2024 at 19:31.
Pushed by tfry into branch 'kf5'.

Enable cppcheck suppressions

M  +1    -0    .kde-ci.yml
M  +4    -1    rkward/debug.h

https://invent.kde.org/education/rkward/-/commit/4a37288c3804cd88aa9d5bcd07c8f7fc9f792cc7

diff --git a/.kde-ci.yml b/.kde-ci.yml
index 1ec78feec..9f103c8d5 100644
--- a/.kde-ci.yml
+++ b/.kde-ci.yml
@@ -22,3 +22,4 @@ Options:
   require-passing-tests-on: [ 'Linux', 'FreeBSD', 'Windows' ]
   tests-load-sensitve: True
   per-test-timeout: 90
+  cppcheck-arguments: '--enable=warning,style,performance --inline-suppr -DRKWARD_VERSION="dummy" -DCPPCHECK=1'
diff --git a/rkward/debug.h b/rkward/debug.h
index b3093b956..61a52ceb6 100644
--- a/rkward/debug.h
+++ b/rkward/debug.h
@@ -37,8 +37,11 @@ void RKDebug (int flags, int level, const char *fmt, ...);
 // Debug functions 
 #	define RK_DO(expr,flags,level) if ((flags & RK_Debug::RK_Debug_Flags) && (level >= RK_Debug::RK_Debug_Level)) { expr; }
 #	define RK_DEBUG(flags,level,...) { if ((flags & RK_Debug::RK_Debug_Flags) && (level >= RK_Debug::RK_Debug_Level)) RKDebug (flags,level,__VA_ARGS__); }
-// cppcheck-suppress-macro nullPointerRedundantCheck
+#if defined(CPPCHECK)
+#	define RK_ASSERT(x) assert(x) /* Keep it from complaining. Supressing nullPointerRedundantCheck does not appear to work. */
+#else
 #	define RK_ASSERT(x) if (!(x)) RK_DEBUG (DEBUG_ALL, DL_FATAL, "Assert '%s' failed at %s - function %s line %d", #x, __FILE__, __FUNCTION__, __LINE__);
+#endif
 #	ifndef RKWARD_NO_TRACE
 #		define RK_TRACE(flags) RK_DEBUG (flags, DL_TRACE, "Trace: %s - function %s line %d", __FILE__, __FUNCTION__, __LINE__);
 #	else



More information about the rkward-tracker mailing list