Index: libomptarget/src/interface.cpp =================================================================== --- libomptarget/src/interface.cpp +++ libomptarget/src/interface.cpp @@ -55,7 +55,7 @@ switch (TargetOffloadPolicy) { case tgt_disabled: if (success) { - FatalMessage(1, "expected no offloading while offloading is disabled"); + FATAL_MESSAGE0(1, "expected no offloading while offloading is disabled"); } break; case tgt_default: @@ -64,7 +64,7 @@ break; case tgt_mandatory: if (!success) { - FatalMessage(1, "failure of target construct while offloading is mandatory"); + FATAL_MESSAGE0(1, "failure of target construct while offloading is mandatory"); } break; } Index: libomptarget/src/omptarget.cpp =================================================================== --- libomptarget/src/omptarget.cpp +++ libomptarget/src/omptarget.cpp @@ -26,23 +26,6 @@ int DebugLevel = 0; #endif // OMPTARGET_DEBUG -//////////////////////////////////////////////////////////////////////////////// -/// support for fatal messages - -// mutex -std::mutex LibomptargetPrintMtx; - -void FatalMessage(const int errorNum, const char *fmt, ...) { - va_list args; - va_start(args, fmt); - LibomptargetPrintMtx.lock(); - fprintf(stderr, "Libomptarget error %d:", errorNum); - vfprintf(stderr, fmt, args); - fprintf(stderr, "\n"); - LibomptargetPrintMtx.unlock(); - va_end(args); - exit(1); -} /* All begin addresses for partially mapped structs must be 8-aligned in order Index: libomptarget/src/private.h =================================================================== --- libomptarget/src/private.h +++ libomptarget/src/private.h @@ -42,6 +42,22 @@ typedef enum kmp_target_offload_kind kmp_target_offload_kind_t; extern kmp_target_offload_kind_t TargetOffloadPolicy; +//////////////////////////////////////////////////////////////////////////////// +// implemtation for fatal messages +//////////////////////////////////////////////////////////////////////////////// + +#define FATAL_MESSAGE0(_num, _str) \ + { \ + fprintf(stderr, "Libomptarget fatal error %d: %s\n", _num, _str); \ + exit(1); \ + } + +#define FATAL_MESSAGE(_num, _str, ...) \ + { \ + fprintf(stderr, "Libomptarget fatal error %d:" _str "\n", _num, __VA_ARGS__);\ + exit(1); \ + } + // Implemented in libomp, they are called from within __tgt_* functions. #ifdef __cplusplus extern "C" { @@ -54,8 +70,6 @@ } #endif -void FatalMessage(const int errorNum, const char *fmt, ...); - #ifdef OMPTARGET_DEBUG extern int DebugLevel;