Files
compute-runtime/core/helpers/debug_helpers.h
Filip Hazubski 487c4c6e4b Add UNUSED_VARIABLE helper macro
Change-Id: If293ad33899ee4feb79424c351b13ea85306c603
Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
2019-11-14 17:42:56 +01:00

37 lines
913 B
C++

/*
* Copyright (C) 2017-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "core/helpers/abort.h"
#define UNRECOVERABLE_IF(expression) \
\
if (expression) { \
NEO::abortUnrecoverable(__LINE__, __FILE__); \
}
#define UNREACHABLE(...) std::abort()
#ifndef DEBUG_BREAK_IF
#ifdef _DEBUG
#define DEBUG_BREAK_IF(expression) \
\
if (expression) { \
NEO::debugBreak(__LINE__, __FILE__); \
}
#else
#define DEBUG_BREAK_IF(expression) (void)0
#endif // _DEBUG
#endif // !DEBUG_BREAK_IF
#define UNUSED_VARIABLE(x) ((void)(x))
namespace NEO {
void debugBreak(int line, const char *file);
[[noreturn]] void abortUnrecoverable(int line, const char *file);
} // namespace NEO