From 9a1d86a9ac7384b332db498822585a2255f7d3e6 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Thu, 13 Jun 2019 20:45:49 +0200 Subject: [PATCH] btrfs-progs: build: disable -Waddress-of-packed-member by default Gcc 9 adds the flag to default warnings and this produces a lot of warnings that don't seem to be harmful as we know the address is aligned, but this could be hidden in the function call chain. It's still available under W=1. Issue: #180 Signed-off-by: David Sterba --- Makefile | 4 +++- Makefile.extrawarn | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 09c87263..c75df1cf 100644 --- a/Makefile +++ b/Makefile @@ -69,7 +69,9 @@ TOPDIR := . # Disable certain GCC 8 + glibc 2.28 warning for snprintf() # where string truncation for snprintf() is expected. -DISABLE_WARNING_FLAGS := $(call cc-disable-warning, format-truncation) +# For GCC9 disable address-of-packed (under W=1) +DISABLE_WARNING_FLAGS := $(call cc-disable-warning, format-truncation) \ + $(call cc-disable-warning, address-of-packed-member) # Common build flags CFLAGS = $(SUBST_CFLAGS) \ diff --git a/Makefile.extrawarn b/Makefile.extrawarn index 0c483785..9cd27917 100644 --- a/Makefile.extrawarn +++ b/Makefile.extrawarn @@ -54,6 +54,7 @@ warning-1 += $(call cc-option, -Wunused-but-set-variable) warning-1 += $(call cc-disable-warning, missing-field-initializers) warning-1 += $(call cc-disable-warning, format-truncation) warning-1 += $(call cc-disable-warning, sign-compare) +warning-2 += $(call cc-option, -Waddress-of-packed-member) warning-2 := -Waggregate-return warning-2 += -Wcast-align