Go to the documentation of this file.
11 #ifndef vtk_m_Unreachable_h
12 #define vtk_m_Unreachable_h
31 #define VTKM_UNREACHABLE(msg) \
32 VTKM_SWALLOW_SEMICOLON_PRE_BLOCK \
34 VTKM_UNREACHABLE_IMPL(); \
35 VTKM_UNREACHABLE_PRINT(msg); \
36 VTKM_UNREACHABLE_ABORT(); \
38 VTKM_SWALLOW_SEMICOLON_POST_BLOCK
41 #if defined(VTKM_CUDA_DEVICE_PASS)
43 #define VTKM_UNREACHABLE_IMPL() (void)0
45 #if defined(NDEBUG) || defined(VTKM_NO_ASSERT)
47 #define VTKM_UNREACHABLE_PRINT(msg) (void)0
48 #define VTKM_UNREACHABLE_ABORT() (void)0
50 #else // NDEBUG || VTKM_NO_ASSERT
52 #define VTKM_UNREACHABLE_PRINT(msg) \
53 printf("Unreachable location reached: %s\nLocation: %s:%d\n", msg, __FILE__, __LINE__)
54 #define VTKM_UNREACHABLE_ABORT() \
57 #endif // NDEBUG || VTKM_NO_ASSERT
62 #if defined(NDEBUG) || defined(VTKM_NO_ASSERT)
64 #define VTKM_UNREACHABLE_PRINT(msg) (void)0
65 #define VTKM_UNREACHABLE_ABORT() (void)0
67 #if defined(VTKM_MSVC)
68 #define VTKM_UNREACHABLE_IMPL() __assume(false)
69 #elif defined(VTKM_ICC) && !defined(__GNUC__)
70 #define VTKM_UNREACHABLE_IMPL() __assume(false)
71 #elif (defined(VTKM_GCC) || defined(VTKM_ICC)) && \
72 (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
74 #define VTKM_UNREACHABLE_IMPL() __builtin_unreachable()
75 #elif defined(VTKM_CLANG)
76 #define VTKM_UNREACHABLE_IMPL() __builtin_unreachable()
78 #define VTKM_UNREACHABLE_IMPL() (void)0
81 #else // NDEBUG || VTKM_NO_ASSERT
83 #define VTKM_UNREACHABLE_IMPL() (void)0
84 #define VTKM_UNREACHABLE_PRINT(msg) \
85 std::cerr << "Unreachable location reached: " << msg << "\n" \
86 << "Location: " << __FILE__ << ":" << __LINE__ << "\n"
87 #define VTKM_UNREACHABLE_ABORT() abort()
89 #endif // NDEBUG && !VTKM_NO_ASSERT
93 #endif //vtk_m_Unreachable_h