blob: a7b20ed66244feeaf64f06463c161a4498805161 [file] [log] [blame]
Stephen Hines2d1fdb22014-05-28 23:58:16 -07001/* ===-- int_util.h - internal utility functions ----------------------------===
2 *
3 * The LLVM Compiler Infrastructure
4 *
5 * This file is dual licensed under the MIT and the University of Illinois Open
6 * Source Licenses. See LICENSE.TXT for details.
7 *
8 * ===-----------------------------------------------------------------------===
9 *
10 * This file is not part of the interface of this library.
11 *
12 * This file defines non-inline utilities which are available for use in the
13 * library. The function definitions themselves are all contained in int_util.c
14 * which will always be compiled into any compiler-rt library.
15 *
16 * ===-----------------------------------------------------------------------===
17 */
18
19#ifndef INT_UTIL_H
20#define INT_UTIL_H
21
22/** \brief Trigger a program abort (or panic for kernel code). */
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -080023#define compilerrt_abort() compilerrt_abort_impl(__FILE__, __LINE__, __func__)
Stephen Hines2d1fdb22014-05-28 23:58:16 -070024
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -080025NORETURN void compilerrt_abort_impl(const char *file, int line,
26 const char *function);
27
28#define COMPILE_TIME_ASSERT(expr) COMPILE_TIME_ASSERT1(expr, __COUNTER__)
29#define COMPILE_TIME_ASSERT1(expr, cnt) COMPILE_TIME_ASSERT2(expr, cnt)
30#define COMPILE_TIME_ASSERT2(expr, cnt) \
31 typedef char ct_assert_##cnt[(expr) ? 1 : -1] UNUSED
Stephen Hines2d1fdb22014-05-28 23:58:16 -070032
33#endif /* INT_UTIL_H */