2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2019-01-29 00:51:00 +08:00
|
|
|
* Copyright (C) 2017-2019 Intel Corporation
|
2018-09-18 15:11:08 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#include "runtime/helpers/abort.h"
|
|
|
|
|
|
|
|
#define UNRECOVERABLE_IF(expression) \
|
|
|
|
\
|
|
|
|
if (expression) { \
|
|
|
|
OCLRT::abortUnrecoverable(__LINE__, __FILE__); \
|
|
|
|
}
|
|
|
|
|
2019-01-29 00:51:00 +08:00
|
|
|
#define UNREACHABLE(...) std::abort()
|
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
#ifndef DEBUG_BREAK_IF
|
|
|
|
#ifdef _DEBUG
|
|
|
|
#define DEBUG_BREAK_IF(expression) \
|
|
|
|
\
|
|
|
|
if (expression) { \
|
|
|
|
OCLRT::debugBreak(__LINE__, __FILE__); \
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#define DEBUG_BREAK_IF(expression) (void)0
|
|
|
|
#endif // _DEBUG
|
|
|
|
#endif // !DEBUG_BREAK_IF
|
|
|
|
|
|
|
|
namespace OCLRT {
|
|
|
|
void debugBreak(int line, const char *file);
|
2018-04-04 15:29:48 +08:00
|
|
|
[[noreturn]] void abortUnrecoverable(int line, const char *file);
|
2017-12-21 07:45:38 +08:00
|
|
|
} // namespace OCLRT
|