]> granicus.if.org Git - strace/blob - static_assert.h
evdev: decode struct input_absinfo regardless of in-kernel definitions
[strace] / static_assert.h
1 /*
2  * Copyright (c) 2018 Dmitry V. Levin <ldv@altlinux.org>
3  * All rights reserved.
4  *
5  * SPDX-License-Identifier: LGPL-2.1-or-later
6  */
7
8 #ifndef STRACE_STATIC_ASSERT_H
9 # define STRACE_STATIC_ASSERT_H
10
11 # include "assert.h"
12
13 # if defined HAVE_STATIC_ASSERT
14
15 /* static_assert is already available */
16
17 # elif defined HAVE__STATIC_ASSERT
18
19 #  undef static_assert
20 #  define static_assert _Static_assert
21
22 # else /* !HAVE_STATIC_ASSERT && !HAVE__STATIC_ASSERT */
23
24 #  define static_assert(expr, message) \
25         extern int (*strace_static_assert(int))[sizeof(int[2 * !!(expr) - 1])]
26
27 # endif
28
29 #endif /* !STRACE_STATIC_ASSERT_H */