multipath-tools: check for C compiler option -Werror=discarded-qualifiers
authorMauricio Faria de Oliveira <mfo@canonical.com>
Mon, 30 Jul 2018 19:37:45 +0000 (16:37 -0300)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Tue, 7 Aug 2018 13:29:38 +0000 (15:29 +0200)
The -Werror=discarded-qualifiers option is not supported on GCC 4.8
(ships in Ubuntu 14.04 at least). Use TEST_CC_OPTION to detect that
and fix a build failure.

No regression on Ubuntu 18.04 (GCC 7.3, -Werror=discarded-qualifiers
used).

Fixes: ff307801
"multipath-tools: Makefile.inc: use -Werror=cast-qual"

Signed-off-by: Mauricio Faria de Oliveira <mfo@canonical.com>
Makefile.inc

index a12b46e..a83f02c 100644 (file)
@@ -86,11 +86,12 @@ TEST_CC_OPTION = $(shell \
        fi)
 
 STACKPROT := $(call TEST_CC_OPTION,-fstack-protector-strong,-fstack-protector)
+ERROR_DISCARDED_QUALIFIERS := $(call TEST_CC_OPTION,-Werror=discarded-qualifiers,)
 
 OPTFLAGS       = -O2 -g -pipe -Wall -Wextra -Wformat=2 -Werror=implicit-int \
                  -Werror=implicit-function-declaration -Werror=format-security \
                  -Wno-sign-compare -Wno-unused-parameter -Wno-clobbered \
-                 -Werror=cast-qual -Werror=discarded-qualifiers \
+                 -Werror=cast-qual $(ERROR_DISCARDED_QUALIFIERS) \
                  -Wp,-D_FORTIFY_SOURCE=2 $(STACKPROT) \
                  --param=ssp-buffer-size=4