Skip to content

Commit

Permalink
Suppress warning 940 for unreachable code in variant
Browse files Browse the repository at this point in the history
  • Loading branch information
wmaxey committed Mar 20, 2024
1 parent d032c85 commit 904fb3a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libcudacxx/include/cuda/std/detail/libcxx/include/variant
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,7 @@ struct __variant
_CUDA_VSTD::forward<_Vs>(__vs)...);
}

_CCCL_NV_DIAG_SUPPRESS(940) // Suppress no return at end of function
// This overload is needed to tell the compiler that the recursion is indeed limited
template <class _Visitor, class... _Vs, size_t... _ProcessedIndices, size_t... _UnprocessedIndices>
inline _LIBCUDACXX_HIDDEN _LIBCUDACXX_INLINE_VISIBILITY static constexpr decltype(auto) __visit_impl(
Expand All @@ -640,6 +641,7 @@ struct __variant
}
_LIBCUDACXX_UNREACHABLE();

This comment has been minimized.

Copy link
@miscco

miscco Mar 21, 2024

Collaborator

But it is right there 😿

This comment has been minimized.

Copy link
@wmaxey

wmaxey Mar 21, 2024

Author Member

It's the missing return in that code path. Haha

This comment has been minimized.

Copy link
@miscco

miscco Mar 21, 2024

Collaborator

For whatever reason it broke MSVC __assume(0) because that is what is used here to ensure that the compiler knows that this code path is unreachable

This comment has been minimized.

Copy link
@wmaxey

wmaxey Mar 21, 2024

Author Member

Likely NVCC noticed that this would generate a warning so it emitted it before MSVC. Now we might need to silence MSVC.

}
_CCCL_NV_DIAG_DEFAULT(940) // End suppression of no return at end of function

template <class _Visitor, class... _Vs>
inline _LIBCUDACXX_HIDDEN _LIBCUDACXX_INLINE_VISIBILITY static constexpr decltype(auto)
Expand Down

0 comments on commit 904fb3a

Please sign in to comment.