From 01c4d34e1a7ac836ed81b6a7d252b3eee797b0bd Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sun, 16 Jun 2024 16:06:38 +1000 Subject: [PATCH] chore: cppcheck 2.14.1 compatibility (#174) * chore: cppcheck 2.14.1 compatibility * chore: iwyu tidy * chore: cppcheck 2.14.1 compatibility * chore: cppcheck 2.14.1 compatibility --- GNUmakefile | 4 +++- bld/cppcheck.supp | 2 +- inc/fs.h | 2 +- src/fs.c | 1 + src/process.c | 1 + tst/tst-cfg-file.c | 3 ++- tst/tst-fs.c | 1 + tst/tst-layout.c | 2 -- 8 files changed, 10 insertions(+), 6 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 3080cd3a..6549099b 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -65,7 +65,9 @@ iwyu: clean $(SRC_O) $(TST_O) $(EXAMPLE_O) IWYU = include-what-you-use -Xiwyu --no_fwd_decls -Xiwyu --error=1 -Xiwyu --verbose=3 cppcheck: $(SRC_C) $(SRC_CXX) $(INC_H) $(EXAMPLE_C) $(TST_H) $(TST_C) - cppcheck $(^) --enable=warning,unusedFunction,performance,portability --suppressions-list=bld/cppcheck.supp --error-exitcode=1 $(CPPFLAGS) + # TODO: add --check-level=exhaustive when cppcheck ~2.14 is availble for CI + # cppcheck --enable=warning,unusedFunction,performance,portability --check-level=exhaustive --suppressions-list=bld/cppcheck.supp --error-exitcode=1 $(^) + cppcheck --enable=warning,unusedFunction,performance,portability --suppressions-list=bld/cppcheck.supp --error-exitcode=1 $(^) %-vg: VALGRIND = valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all --errors-for-leak-kinds=all --gen-suppressions=all --suppressions=bld/vg.supp %-vg: % ; diff --git a/bld/cppcheck.supp b/bld/cppcheck.supp index 6075d6c0..589de9a0 100644 --- a/bld/cppcheck.supp +++ b/bld/cppcheck.supp @@ -1,3 +1,3 @@ unusedFunction:lib/col/*c unusedFunction:tst/wrap-log.c -unusedFunction:tst/util.c +unusedFunction:pro/*h diff --git a/inc/fs.h b/inc/fs.h index e3c2ce3f..b960bf3d 100644 --- a/inc/fs.h +++ b/inc/fs.h @@ -2,7 +2,7 @@ #define FS_H #include -#include +#include bool mkdir_p(char *path, mode_t mode); diff --git a/src/fs.c b/src/fs.c index 95fe89c4..88d9635b 100644 --- a/src/fs.c +++ b/src/fs.c @@ -4,6 +4,7 @@ #include #include #include +#include #include "log.h" diff --git a/src/process.c b/src/process.c index 62b42ff9..ec35f3cb 100644 --- a/src/process.c +++ b/src/process.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include "process.h" diff --git a/tst/tst-cfg-file.c b/tst/tst-cfg-file.c index 73cfed1b..b94b8745 100644 --- a/tst/tst-cfg-file.c +++ b/tst/tst-cfg-file.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include "global.h" @@ -259,7 +260,7 @@ void cfg_file_write__existing(void **state) { FILE *f = fopen(cfg->file_path, "w"); assert_non_null(f); - assert_int_equal(fclose(f), 0); + fclose(f); char *expected = strdup("XXXX"); diff --git a/tst/tst-fs.c b/tst/tst-fs.c index 14c06a08..89dca423 100644 --- a/tst/tst-fs.c +++ b/tst/tst-fs.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include "log.h" diff --git a/tst/tst-layout.c b/tst/tst-layout.c index 64aae2e0..9fc03ca5 100644 --- a/tst/tst-layout.c +++ b/tst/tst-layout.c @@ -5,7 +5,6 @@ #include #include #include -#include #include #include @@ -16,7 +15,6 @@ #include "log.h" #include "mode.h" #include "slist.h" -#include "util.h" #include "wlr-output-management-unstable-v1.h" struct SList *order_heads(struct SList *order_name_desc, struct SList *heads);