From 05ac717cf284deeb511fd5126f65996246831d90 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Tue, 23 Oct 2018 07:23:07 -0400 Subject: [PATCH] work around -Wcast-align=strict error with old GCC --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 3d58079..db4e8c1 100644 --- a/Makefile +++ b/Makefile @@ -2,8 +2,12 @@ CONFIG_CXX_ALLOCATOR := true CONFIG_UBSAN := false CONFIG_SEAL_METADATA := false +define safe_flag +$(shell $(CC) -E $1 - /dev/null && echo $1) +endef + CPPFLAGS := -D_GNU_SOURCE -SHARED_FLAGS := -O2 -flto -fPIC -fvisibility=hidden -fno-plt -pipe -Wall -Wextra -Wcast-align=strict -Wcast-qual -Wwrite-strings +SHARED_FLAGS := -O2 -flto -fPIC -fvisibility=hidden -fno-plt -pipe -Wall -Wextra $(call safe_flag,-Wcast-align=strict) -Wcast-qual -Wwrite-strings CFLAGS := -std=c11 $(SHARED_FLAGS) -Wmissing-prototypes CXXFLAGS := -std=c++14 $(SHARED_FLAGS) LDFLAGS := -Wl,-z,defs,-z,relro,-z,now,-z,nodlopen,-z,text