From a12dfc9ee92722c3fdf9f9fbd358023bef7a6ed9 Mon Sep 17 00:00:00 2001 From: Steffen Eiden Date: Fri, 17 Feb 2023 15:12:46 +0100 Subject: [PATCH] Make -Werror optional MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enforcing `-Werror` can cause problems when compiling with newer compilers that have additional warnings on by default. By default `-Werror` is turned off and can be turned on via `ENABLE_WERROR=1`. Fixes: https://github.com/ibm-s390-linux/s390-tools/issues/148 Signed-off-by: Steffen Eiden Reviewed-by: Jan Höppner Signed-off-by: Jan Höppner (cherry picked from commit d3a3b26d16efdc4e9f896e616b5c8b7cac1b1a63) --- common.mak | 17 +++++++++++------ genprotimg/boot/Makefile | 2 +- genprotimg/src/Makefile | 2 +- libpv/Makefile | 1 - pvattest/src/Makefile | 1 - 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/common.mak b/common.mak index dbd1ebb..1d5e1a2 100644 --- a/common.mak +++ b/common.mak @@ -101,6 +101,10 @@ else DEFAULT_CFLAGS += -O3 endif +ifeq ("${ENABLE_WERROR}", "1") + DEFAULT_CFLAGS += -Werror +endif + DEFAULT_CPPFLAGS = -D_GNU_SOURCE DEFAULT_LDFLAGS = -rdynamic @@ -302,12 +306,13 @@ help: @echo ' clean Delete all generated files' @echo '' @echo 'OPTIONS' - @echo ' D=1 Build with debugging option "-Og"' - @echo ' C=1 Build with check tool defined with "CHECK=" (default=sparse)' - @echo ' G=1 Build with gcov to collect code coverage data' - @echo ' V=1 Generate verbose build output' - @echo ' W=1 Build with higher warning level' - @echo ' ASAN=1 Build with address sanitizer' + @echo ' D=1 Build with debugging option "-Og"' + @echo ' C=1 Build with check tool defined with "CHECK=" (default=sparse)' + @echo ' G=1 Build with gcov to collect code coverage data' + @echo ' V=1 Generate verbose build output' + @echo ' W=1 Build with higher warning level' + @echo ' ASAN=1 Build with address sanitizer' + @echo ' ENABLE_WERROR=1 Build with -Werror' @echo '' @echo 'EXAMPLES' @echo ' # make clean all D=1 W=1 -j' diff --git a/genprotimg/boot/Makefile b/genprotimg/boot/Makefile index b1b1421..6f3ae5c 100644 --- a/genprotimg/boot/Makefile +++ b/genprotimg/boot/Makefile @@ -15,7 +15,7 @@ ALL_CFLAGS := $(NO_PIE_CFLAGS) -Os -g \ -fno-delete-null-pointer-checks -fno-stack-protector \ -fexec-charset=IBM1047 -m64 -mpacked-stack \ -mstack-size=4096 -mstack-guard=128 -msoft-float \ - -Wall -Wformat-security -Wextra -Werror \ + -Wall -Wformat-security -Wextra \ -Wno-array-bounds FILES := stage3a.bin stage3b.bin stage3b_reloc.bin diff --git a/genprotimg/src/Makefile b/genprotimg/src/Makefile index 0e811d6..6c80ed2 100644 --- a/genprotimg/src/Makefile +++ b/genprotimg/src/Makefile @@ -17,7 +17,7 @@ WARNINGS := -Wall -Wextra -Wshadow \ -Wcast-align -Wwrite-strings -Wmissing-prototypes \ -Wmissing-declarations -Wredundant-decls -Wnested-externs \ -Wno-long-long -Wuninitialized -Wconversion -Wstrict-prototypes \ - -Wpointer-arith -Werror -Wno-error=inline \ + -Wpointer-arith -Wno-error=inline \ $(NULL) $(bin_PROGRAM)_SRCS := $(bin_PROGRAM).c pv/pv_stage3.c pv/pv_image.c \ diff --git a/libpv/Makefile b/libpv/Makefile index d9a1cff..5b518c7 100644 --- a/libpv/Makefile +++ b/libpv/Makefile @@ -28,7 +28,6 @@ WARNINGS := -Wall -Wextra -Wshadow \ -Wno-long-long -Wuninitialized -Wconversion -Wstrict-prototypes \ -Wpointer-arith -Wno-error=inline \ -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable \ - -Werror \ $(NULL) ALL_CFLAGS += -std=gnu11 \ diff --git a/pvattest/src/Makefile b/pvattest/src/Makefile index a1f0e1a..cd56af0 100644 --- a/pvattest/src/Makefile +++ b/pvattest/src/Makefile @@ -17,7 +17,6 @@ WARNINGS := -Wall -Wextra -Wshadow \ -Wno-long-long -Wuninitialized -Wconversion -Wstrict-prototypes \ -Wpointer-arith -Wno-error=inline \ -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable \ - -Werror \ $(NULL) PVATTEST_SRCS := $(wildcard *.c) \ -- 2.39.2