From 0182603609f289ec43baa95b9e98998cbf268d04 Mon Sep 17 00:00:00 2001 From: Tom Scogland Date: Wed, 23 Nov 2022 12:29:17 -0800 Subject: Control Werror by converting to Wno-error (#30882) Using `-Werror` is good practice for development and testing, but causes us a great deal of heartburn supporting multiple compiler versions, especially as newer compiler versions add warnings for released packages. This PR adds support for suppressing `-Werror` through spack's compiler wrappers. There are currently three modes for the `flags:keep_werror` setting: * `none`: (default) cancel all `-Werror`, `-Werror=*` and `-Werror-*` flags by converting them to `-Wno-error[=]*` flags * `specific`: preserve explicitly selected warnings as errors, such as `-Werror=format-truncation`, but reverse the blanket `-Werror` * `all`: keeps all `-Werror` flags These can be set globally in config.yaml, through the config command-line flags, or overridden by a particular package (some packages use Werror as a proxy for determining support for other compiler features). We chose to use this approach because: 1. removing `-Werror` flags entirely broke *many* build systems, especially autoconf based ones, because of things like checking `-Werror=feature` and making the assumption that if that did not error other flags related to that feature would also work 2. Attempting to preserve `-Werror` in some phases but not others caused similar issues 3. The per-package setting came about because some packages, even with all these protections, still use `-Werror` unsafely. Currently there are roughly 3 such packages known. --- var/spack/repos/builtin/packages/gcc/package.py | 1 + var/spack/repos/builtin/packages/rdma-core/package.py | 1 + 2 files changed, 2 insertions(+) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/gcc/package.py b/var/spack/repos/builtin/packages/gcc/package.py index d802a47d48..ee7b415cf0 100644 --- a/var/spack/repos/builtin/packages/gcc/package.py +++ b/var/spack/repos/builtin/packages/gcc/package.py @@ -29,6 +29,7 @@ class Gcc(AutotoolsPackage, GNUMirrorPackage): git = "git://gcc.gnu.org/git/gcc.git" list_url = "https://ftp.gnu.org/gnu/gcc/" list_depth = 1 + keep_werror = "all" maintainers = ["michaelkuhn", "alalazo"] diff --git a/var/spack/repos/builtin/packages/rdma-core/package.py b/var/spack/repos/builtin/packages/rdma-core/package.py index 017702f294..9d90b9a3bb 100644 --- a/var/spack/repos/builtin/packages/rdma-core/package.py +++ b/var/spack/repos/builtin/packages/rdma-core/package.py @@ -14,6 +14,7 @@ class RdmaCore(CMakePackage): homepage = "https://github.com/linux-rdma/rdma-core" url = "https://github.com/linux-rdma/rdma-core/releases/download/v17.1/rdma-core-17.1.tar.gz" libraries = ["librdmacm.so"] + keep_werror = "all" version("41.0", sha256="e0b7deb8a71f229796a0cfe0fa25192c530cd3d86b755b6b28d1a5986a77507b") version("40.0", sha256="8844edb71311e3212e55e28fa4bdc6e06dd6c7b839ed56ee4b606e4220d94ee8") -- cgit v1.2.3-60-g2f50