Daniel Dunbar | 401f693 | 2011-11-16 01:19:19 +0000 | [diff] [blame] | 1 | /* ===-- int_util.h - internal utility functions ----------------------------=== |
| 2 | * |
Chandler Carruth | 7a739a0 | 2019-01-19 10:56:40 +0000 | [diff] [blame] | 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 |
Daniel Dunbar | 401f693 | 2011-11-16 01:19:19 +0000 | [diff] [blame] | 6 | * |
| 7 | * ===-----------------------------------------------------------------------=== |
| 8 | * |
| 9 | * This file is not part of the interface of this library. |
| 10 | * |
| 11 | * This file defines non-inline utilities which are available for use in the |
| 12 | * library. The function definitions themselves are all contained in int_util.c |
| 13 | * which will always be compiled into any compiler-rt library. |
| 14 | * |
| 15 | * ===-----------------------------------------------------------------------=== |
| 16 | */ |
| 17 | |
| 18 | #ifndef INT_UTIL_H |
| 19 | #define INT_UTIL_H |
| 20 | |
| 21 | /** \brief Trigger a program abort (or panic for kernel code). */ |
Richard Smith | 6b0b63e | 2018-09-08 00:17:37 +0000 | [diff] [blame] | 22 | #define compilerrt_abort() __compilerrt_abort_impl(__FILE__, __LINE__, __func__) |
Nick Kledzik | 1f4f7b5 | 2012-02-03 23:10:55 +0000 | [diff] [blame] | 23 | |
Richard Smith | 6b0b63e | 2018-09-08 00:17:37 +0000 | [diff] [blame] | 24 | NORETURN void __compilerrt_abort_impl(const char *file, int line, |
| 25 | const char *function); |
Daniel Dunbar | 401f693 | 2011-11-16 01:19:19 +0000 | [diff] [blame] | 26 | |
Chih-Hung Hsieh | f475acf | 2015-08-31 17:14:07 +0000 | [diff] [blame] | 27 | #define COMPILE_TIME_ASSERT(expr) COMPILE_TIME_ASSERT1(expr, __COUNTER__) |
| 28 | #define COMPILE_TIME_ASSERT1(expr, cnt) COMPILE_TIME_ASSERT2(expr, cnt) |
Saleem Abdulrasool | 08b610e | 2015-10-06 04:33:05 +0000 | [diff] [blame] | 29 | #define COMPILE_TIME_ASSERT2(expr, cnt) \ |
| 30 | typedef char ct_assert_##cnt[(expr) ? 1 : -1] UNUSED |
Chih-Hung Hsieh | f475acf | 2015-08-31 17:14:07 +0000 | [diff] [blame] | 31 | |
Daniel Dunbar | 401f693 | 2011-11-16 01:19:19 +0000 | [diff] [blame] | 32 | #endif /* INT_UTIL_H */ |