diff --git a/Makefile b/Makefile index ee1fc139..29a4ee9e 100644 --- a/Makefile +++ b/Makefile @@ -62,6 +62,10 @@ DEBUG_LDFLAGS := ABSTOPDIR = $(shell pwd) 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) + # Common build flags CFLAGS = $(SUBST_CFLAGS) \ $(CSTD) \ @@ -73,6 +77,7 @@ CFLAGS = $(SUBST_CFLAGS) \ -I$(TOPDIR) \ -I$(TOPDIR)/kernel-lib \ -I$(TOPDIR)/libbtrfsutil \ + $(DISABLE_WARNING_FLAGS) \ $(EXTRAWARN_CFLAGS) \ $(DEBUG_CFLAGS_INTERNAL) \ $(EXTRA_CFLAGS) diff --git a/Makefile.extrawarn b/Makefile.extrawarn index 9c88950e..e084ac61 100644 --- a/Makefile.extrawarn +++ b/Makefile.extrawarn @@ -52,6 +52,7 @@ warning-1 += -Wold-style-definition warning-1 += $(call cc-option, -Wmissing-include-dirs) 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-2 := -Waggregate-return warning-2 += -Wcast-align @@ -60,6 +61,7 @@ warning-2 += -Wnested-externs warning-2 += -Wshadow warning-2 += $(call cc-option, -Wlogical-op) warning-2 += $(call cc-option, -Wmissing-field-initializers) +warning-2 += $(call cc-option, -Wformat-truncation) warning-3 := -Wbad-function-cast warning-3 += -Wcast-qual