[Skiboot] [PATCH] Allow warnings conditionally.

Alastair D'Silva alastair at d-silva.org
Wed Apr 20 16:35:02 AEST 2016


When building in CI, we want to see all potential problems noted by compilers & static analysers that masquerade as a compiler, rather than halting on the first one.
This is especially important as we tend to implement different/stricter/expensive checks compared to a typical compiler, and as such, these may not be visible when performing a normal build.

This patch conditionally allows compiler warnings by passing ALLOW_WARNINGS=1 as a make variable. The default behaviour remains to fault on the first warning.

Signed-off-by: Alastair D'Silva <alastair at d-silva.org>
---
 Makefile.main              | 6 ++++--
 external/gard/rules.mk     | 5 ++++-
 external/opal-prd/Makefile | 5 ++++-
 external/shared/Makefile   | 5 ++++-
 4 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/Makefile.main b/Makefile.main
index 30c22be..ae15112 100644
--- a/Makefile.main
+++ b/Makefile.main
@@ -27,8 +27,10 @@ CWARNS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
 	  -Wmissing-prototypes -Wmissing-declarations \
 	  -Wwrite-strings -Wcast-align \
 	  -Winit-self \
-	  -Wframe-larger-than=1024 \
-	  -Werror
+	  -Wframe-larger-than=1024
+ifneq ($(ALLOW_WARNINGS),1)
+CWARNS += -Werror
+endif
 
 # Host tools and options
 HOSTCC=gcc
diff --git a/external/gard/rules.mk b/external/gard/rules.mk
index f0086a2..3ecd597 100644
--- a/external/gard/rules.mk
+++ b/external/gard/rules.mk
@@ -1,6 +1,9 @@
 .DEFAULT_GOAL := all
 
-override CFLAGS += -O2 -Wall -Werror -I.
+override CFLAGS += -O2 -Wall -I.
+ifneq ($(ALLOW_WARNINGS),1)
+override CFLAGS += -Werror
+endif
 OBJS      = version.o gard.o
 LIBFLASH_OBJS     += libflash-file.o libflash-libflash.o libflash-libffs.o libflash-ecc.o libflash-blocklevel.o
 OBJS     += $(LIBFLASH_OBJS)
diff --git a/external/opal-prd/Makefile b/external/opal-prd/Makefile
index 3f34371..6964101 100644
--- a/external/opal-prd/Makefile
+++ b/external/opal-prd/Makefile
@@ -1,6 +1,9 @@
 CC = $(CROSS_COMPILE)gcc
 
-CFLAGS += -m64 -Werror -Wall -g2 -ggdb
+CFLAGS += -m64 -Wall -g2 -ggdb
+ifneq ($(ALLOW_WARNINGS),1)
+CFLAGS += -Werror
+endif
 LDFLAGS += -m64
 ASFLAGS = -m64
 CPPFLAGS += -I. -I../../include -I../../
diff --git a/external/shared/Makefile b/external/shared/Makefile
index ffc049f..d46181c 100644
--- a/external/shared/Makefile
+++ b/external/shared/Makefile
@@ -9,7 +9,10 @@ INCDIR = $(PREFIX)/include/libflash
 
 VERSION = $(shell ../../make_version.sh)
 
-CFLAGS += -m64 -Werror -Wall -g2 -ggdb -I. -fPIC
+CFLAGS += -m64 -Wall -g2 -ggdb -I. -fPIC
+ifneq ($(ALLOW_WARNINGS),1)
+CFLAGS += -Werror
+endif
 
 .PHONY: links
 links: libflash ccan common
-- 
2.5.5



More information about the Skiboot mailing list