1 //===-------- Debug.h ---- Debug utilities ------------------------ C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
10 //===----------------------------------------------------------------------===//
12 #ifndef OMPTARGET_DEVICERTL_DEBUG_H
13 #define OMPTARGET_DEVICERTL_DEBUG_H
15 #include "Configuration.h"
22 void __assert_assume(bool condition
);
23 void __assert_fail(const char *expr
, const char *file
, unsigned line
,
24 const char *function
);
25 void __assert_fail_internal(const char *expr
, const char *msg
, const char *file
,
26 unsigned line
, const char *function
);
29 #define ASSERT(expr, msg) \
31 if (config::isDebugMode(DeviceDebugKind::Assertion) && !(expr)) \
32 __assert_fail_internal(#expr, msg, __FILE__, __LINE__, \
33 __PRETTY_FUNCTION__); \
35 __assert_assume(expr); \
37 #define UNREACHABLE(msg) \
40 __builtin_unreachable();
44 #define PRINTF(fmt, ...) (void)printf(fmt, ##__VA_ARGS__);
45 #define PRINT(str) PRINTF("%s", str)