forked from spack/spack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In spack#30882, we made Spack ignore `-Werror` calls so that it could more easily build projects that inject `-Werror` into their builds. We did this by translating them to `-Wno-error` in the compiler wrapper. However, some compilers (like `nvhpc`) do not support `-Wno-error`. We need to exclude them from this feature until they do. - [x] make a property on `PackageBase` for `keep_werror` that knows not to use it for `nvhpc`. - [x] update property so that it keeps only the specific `-Werror=...` args for newer nvhpc's, which support `-Wno-error` but not `-Wno-error=...` --------- Co-authored-by: William Mou <[email protected]> Co-authored-by: Tom Scogland <[email protected]> Signed-off-by: Todd Gamblin <[email protected]>
- Loading branch information
1 parent
259629c
commit 89a0c9f
Showing
2 changed files
with
31 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -621,10 +621,6 @@ class PackageBase(WindowsRPath, PackageViewMixin, RedistributionMixin, metaclass | |
#: By default do not run tests within package's install() | ||
run_tests = False | ||
|
||
#: Keep -Werror flags, matches config:flags:keep_werror to override config | ||
# NOTE: should be type Optional[Literal['all', 'specific', 'none']] in 3.8+ | ||
keep_werror: Optional[str] = None | ||
|
||
#: Most packages are NOT extendable. Set to True if you want extensions. | ||
extendable = False | ||
|
||
|
@@ -930,6 +926,32 @@ def global_license_file(self): | |
self.global_license_dir, self.name, os.path.basename(self.license_files[0]) | ||
) | ||
|
||
# NOTE: return type should be Optional[Literal['all', 'specific', 'none']] in | ||
# Python 3.8+, but we still support 3.6. | ||
@property | ||
def keep_werror(self) -> Optional[str]: | ||
"""Keep ``-Werror`` flags, matches ``config:flags:keep_werror`` to override config. | ||
Valid return values are: | ||
* ``"all"``: keep all ``-Werror`` flags. | ||
* ``"specific"``: keep only ``-Werror=specific-warning`` flags. | ||
* ``"none"``: filter out all ``-Werror*`` flags. | ||
* ``None``: respect the user's configuration (``"none"`` by default). | ||
""" | ||
if self.spec.satisfies("%nvhpc@:23.3") or self.spec.satisfies("%pgi"): | ||
# Filtering works by replacing -Werror with -Wno-error, but older nvhpc and | ||
# PGI do not understand -Wno-error, so we disable filtering. | ||
return "all" | ||
|
||
elif self.spec.satisfies("%[email protected]:"): | ||
# newer nvhpc supports -Wno-error but can't disable specific warnings with | ||
# -Wno-error=warning. Skip -Werror=warning, but still filter -Werror. | ||
return "specific" | ||
|
||
else: | ||
# use -Werror disablement by default for other compilers | ||
return None | ||
|
||
@property | ||
def version(self): | ||
if not self.spec.versions.concrete: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters