coreboot: never, ever use Werror

not even once

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-04-23 20:29:38 +01:00
parent fedeb6ecd8
commit 2ecfe63b5f
7 changed files with 1265 additions and 0 deletions
@@ -0,0 +1,110 @@
From 5b214f3e1e3919c495d45c6f52884e323a987037 Mon Sep 17 00:00:00 2001
From: Leah Rowe <leah@libreboot.org>
Date: Thu, 23 Apr 2026 20:45:33 +0100
Subject: [PATCH 1/1] disable werror
Signed-off-by: Leah Rowe <leah@libreboot.org>
---
Makefile | 2 +-
tools/amlogic/Makefile | 2 +-
tools/fiptool/Makefile | 2 +-
tools/marvell/doimage/Makefile | 2 +-
tools/nxp/create_pbl/Makefile | 2 +-
tools/sptool/Makefile | 2 +-
tools/stm32image/Makefile | 2 +-
7 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/Makefile b/Makefile
index 530e6e0f5..b6f504d7c 100644
--- a/Makefile
+++ b/Makefile
@@ -274,7 +274,7 @@ WARNINGS += -Wshift-overflow -Wshift-sign-overflow \
endif #(Clang Warning)
ifneq (${E},0)
- ERRORS := -Werror
+ ERRORS :=
endif #(E)
################################################################################
diff --git a/tools/amlogic/Makefile b/tools/amlogic/Makefile
index cdaf7e711..576cf0ce6 100644
--- a/tools/amlogic/Makefile
+++ b/tools/amlogic/Makefile
@@ -14,7 +14,7 @@ include ${MAKE_HELPERS_DIRECTORY}toolchain.mk
PROJECT := doimage$(.exe)
OBJECTS := doimage.o
-HOSTCCFLAGS := -Wall -Werror -pedantic -std=c99 -D_GNU_SOURCE
+HOSTCCFLAGS := -Wall -pedantic -std=c99 -D_GNU_SOURCE
ifeq (${DEBUG},1)
HOSTCCFLAGS += -g -O0 -DDEBUG
diff --git a/tools/fiptool/Makefile b/tools/fiptool/Makefile
index a660a500e..479e72a9a 100644
--- a/tools/fiptool/Makefile
+++ b/tools/fiptool/Makefile
@@ -16,7 +16,7 @@ OBJECTS := fiptool.o tbbr_config.o
STATIC ?= 0
override CPPFLAGS += -D_GNU_SOURCE -D_XOPEN_SOURCE=700
-HOSTCCFLAGS := -Wall -Werror -pedantic -std=c99
+HOSTCCFLAGS := -Wall -pedantic -std=c99
ifeq (${DEBUG},1)
HOSTCCFLAGS += -g -O0 -DDEBUG
else
diff --git a/tools/marvell/doimage/Makefile b/tools/marvell/doimage/Makefile
index a4f7a1d89..852830a4e 100644
--- a/tools/marvell/doimage/Makefile
+++ b/tools/marvell/doimage/Makefile
@@ -10,7 +10,7 @@ include ../../../make_helpers/toolchain.mk
PROJECT = doimage
OBJECTS = doimage.o
-HOSTCCFLAGS = -Wall -Werror
+HOSTCCFLAGS = -Wall
ifeq (${DEBUG},1)
HOSTCCFLAGS += -g -O0 -DDEBUG
else
diff --git a/tools/nxp/create_pbl/Makefile b/tools/nxp/create_pbl/Makefile
index 9285b723e..57bbeaa0e 100644
--- a/tools/nxp/create_pbl/Makefile
+++ b/tools/nxp/create_pbl/Makefile
@@ -16,7 +16,7 @@ PROJECT_2 := byte_swap$(.exe)
OBJECTS_2 := byte_swap.o
override CPPFLAGS += -D_GNU_SOURCE -D_XOPEN_SOURCE=700
-CFLAGS := -Wall -Werror -pedantic -std=c99
+CFLAGS := -Wall -pedantic -std=c99
ifeq (${DEBUG},1)
CFLAGS += -g -O0 -DDEBUG
else
diff --git a/tools/sptool/Makefile b/tools/sptool/Makefile
index f579a42eb..7a847dd3f 100644
--- a/tools/sptool/Makefile
+++ b/tools/sptool/Makefile
@@ -14,7 +14,7 @@ PROJECT := $(notdir ${SPTOOL})
OBJECTS := sptool.o
override CPPFLAGS += -D_GNU_SOURCE -D_XOPEN_SOURCE=700
-HOSTCCFLAGS := -Wall -Werror -pedantic -std=c99
+HOSTCCFLAGS := -Wall -pedantic -std=c99
ifeq (${DEBUG},1)
HOSTCCFLAGS += -g -O0 -DDEBUG
else
diff --git a/tools/stm32image/Makefile b/tools/stm32image/Makefile
index 64b6ccfab..600662d74 100644
--- a/tools/stm32image/Makefile
+++ b/tools/stm32image/Makefile
@@ -12,7 +12,7 @@ include ${MAKE_HELPERS_DIRECTORY}toolchain.mk
PROJECT := stm32image$(.exe)
OBJECTS := stm32image.o
-HOSTCCFLAGS := -Wall -Werror -pedantic -std=c99 -D_GNU_SOURCE
+HOSTCCFLAGS := -Wall -pedantic -std=c99 -D_GNU_SOURCE
ifeq (${DEBUG},1)
HOSTCCFLAGS += -g -O0 -DDEBUG
--
2.47.3
@@ -0,0 +1,80 @@
From 228447a166be2743cc377c99968cad0df1cb4909 Mon Sep 17 00:00:00 2001
From: Leah Rowe <leah@libreboot.org>
Date: Thu, 23 Apr 2026 20:45:47 +0100
Subject: [PATCH 1/1] disable werror
Signed-off-by: Leah Rowe <leah@libreboot.org>
---
.ycm_extra_conf.py | 1 -
CompilerChecks.cmake | 23 -----------------------
2 files changed, 24 deletions(-)
diff --git a/.ycm_extra_conf.py b/.ycm_extra_conf.py
index 8305a8b..538bc2b 100644
--- a/.ycm_extra_conf.py
+++ b/.ycm_extra_conf.py
@@ -4,7 +4,6 @@ import ycm_core
flags = [
'-Wall',
'-Wextra',
-'-Werror',
'-x', 'c',
'-Iinclude',
]
diff --git a/CompilerChecks.cmake b/CompilerChecks.cmake
index e39cc1d..5fd39d8 100644
--- a/CompilerChecks.cmake
+++ b/CompilerChecks.cmake
@@ -2,20 +2,6 @@ include(AddCCompilerFlag)
include(CheckCCompilerFlagSSP)
if (UNIX)
- #
- # Check for -Werror turned on if possible
- #
- # This will prevent that compiler flags are detected incorrectly.
- #
- check_c_compiler_flag("-Werror" REQUIRED_FLAGS_WERROR)
- if (REQUIRED_FLAGS_WERROR)
- set(CMAKE_REQUIRED_FLAGS "-Werror")
-
- if (PICKY_DEVELOPER)
- list(APPEND SUPPORTED_COMPILER_FLAGS "-Werror")
- endif()
- endif()
-
add_c_compiler_flag("-std=gnu99" SUPPORTED_COMPILER_FLAGS)
add_c_compiler_flag("-Wpedantic" SUPPORTED_COMPILER_FLAGS)
add_c_compiler_flag("-Wall" SUPPORTED_COMPILER_FLAGS)
@@ -23,20 +9,12 @@ if (UNIX)
add_c_compiler_flag("-Wmissing-prototypes" SUPPORTED_COMPILER_FLAGS)
add_c_compiler_flag("-Wcast-align" SUPPORTED_COMPILER_FLAGS)
#add_c_compiler_flag("-Wcast-qual" SUPPORTED_COMPILER_FLAGS)
- add_c_compiler_flag("-Werror=address" SUPPORTED_COMPILER_FLAGS)
add_c_compiler_flag("-Wstrict-prototypes" SUPPORTED_COMPILER_FLAGS)
- add_c_compiler_flag("-Werror=strict-prototypes" SUPPORTED_COMPILER_FLAGS)
add_c_compiler_flag("-Wwrite-strings" SUPPORTED_COMPILER_FLAGS)
- add_c_compiler_flag("-Werror=write-strings" SUPPORTED_COMPILER_FLAGS)
- add_c_compiler_flag("-Werror-implicit-function-declaration" SUPPORTED_COMPILER_FLAGS)
add_c_compiler_flag("-Wpointer-arith" SUPPORTED_COMPILER_FLAGS)
- add_c_compiler_flag("-Werror=pointer-arith" SUPPORTED_COMPILER_FLAGS)
add_c_compiler_flag("-Wreturn-type" SUPPORTED_COMPILER_FLAGS)
- add_c_compiler_flag("-Werror=return-type" SUPPORTED_COMPILER_FLAGS)
add_c_compiler_flag("-Wuninitialized" SUPPORTED_COMPILER_FLAGS)
- add_c_compiler_flag("-Werror=uninitialized" SUPPORTED_COMPILER_FLAGS)
add_c_compiler_flag("-Wimplicit-fallthrough" SUPPORTED_COMPILER_FLAGS)
- add_c_compiler_flag("-Werror=strict-overflow" SUPPORTED_COMPILER_FLAGS)
add_c_compiler_flag("-Wstrict-overflow=2" SUPPORTED_COMPILER_FLAGS)
add_c_compiler_flag("-Wno-format-zero-length" SUPPORTED_COMPILER_FLAGS)
add_c_compiler_flag("-Wmissing-field-initializers" SUPPORTED_COMPILER_FLAGS)
@@ -47,7 +25,6 @@ if (UNIX)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Wformat")
endif()
add_c_compiler_flag("-Wformat-security" SUPPORTED_COMPILER_FLAGS)
- add_c_compiler_flag("-Werror=format-security" SUPPORTED_COMPILER_FLAGS)
# Allow zero for a variadic macro argument
string(TOLOWER "${CMAKE_C_COMPILER_ID}" _C_COMPILER_ID)
--
2.47.3
@@ -0,0 +1,26 @@
From 215db3c92bc21d6d07d9cd6e209f45d90298fda8 Mon Sep 17 00:00:00 2001
From: Leah Rowe <leah@libreboot.org>
Date: Thu, 23 Apr 2026 20:45:13 +0100
Subject: [PATCH 1/1] disable werror
Signed-off-by: Leah Rowe <leah@libreboot.org>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index fb4c43c..58e080e 100644
--- a/Makefile
+++ b/Makefile
@@ -45,7 +45,7 @@ GNATBIND = $(CROSS_COMPILE)gnatbind
GCC_MAJOR = $(shell echo __GNUC__ | $(CC) -E - 2>/dev/null | tail -1)
-CFLAGS += -Wuninitialized -Wall -Werror
+CFLAGS += -Wuninitialized -Wall
CFLAGS += -pipe -g
CFLAGS += -Wstrict-aliasing -Wshadow
CFLAGS += -fno-common -fomit-frame-pointer
--
2.47.3
@@ -0,0 +1,48 @@
From 9ea31d19a31c4fa40e386c104286dd76d60260bb Mon Sep 17 00:00:00 2001
From: Leah Rowe <leah@libreboot.org>
Date: Thu, 23 Apr 2026 20:46:37 +0100
Subject: [PATCH 1/1] disable werror
Signed-off-by: Leah Rowe <leah@libreboot.org>
---
Android.bp | 1 -
Makefile | 4 ++--
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/Android.bp b/Android.bp
index dec72cc8..1974a1a2 100644
--- a/Android.bp
+++ b/Android.bp
@@ -9,7 +9,6 @@ cc_defaults {
cflags: [
"-Wall",
- "-Werror",
"-Wstrict-prototypes",
"-Wtype-limits",
"-Wundef",
diff --git a/Makefile b/Makefile
index 67af60d4..cdc63c5e 100644
--- a/Makefile
+++ b/Makefile
@@ -113,7 +113,7 @@ endif
# Provide default CC and CFLAGS for firmware builds; if you have any -D flags,
# please add them after this point (e.g., -DVBOOT_DEBUG).
DEBUG_FLAGS := $(if $(filter-out 0,${DEBUG}),-g -Og,-g -Os)
-WERROR := -Werror
+WERROR :=
FIRMWARE_FLAGS := -nostdinc -ffreestanding -fno-builtin -fno-stack-protector
COMMON_FLAGS := -pipe ${WERROR} -Wall -Wstrict-prototypes -Wtype-limits \
-Wundef -Wmissing-prototypes -Wno-trigraphs -Wredundant-decls -Wshadow \
@@ -127,7 +127,7 @@ COMMON_FLAGS := -pipe ${WERROR} -Wall -Wstrict-prototypes -Wtype-limits \
# returns: $(1) if compiler was successful, empty string otherwise
test_ccflag = $(shell \
printf "$(2)\nvoid _start(void) {}\n" | \
- $(CC) -nostdlib -Werror $(1) -xc -c - -o /dev/null \
+ $(CC) -nostdlib $(1) -xc -c - -o /dev/null \
>/dev/null 2>&1 && echo "$(1)")
COMMON_FLAGS += $(call test_ccflag,-Wimplicit-fallthrough)
--
2.47.3