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 <eschwartz93@gmail.com>
[eli: fix quoting style]
pull/12938/head
David Seifert 11 months ago committed by Eli Schwartz
parent 5e0a3073da
commit 0cd74c96f1
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
  1. 4
      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]

Loading…
Cancel
Save