[Skiboot] [PATCH v2] Allow warnings conditionally.

Samuel Mendoza-Jonas sam at mendozajonas.com
Thu Apr 21 10:58:21 AEST 2016


On Thu, Apr 21, 2016 at 10:17:46AM +1000, alastair at au1.ibm.com wrote:
> From: Alastair D'Silva <alastair at d-silva.org>
> 
> 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

This doesn't apply on master, looks like it's because of Patrick's patch
3137d24 "pflash: Allow building under yocto" which snuck in before you.

>  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
> 
> _______________________________________________
> Skiboot mailing list
> Skiboot at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/skiboot



More information about the Skiboot mailing list