Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
Fix missing abort in unreachable.h
Browse files Browse the repository at this point in the history
  • Loading branch information
wmaxey authored and miscco committed Feb 28, 2023
1 parent 4888737 commit bd8eee2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
10 changes: 5 additions & 5 deletions include/cuda/std/detail/libcxx/include/__utility/unreachable.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@

#ifndef __cuda_std__
#include <__config>
#include <cstdlib>
#endif // __cuda_std__


#if defined(_LIBCUDACXX_USE_PRAGMA_GCC_SYSTEM_HEADER)
#pragma GCC system_header
#endif

#ifndef _LIBCUDACXX_UNREACHABLE
#ifdef __GNUC__
# define _LIBCUDACXX_UNREACHABLE() __builtin_unreachable()
#elif __has_builtin(__builtin_unreachable)
Expand All @@ -27,10 +28,9 @@
#ifdef __CUDA_ARCH__
# define _LIBCUDACXX_UNREACHABLE() __trap()
#else
# define _LIBCUDACXX_UNREACHABLE() _CUDA_VSTD::abort()
#endif
#endif // has_builtin
#endif // !_LIBCUDACXX_UNREACHABLE
# define _LIBCUDACXX_UNREACHABLE() ::abort()
#endif // __CUDA_ARCH__
#endif // !__GNUC__

_LIBCUDACXX_BEGIN_NAMESPACE_STD

Expand Down
12 changes: 7 additions & 5 deletions include/cuda/std/detail/libcxx/include/cstdlib
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,16 @@ void *aligned_alloc(size_t alignment, size_t size); // C11
#endif

#ifdef __GNUC__
#define _LIBCUDACXX_UNREACHABLE() __builtin_unreachable()
# define _LIBCUDACXX_UNREACHABLE() __builtin_unreachable()
#elif __has_builtin(__builtin_unreachable)
# define _LIBCUDACXX_UNREACHABLE() __builtin_unreachable()
#else
#if defined(__CUDA_ARCH__)
#ifdef __CUDA_ARCH__
# define _LIBCUDACXX_UNREACHABLE() __trap()
#else
# define _LIBCUDACXX_UNREACHABLE() _CUDA_VSTD::abort()
#endif
#endif
# define _LIBCUDACXX_UNREACHABLE() ::abort()
#endif // __CUDA_ARCH__
#endif // !__GNUC__

#ifdef _LIBCUDACXX_COMPILER_PGI
#define _LIBCUDACXX_UNREACHABLE_AFTER_SWITCH()
Expand Down

0 comments on commit bd8eee2

Please sign in to comment.