2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2021-05-17 02:51:16 +08:00
|
|
|
* Copyright (C) 2018-2021 Intel Corporation
|
2018-09-18 15:11:08 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
#pragma once
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/helpers/abort.h"
|
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()
|
|
|
|
|
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-11-14 21:20:23 +08:00
|
|
|
#define UNUSED_VARIABLE(x) ((void)(x))
|
|
|
|
|
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
|