Raise UnsupportedCompilerFlag when a flag is not supported
This commit is contained in:
parent
ecd13e2df8
commit
df92dad225
@ -15,6 +15,8 @@
|
||||
import llnl.util.tty as tty
|
||||
from llnl.util.lang import classproperty, memoized
|
||||
|
||||
import spack
|
||||
import spack.compilers.error
|
||||
import spack.compilers.libraries
|
||||
import spack.config
|
||||
import spack.package_base
|
||||
@ -167,12 +169,13 @@ def determine_variants(cls, exes: Sequence[Path], version_str: str) -> Tuple:
|
||||
def standard_flag(self, *, language: str, standard: str) -> str:
|
||||
"""Returns the flag used to enforce a given standard for a language"""
|
||||
if language not in self.supported_languages:
|
||||
# FIXME (compiler as nodes): Use UnsupportedCompilerFlag ?
|
||||
raise RuntimeError(f"{self.spec} does not provide the '{language}' language")
|
||||
raise spack.compilers.error.UnsupportedCompilerFlag(
|
||||
f"{self.spec} does not provide the '{language}' language"
|
||||
)
|
||||
try:
|
||||
return self._standard_flag(language=language, standard=standard)
|
||||
except (KeyError, RuntimeError) as e:
|
||||
raise RuntimeError(
|
||||
raise spack.compilers.error.UnsupportedCompilerFlag(
|
||||
f"{self.spec} does not provide the '{language}' standard {standard}"
|
||||
) from e
|
||||
|
||||
|
@ -14,10 +14,6 @@ def __init__(self, compiler, paths):
|
||||
|
||||
|
||||
class UnsupportedCompilerFlag(SpackError):
|
||||
def __init__(self, compiler, feature, flag_name, ver_string=None):
|
||||
super().__init__(
|
||||
f"{compiler.name} ({ver_string if ver_string else compiler.version}) does not support"
|
||||
f" {feature} (as compiler.{flag_name}). If you think it should, please edit the "
|
||||
f"compiler.{compiler.name} subclass to implement the {flag_name} property and submit "
|
||||
f"a pull request or issue."
|
||||
)
|
||||
"""Raised when a compiler does not support a flag type (e.g. a flag to enforce a
|
||||
language standard).
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user