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