Skip to content

Commit

Permalink
chore: cppcheck 2.14.1 compatibility (#174)
Browse files Browse the repository at this point in the history
* chore: cppcheck 2.14.1 compatibility

* chore: iwyu tidy

* chore: cppcheck 2.14.1 compatibility

* chore: cppcheck 2.14.1 compatibility
  • Loading branch information
alex-courtis authored Jun 16, 2024
1 parent f806b30 commit 01c4d34
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 6 deletions.
4 changes: 3 additions & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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: % ;
Expand Down
2 changes: 1 addition & 1 deletion bld/cppcheck.supp
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
unusedFunction:lib/col/*c
unusedFunction:tst/wrap-log.c
unusedFunction:tst/util.c
unusedFunction:pro/*h
2 changes: 1 addition & 1 deletion inc/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define FS_H

#include <stdbool.h>
#include <sys/stat.h>
#include <sys/types.h>

bool mkdir_p(char *path, mode_t mode);

Expand Down
1 change: 1 addition & 0 deletions src/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>

#include "log.h"

Expand Down
1 change: 1 addition & 0 deletions src/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <stdlib.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>

#include "process.h"
Expand Down
3 changes: 2 additions & 1 deletion tst/tst-cfg-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>

#include "global.h"
Expand Down Expand Up @@ -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");

Expand Down
1 change: 1 addition & 0 deletions tst/tst-fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <cmocka.h>
#include <errno.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>

#include "log.h"
Expand Down
2 changes: 0 additions & 2 deletions tst/tst-layout.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <wayland-client-protocol.h>
#include <wayland-util.h>

Expand All @@ -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);
Expand Down

0 comments on commit 01c4d34

Please sign in to comment.