Skip to content

Commit 0cd74c9

Browse files
SoapGentooeli-schwartz
authored andcommitted
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 <[email protected]> [eli: fix quoting style]
1 parent 5e0a307 commit 0cd74c9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

mesonbuild/compilers/cuda.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_
199199
level: self._to_host_flags(list(f for f in flags if f != '-Wpedantic'))
200200
for level, flags in host_compiler.warn_args.items()
201201
}
202+
self.host_werror_args = ['-Xcompiler=' + x for x in self.host_compiler.get_werror_args()]
202203

203204
@classmethod
204205
def _shield_nvcc_list_arg(cls, arg: str, listmode: bool = True) -> str:
@@ -708,7 +709,8 @@ def get_debug_args(self, is_debug: bool) -> T.List[str]:
708709
return cuda_debug_args[is_debug]
709710

710711
def get_werror_args(self) -> T.List[str]:
711-
return ['-Werror=cross-execution-space-call,deprecated-declarations,reorder']
712+
device_werror_args = ['-Werror=cross-execution-space-call,deprecated-declarations,reorder']
713+
return device_werror_args + self.host_werror_args
712714

713715
def get_warn_args(self, level: str) -> T.List[str]:
714716
return self.warn_args[level]

0 commit comments

Comments
 (0)