From 3fd0f940408fc01a2c52c5be5f2beb0218a3d907 Mon Sep 17 00:00:00 2001 From: Valentin David Date: Wed, 28 Sep 2022 21:43:36 +0200 Subject: [PATCH] Allow disabling of -Werror For distro maintainers having `-Werror` can delay update of GCC. Since every GCC release might add new warnings that were not yet captured, it might break the build of packages. With this, distros can now build with `NOWERROR=TRUE` instead of patching either the errors or the makefiles. The default behavior keeps on using `-Werror`. Fixes #798 --- generate/efi/Makefile.config | 6 +++++- generate/unix/Makefile.config | 5 ++++- generate/unix/iasl/Makefile | 22 ++++++++++++++-------- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/generate/efi/Makefile.config b/generate/efi/Makefile.config index ada0be211..da49657bd 100644 --- a/generate/efi/Makefile.config +++ b/generate/efi/Makefile.config @@ -150,7 +150,6 @@ CWARNINGFLAGS = \ -Wall\ -Wbad-function-cast\ -Wdeclaration-after-statement\ - -Werror\ -Wformat=2\ -Wmissing-declarations\ -Wmissing-prototypes\ @@ -162,6 +161,11 @@ CWARNINGFLAGS = \ -Wmissing-parameter-type\ -Wold-style-declaration\ -Wtype-limits + +ifneq ($(NOWERROR),TRUE) +CWARNINGFLAGS += -Werror +endif + # # Extra warning flags (for possible future use) # diff --git a/generate/unix/Makefile.config b/generate/unix/Makefile.config index b46634367..0deeb1411 100644 --- a/generate/unix/Makefile.config +++ b/generate/unix/Makefile.config @@ -203,7 +203,6 @@ CWARNINGFLAGS = \ -Wall\ -Wbad-function-cast\ -Wdeclaration-after-statement\ - -Werror\ -Wformat=2\ -Wmissing-declarations\ -Wmissing-prototypes\ @@ -213,6 +212,10 @@ CWARNINGFLAGS = \ -Wpointer-arith\ -Wundef +ifneq ($(NOWERROR),TRUE) +CWARNINGFLAGS += -Werror +endif + # # Common gcc 4+ warning flags # diff --git a/generate/unix/iasl/Makefile b/generate/unix/iasl/Makefile index 47ea73cab..6eb25e01a 100644 --- a/generate/unix/iasl/Makefile +++ b/generate/unix/iasl/Makefile @@ -290,6 +290,12 @@ CFLAGS += \ -I$(ASL_COMPILER)\ -I$(OBJDIR) +ifeq ($(NOWERROR),TRUE) +WERROR_FLAGS= +else +WERROR_FLAGS=-Werror +endif + # # Common Rules # @@ -360,32 +366,32 @@ $(OBJDIR)/prparserparse.c $(OBJDIR)/prparser.y.h : $(ASL_COMPILER)/prparse # $(OBJDIR)/aslcompilerlex.o : $(OBJDIR)/aslcompilerlex.c @echo "- " "Intermediate" $< - @$(CC) -c $(CFLAGS) -Wall -Werror -o$@ $< + @$(CC) -c $(CFLAGS) -Wall $(WERROR_FLAGS) -o$@ $< $(OBJDIR)/aslcompilerparse.o : $(OBJDIR)/aslcompilerparse.c @echo "- " "Intermediate" $< - @$(CC) -c $(CFLAGS) -Wall -Werror -o$@ $< + @$(CC) -c $(CFLAGS) -Wall $(WERROR_FLAGS) -o$@ $< $(OBJDIR)/dtcompilerparserlex.o : $(OBJDIR)/dtcompilerparserlex.c @echo "- " "Intermediate" $< - @$(CC) -c $(CFLAGS) -Wall -Werror -o$@ $< + @$(CC) -c $(CFLAGS) -Wall $(WERROR_FLAGS) -o$@ $< $(OBJDIR)/dtcompilerparserparse.o : $(OBJDIR)/dtcompilerparserparse.c @echo "- " "Intermediate" $< - @$(CC) -c $(CFLAGS) -Wall -Werror -o$@ $< + @$(CC) -c $(CFLAGS) -Wall $(WERROR_FLAGS) -o$@ $< $(OBJDIR)/dtparserlex.o : $(OBJDIR)/dtparserlex.c @echo "- " "Intermediate" $< - @$(CC) -c $(CFLAGS) -Wall -Werror -o$@ $< + @$(CC) -c $(CFLAGS) -Wall $(WERROR_FLAGS) -o$@ $< $(OBJDIR)/dtparserparse.o : $(OBJDIR)/dtparserparse.c @echo "- " "Intermediate" $< - @$(CC) -c $(CFLAGS) -Wall -Werror -o$@ $< + @$(CC) -c $(CFLAGS) -Wall $(WERROR_FLAGS) -o$@ $< $(OBJDIR)/prparserlex.o : $(OBJDIR)/prparserlex.c @echo "- " "Intermediate" $< - @$(CC) -c $(CFLAGS) -Wall -Werror -o$@ $< + @$(CC) -c $(CFLAGS) -Wall $(WERROR_FLAGS) -o$@ $< $(OBJDIR)/prparserparse.o : $(OBJDIR)/prparserparse.c @echo "- " "Intermediate" $< - @$(CC) -c $(CFLAGS) -Wall -Werror -o$@ $< + @$(CC) -c $(CFLAGS) -Wall $(WERROR_FLAGS) -o$@ $<