From 0cd74c96f1b58fe89ef9565ab40905d04538d7ed Mon Sep 17 00:00:00 2001 From: David Seifert Date: Wed, 6 Mar 2024 15:49:42 +0100 Subject: [PATCH] cuda: respect host compiler `-Werror` The cuda compiler also executes the host compiler and generally needs to know the host compiler flags. We did this for regular args but not for error args. We use `-Xcompiler=` since that's how nvcc tells the difference between args it uses itself for device code and args it passes to the host compiler. Signed-off-by: Eli Schwartz [eli: fix quoting style] --- mesonbuild/compilers/cuda.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mesonbuild/compilers/cuda.py b/mesonbuild/compilers/cuda.py index 0e2d94578..e17ba3f5f 100644 --- a/mesonbuild/compilers/cuda.py +++ b/mesonbuild/compilers/cuda.py @@ -199,6 +199,7 @@ class CudaCompiler(Compiler): level: self._to_host_flags(list(f for f in flags if f != '-Wpedantic')) for level, flags in host_compiler.warn_args.items() } + self.host_werror_args = ['-Xcompiler=' + x for x in self.host_compiler.get_werror_args()] @classmethod def _shield_nvcc_list_arg(cls, arg: str, listmode: bool = True) -> str: @@ -708,7 +709,8 @@ class CudaCompiler(Compiler): return cuda_debug_args[is_debug] def get_werror_args(self) -> T.List[str]: - return ['-Werror=cross-execution-space-call,deprecated-declarations,reorder'] + device_werror_args = ['-Werror=cross-execution-space-call,deprecated-declarations,reorder'] + return device_werror_args + self.host_werror_args def get_warn_args(self, level: str) -> T.List[str]: return self.warn_args[level]