From d03a732c81522870e238f8d55be4ee1f8b294501 Mon Sep 17 00:00:00 2001 From: leitner Date: Mon, 19 Feb 2024 13:01:40 +0000 Subject: [PATCH] add sanitizers to unit test runs remove unnecessary stdlib.h include in json.c --- GNUmakefile | 2 +- Makefile | 4 +--- json.c | 1 - 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 6359a10..0852867 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1400,7 +1400,7 @@ UNITTESTS=$(shell grep -l UNITTEST */*.c) TESTS=$(patsubst %.c,test_%,$(notdir $(UNITTESTS))) test_%: %.c - $(CC) -g -o $@ $< -DUNITTEST -I. -fprofile-arcs -ftest-coverage $(LDFLAGS) + $(CC) -g -o $@ $< -DUNITTEST -I. -fprofile-arcs -ftest-coverage -fsanitize=undefined -fsanitize=address $(LDFLAGS) ./$@ rm -f $@ diff --git a/Makefile b/Makefile index 71b77b3..057ee0f 100644 --- a/Makefile +++ b/Makefile @@ -1338,7 +1338,7 @@ UNITTESTS=$(shell grep -l UNITTEST */*.c) TESTS=$(patsubst %.c,test_%,$(notdir $(UNITTESTS))) test_%: - $(CC) -g -o $@ $< -DUNITTEST -I. -fprofile-arcs -ftest-coverage $(LDFLAGS) + $(CC) -g -o $@ $< -DUNITTEST -I. -fprofile-arcs -ftest-coverage -fsanitize=undefined -fsanitize=address $(LDFLAGS) ./$@ rm -f $@ @@ -1354,8 +1354,6 @@ srcfiles=$(foreach dir,$(srcdirs),$(wildcard $(dir)/*.c)) compile_commands.json.tmpl: json ./json $(srcfiles) > $@ -# for i in $(ALL_OBJS); do foo="{ \"directory\": \".\", \"file\": \" -# echo "[ > $@ compile_commands.json: compile_commands.json.tmpl sed -e 's#"@"#"$(PWD)"#' < $< > $@ diff --git a/json.c b/json.c index 313875a..ee9ec46 100644 --- a/json.c +++ b/json.c @@ -1,7 +1,6 @@ #include #include #include -#include int main(int argc,char* argv[]) { int i;