Viskores  1.0
Macros
Unreachable.h File Reference

Go to the source code of this file.

Macros

#define VISKORES_UNREACHABLE(msg)
 VISKORES_UNREACHABLE is similar to VTK_ASSUME, with the significant difference that it is not conditional. More...
 
#define VISKORES_UNREACHABLE_IMPL()   (void)0
 
#define VISKORES_UNREACHABLE_PRINT(msg)
 
#define VISKORES_UNREACHABLE_ABORT()   abort()
 

Macro Definition Documentation

◆ VISKORES_UNREACHABLE

#define VISKORES_UNREACHABLE (   msg)
Value:
{ \
VISKORES_UNREACHABLE_IMPL(); \
VISKORES_UNREACHABLE_PRINT(msg); \
VISKORES_UNREACHABLE_ABORT(); \
} \
VISKORES_SWALLOW_SEMICOLON_POST_BLOCK

VISKORES_UNREACHABLE is similar to VTK_ASSUME, with the significant difference that it is not conditional.

Control should never reach a path containing a VISKORES_UNREACHABLE statement under any circumstances.

If assertions are enabled (e.g. neither NDEBUG nor VISKORES_NO_ASSERT is defined), the following steps are taken:

  1. Print an error message containing the macro argument and location of the VISKORES_UNREACHABLE call.
  2. Abort the kernel (if CUDA) or process.

This allows bad code paths to be identified during development and debugging.

If assertions are disabled and the compiler has some sort of 'unreachable' intrinsic used to provide optimization hints, the intrinsic is used to notify the compiler that this is a dead code path.

◆ VISKORES_UNREACHABLE_ABORT

#define VISKORES_UNREACHABLE_ABORT ( )    abort()

◆ VISKORES_UNREACHABLE_IMPL

#define VISKORES_UNREACHABLE_IMPL ( )    (void)0

◆ VISKORES_UNREACHABLE_PRINT

#define VISKORES_UNREACHABLE_PRINT (   msg)
Value:
std::cerr << "Unreachable location reached: " << msg << "\n" \
<< "Location: " << __FILE__ << ":" << __LINE__ << "\n"
VISKORES_SWALLOW_SEMICOLON_PRE_BLOCK
#define VISKORES_SWALLOW_SEMICOLON_PRE_BLOCK
Definition: Configure.h:360