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