2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2024-02-01 01:51:13 +08:00
|
|
|
* Copyright (C) 2018-2024 Intel Corporation
|
2018-09-18 15:11:08 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
#pragma once
|
2021-01-11 04:36:01 +08:00
|
|
|
#include "shared/source/helpers/preprocessor.h"
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2021-01-11 04:36:01 +08:00
|
|
|
#define UNRECOVERABLE_IF(expression) \
|
|
|
|
if (expression) { \
|
|
|
|
NEO::abortUnrecoverable(__LINE__, NEO_SOURCE_FILE_PATH); \
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
|
2019-01-29 00:51:00 +08:00
|
|
|
#define UNREACHABLE(...) std::abort()
|
|
|
|
|
2024-09-09 21:06:28 +08:00
|
|
|
#if defined(MOCKABLE) || defined(_DEBUG)
|
2024-02-01 01:51:13 +08:00
|
|
|
#define OPTIONAL_UNRECOVERABLE_IF(expression) UNRECOVERABLE_IF(expression)
|
|
|
|
#else
|
|
|
|
#define OPTIONAL_UNRECOVERABLE_IF(expression) (void)0
|
|
|
|
#endif
|
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
#ifndef DEBUG_BREAK_IF
|
|
|
|
#ifdef _DEBUG
|
2019-03-26 18:59:46 +08:00
|
|
|
#define DEBUG_BREAK_IF(expression) \
|
|
|
|
\
|
|
|
|
if (expression) { \
|
|
|
|
NEO::debugBreak(__LINE__, __FILE__); \
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
#else
|
|
|
|
#define DEBUG_BREAK_IF(expression) (void)0
|
|
|
|
#endif // _DEBUG
|
|
|
|
#endif // !DEBUG_BREAK_IF
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2017-12-21 07:45:38 +08:00
|
|
|
void debugBreak(int line, const char *file);
|
2018-04-04 15:29:48 +08:00
|
|
|
[[noreturn]] void abortUnrecoverable(int line, const char *file);
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|