Skip to content

Commit

Permalink
cuda: respect host compiler -Werror
Browse files Browse the repository at this point in the history
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]
  • Loading branch information
SoapGentoo authored and eli-schwartz committed Mar 6, 2024
1 parent 5e0a307 commit 0cd74c9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mesonbuild/compilers/cuda.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_
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:
Expand Down Expand Up @@ -708,7 +709,8 @@ def get_debug_args(self, is_debug: bool) -> T.List[str]:
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]
Expand Down

0 comments on commit 0cd74c9

Please sign in to comment.