From 9b44fc6def451ba4efda796e9f0865768ae6fc25 Mon Sep 17 00:00:00 2001 From: Stephan Lachnit Date: Sun, 10 Jul 2022 13:27:16 +0200 Subject: [PATCH] ci: fix static analyser with assertions Signed-off-by: Stephan Lachnit --- lib/gamemode_client.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/gamemode_client.h b/lib/gamemode_client.h index b6f7afd..b9f64fe 100644 --- a/lib/gamemode_client.h +++ b/lib/gamemode_client.h @@ -80,6 +80,8 @@ POSSIBILITY OF SUCH DAMAGE. #include #include +#include + #include static char internal_gamemode_client_error_string[512] = { 0 }; @@ -231,6 +233,9 @@ __attribute__((always_inline)) static inline const char *gamemode_error_string(v return internal_gamemode_client_error_string; } + /* Assert for static analyser that the function is not NULL */ + assert(REAL_internal_gamemode_error_string != NULL); + return REAL_internal_gamemode_error_string(); } @@ -254,6 +259,9 @@ int gamemode_request_start(void) return -1; } + /* Assert for static analyser that the function is not NULL */ + assert(REAL_internal_gamemode_request_start != NULL); + if (REAL_internal_gamemode_request_start() < 0) { #ifdef GAMEMODE_AUTO fprintf(stderr, "gamemodeauto: %s\n", gamemode_error_string()); @@ -280,6 +288,9 @@ int gamemode_request_end(void) return -1; } + /* Assert for static analyser that the function is not NULL */ + assert(REAL_internal_gamemode_request_end != NULL); + if (REAL_internal_gamemode_request_end() < 0) { #ifdef GAMEMODE_AUTO fprintf(stderr, "gamemodeauto: %s\n", gamemode_error_string());