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