From abece7656bc9c6737417f01df186dba43f70e14c Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Sun, 18 Aug 2019 02:28:23 -0400 Subject: [PATCH] add enabled-by-default option to use -Werror --- Makefile | 5 +++++ README.md | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/Makefile b/Makefile index 3a8c460..30b2722 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,4 @@ +CONFIG_WERROR := true CONFIG_NATIVE := true CONFIG_CXX_ALLOCATOR := true CONFIG_UBSAN := false @@ -27,6 +28,10 @@ endef CPPFLAGS := $(CPPFLAGS) -D_GNU_SOURCE SHARED_FLAGS := -O3 -flto -fPIC -fvisibility=hidden $(call safe_flag,-fno-plt) $(call safe_flag,-fstack-clash-protection) -fstack-protector-strong -pipe -Wall -Wextra $(call safe_flag,-Wcast-align=strict,-Wcast-align) -Wcast-qual -Wwrite-strings +ifeq ($(CONFIG_WERROR),true) + SHARED_FLAGS += -Werror +endif + ifeq ($(CONFIG_NATIVE),true) SHARED_FLAGS += -march=native endif diff --git a/README.md b/README.md index cb40e2f..21c9874 100644 --- a/README.md +++ b/README.md @@ -168,6 +168,11 @@ even with all the optional features disabled. The following boolean configuration options are available: +* `CONFIG_WERROR`: `true` (default) or `false` to control whether compiler + warnings are treated as errors. This is highly recommended, but it can be + disabled to avoid patching the Makefile if a compiler version not tested by + the project is being used and has warnings. Investigating these warnings is + still recommended and the intention is to always be free of any warnings. * `CONFIG_NATIVE`: `true` (default) or `false` to control whether the code is optimized for the detected CPU on the host. If this is disabled, setting up a custom `-march` higher than the baseline architecture is highly recommended