Ruby
3.1.0dev(2021-09-10revisionb76ad15ed0da636161de0243c547ee1e6fc95681)
ext
bigdecimal
static_assert.h
Go to the documentation of this file.
1
#ifndef BIGDECIMAL_STATIC_ASSERT_H
2
#define BIGDECIMAL_STATIC_ASSERT_H
3
4
#include "
feature.h
"
5
6
#ifdef HAVE_RUBY_INTERNAL_STATIC_ASSERT_H
7
# include <
ruby/internal/static_assert.h
>
8
#endif
9
10
#ifdef RBIMPL_STATIC_ASSERT
11
# define STATIC_ASSERT RBIMPL_STATIC_ASSERT
12
#endif
13
14
#ifndef STATIC_ASSERT
15
#
/* The following section is copied from CRuby's static_assert.h */
16
17
# if defined(__cplusplus) && defined(__cpp_static_assert)
18
#
/* https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations */
19
# define BIGDECIMAL_STATIC_ASSERT0 static_assert
20
21
# elif defined(__cplusplus) && defined(_MSC_VER) && _MSC_VER >= 1600
22
# define BIGDECIMAL_STATIC_ASSERT0 static_assert
23
24
# elif defined(__INTEL_CXX11_MODE__)
25
# define BIGDECIMAL_STATIC_ASSERT0 static_assert
26
27
# elif defined(__cplusplus) && __cplusplus >= 201103L
28
# define BIGDECIMAL_STATIC_ASSERT0 static_assert
29
30
# elif defined(__cplusplus) && __has_extension(cxx_static_assert)
31
# define BIGDECIMAL_STATIC_ASSERT0 __extension__ static_assert
32
33
# elif defined(__STDC_VERSION__) && __has_extension(c_static_assert)
34
# define BIGDECIMAL_STATIC_ASSERT0 __extension__ _Static_assert
35
36
# elif defined(__STDC_VERSION__) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
37
# define BIGDECIMAL_STATIC_ASSERT0 __extension__ _Static_assert
38
#endif
39
40
# if defined(__DOXYGEN__)
41
# define STATIC_ASSERT static_assert
42
43
# elif defined(BIGDECIMAL_STATIC_ASSERT0)
44
# define STATIC_ASSERT(name, expr) \
45
BIGDECIMAL_STATIC_ASSERT0(expr, #name ": " #expr)
46
47
# else
48
# define STATIC_ASSERT(name, expr) \
49
typedef int static_assert_ ## name ## _check[1 - 2 * !(expr)]
50
# endif
51
#endif
/* STATIC_ASSERT */
52
53
54
#endif
/* BIGDECIMAL_STATIC_ASSERT_H */
feature.h
static_assert.h
Defines RBIMPL_STATIC_ASSERT.
Generated by
1.8.17