From 10483b882cd3ba9b97a715676176622bc5472618 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Sun, 28 Mar 2021 15:24:13 +0200 Subject: [PATCH] Add cppcheck in Makefile --- src/Makefile | 8 +++++++- src/test.c | 2 -- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Makefile b/src/Makefile index 7cac3bc..6aa35e0 100644 --- a/src/Makefile +++ b/src/Makefile @@ -37,13 +37,19 @@ endif RM=rm -f OBJECT_FILES= trexio.o trexio_text.o trexio_hdf5.o +SOURCE_FILES= test.c trexio.c trexio_hdf5.c trexio_text.c HEADER_FILES= trexio.h trexio_text.h trexio_hdf5.h trexio_s.h export CC CFLAGS FC FFLAGS LIBS .PHONY: clean -libtrexio.so: $(OBJECT_FILES) $(HEADER_FILES) +cppcheck.out: $(HEADER_FILES) $(SOURCE_FILES) + cppcheck --addon=cert -q --error-exitcode=1 \ + --enable=style,warning,unusedFunction,performance,portability,missingInclude \ + --language=c -rp --std=c99 -v $(SOURCE_FILES) 2>$@ + +libtrexio.so: $(OBJECT_FILES) $(HEADER_FILES) cppcheck.out $(CC) -shared $(OBJECT_FILES) -o libtrexio.so fortran: libtrexio.so trexio_f.f90 diff --git a/src/test.c b/src/test.c index 37e3524..c6605fe 100644 --- a/src/test.c +++ b/src/test.c @@ -27,8 +27,6 @@ int test_h5write() { trexio_t* file = NULL; trexio_exit_code rc; - rc = TREXIO_SUCCESS; - int64_t num = 12; double coord[36] = {