[PATCH 0/2] disable -Werror by default

6 views
Skip to first unread message

Nathan Lynch

<nathanl@linux.ibm.com>
unread,
Jan 4, 2023, 3:02:56 PM1/4/23
to powerpc-utils-devel@googlegroups.com, tyreld@linux.ibm.com, glaubitz@physik.fu-berlin.de
Making -Werror a default build flag can work OK for projects with the
resources to track new compiler versions and promptly address new
warnings as they arise. But doing it in a project like powerpc-utils
mostly results in pushing the burden of addressing the warnings (most
of which are quite minor or benign) to distro packagers as they update
their toolchains.

We can avoid introducing new warnings in the configurations built by
the CI while improving the packaging experience for downstreams.

Nathan Lynch (2):
CI: enable -Werror for builds
configure.ac: disable -Werror by default

.github/workflows/main.yml | 4 ++--
configure.ac | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)

--
2.39.0

Nathan Lynch

<nathanl@linux.ibm.com>
unread,
Jan 4, 2023, 3:02:57 PM1/4/23
to powerpc-utils-devel@googlegroups.com, tyreld@linux.ibm.com, glaubitz@physik.fu-berlin.de
Enabling -Werror should be opt-in and done only in known
environments (e.g. a seldom-changing build configuration in
CI). Making -Werror the default for our build configuration causes
more pain for downstream projects than it's worth. It remains enabled
in the project CI (see previous commit).

Signed-off-by: Nathan Lynch <nat...@linux.ibm.com>
---
configure.ac | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 2872ce965801..d581f3184e45 100644
--- a/configure.ac
+++ b/configure.ac
@@ -98,14 +98,14 @@ AM_CONDITIONAL(WITH_SYSTEMD, [test "$with_systemd" = 1])
AC_SUBST(systemd_unit_dir)

AC_ARG_ENABLE([werror],
- AS_HELP_STRING([--disable-werror], [avoid treating compiler warnings as fatal errors]))
+ AS_HELP_STRING([--enable-werror], [treat compiler warnings as fatal errors]))

AC_DEFUN([LOCAL_CHECK_FLAGS],[
AC_REQUIRE([AX_CHECK_LINK_FLAG])
AC_REQUIRE([AX_APPEND_COMPILE_FLAGS])
AC_LANG_PUSH([C])
AX_APPEND_COMPILE_FLAGS([-Wall])
- AS_IF([test "x$enable_werror" != "xno"], [AX_APPEND_COMPILE_FLAGS([-Werror])])
+ AS_IF([test "x$enable_werror" == "xyes"], [AX_APPEND_COMPILE_FLAGS([-Werror])])
AX_APPEND_COMPILE_FLAGS([-D_FORTIFY_SOURCE=2 -fstack-protector-all])
AX_APPEND_COMPILE_FLAGS([-fwrapv -fPIE -Wstack-protector])
AX_APPEND_COMPILE_FLAGS([--param=ssp-buffer-size=1])
--
2.39.0

Tyrel Datwyler

<tyreld@linux.ibm.com>
unread,
Jan 4, 2023, 7:35:54 PM1/4/23
to Nathan Lynch, powerpc-utils-devel@googlegroups.com, glaubitz@physik.fu-berlin.de
Reply all
Reply to author
Forward
0 new messages