From 66d67bcd9e1d27347645f8ada2129d1c96561a3f Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Tue, 6 Oct 2020 16:58:42 +0200 Subject: [PATCH] Makefile: add SANITIZE=1 to chase mem issues (host only) --- Makefile.defs | 6 ++++++ doc/md/Development/Makefile-vs-CMake.md | 3 +++ 2 files changed, 9 insertions(+) diff --git a/Makefile.defs b/Makefile.defs index b4dcfd0da..06eb2e36f 100644 --- a/Makefile.defs +++ b/Makefile.defs @@ -51,6 +51,12 @@ endif DEFCXXFLAGS = -Wall -Werror -O3 -pipe DEFCFLAGS = -Wall -Werror -O3 -fstrict-aliasing -pipe DEFLDFLAGS = +# Next ones are activated only if SANITIZE=1 +ifeq ($(SANITIZE),1) + DEFCFLAGS += -g -fsanitize=address -fno-omit-frame-pointer + DEFCXXFLAGS += -g -fsanitize=address -fno-omit-frame-pointer + DEFLDFLAGS += -g -fsanitize=address +endif # Some more warnings we want as errors: DEFCFLAGS += -Wbad-function-cast -Wredundant-decls -Wmissing-prototypes -Wchar-subscripts -Wshadow -Wundef -Wwrite-strings -Wunused -Wuninitialized -Wpointer-arith -Winline -Wformat -Wformat-security -Winit-self -Wmissing-include-dirs -Wnested-externs -Wmissing-declarations -Wempty-body -Wignored-qualifiers -Wmissing-field-initializers -Wtype-limits -Wold-style-definition # Some more warnings we need first to eliminate, so temporarely tolerated: diff --git a/doc/md/Development/Makefile-vs-CMake.md b/doc/md/Development/Makefile-vs-CMake.md index 649b9beaa..314cd1e7a 100644 --- a/doc/md/Development/Makefile-vs-CMake.md +++ b/doc/md/Development/Makefile-vs-CMake.md @@ -15,6 +15,9 @@ At the moment both are maintained because they don't perfectly overlap yet. |-----|---|---|---| | verbose | V=1 | VERBOSE=1 | | | warnings management | yes (1) | **no** | (1) cf Makefile.defs | +| extra GCC warnings | GCCEXTRA=1 | **no** | | +| extra Clang warnings | CLANGEXTRA=1 | **no** | only on host | +| AddressSanitize | SANITIZE=1 | **no** | only on host | | compilation | in place | in build dir | | | user `CFLAGS`/`LDFLAGS` | envvars honored (1) | envvars honored (2) | (1) also `LDLIBS` and `INCLUDES_CLIENT` for more tuning (2) only at first cmake call | | Mingw gnu printf | `_ISOC99_SOURCE` | `_ISOC99_SOURCE` | and in cbor.h: `__attribute__((format (__MINGW_PRINTF_FORMAT, 2, 3)))`|