Skip to content

Commit

Permalink
handle Clang-CUDA (#2075)
Browse files Browse the repository at this point in the history
* do not require protection from macroized `new` for Clang in Cuda mode
* Don't check NVCC version if `__CUDACC_VER_MAJOR__` is not defined

which admits both clang-CUDA and `cl /showIncludes /D__CUDACC__` into the STL.
  • Loading branch information
fsb4000 committed Jan 6, 2022
1 parent 582735a commit 16251e3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions stl/inc/__msvc_all_public_headers.hpp
Expand Up @@ -13,9 +13,11 @@
#pragma warning(1 : 4668) // 'MEOW' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'

// All STL headers should protect themselves from macroized new.
#if !(defined(__CUDACC__) && defined(__clang__))
#pragma push_macro("new")
#undef new
#define new WILL NOT COMPILE
#endif // !(defined(__CUDACC__) && defined(__clang__))

// VSO-768746: mbctype.h macroizes _MS, _MP, _M1, and _M2. Include it first for test coverage.
#ifndef _MSVC_TESTING_NVCC
Expand Down Expand Up @@ -232,7 +234,9 @@
#endif // _M_CEE_PURE
#endif // _MSVC_TESTING_NVCC

#if !(defined(__CUDACC__) && defined(__clang__))
#pragma pop_macro("new")
#endif // !(defined(__CUDACC__) && defined(__clang__))

#pragma warning(pop)

Expand Down
2 changes: 1 addition & 1 deletion stl/inc/yvals_core.h
Expand Up @@ -584,7 +584,7 @@
#define _MSVC_STL_UPDATE 202112L

#ifndef _ALLOW_COMPILER_AND_STL_VERSION_MISMATCH
#ifdef __CUDACC__
#if defined(__CUDACC__) && defined(__CUDACC_VER_MAJOR__)
#if __CUDACC_VER_MAJOR__ < 10 \
|| (__CUDACC_VER_MAJOR__ == 10 \
&& (__CUDACC_VER_MINOR__ < 1 || (__CUDACC_VER_MINOR__ == 1 && __CUDACC_VER_BUILD__ < 243)))
Expand Down

0 comments on commit 16251e3

Please sign in to comment.