aGrUM
0.17.1
a C++ library for (probabilistic) graphical models
inline.h
Go to the documentation of this file.
1
39
#ifndef GUM_INLINE_H
40
#define GUM_INLINE_H
41
42
#ifndef DOXYGEN_SHOULD_SKIP_THIS
43
44
# ifndef GUM_NO_INLINE
45
46
# define INLINE inline
47
48
// ENFORCED_INLINE is a stronger version of the inline, using __forceinline on
49
// MSVC, but it still doesn't use GCC's always_inline. This is useful in
50
// (common) situations where MSVC needs forceinline but GCC is still doing fine
51
// with just inline. (from eigen library)
52
# if (defined _MSC_VER) || (defined __INTEL_COMPILER)
53
# define ENFORCED_INLINE __forceinline
54
# else
55
# define ENFORCED_INLINE inline
56
# endif
57
58
// ALWAYS_INLINE is the strongest, it has the effect of making the function
59
// inline and adding every possible attribute to maximize inlining. This should
60
// only be used when really necessary: in particular, it uses
61
// __attribute__((always_inline)) on GCC, which most of the time is useless and
62
// can severely harm compile times.
63
// FIXME with the always_inline attribute, gcc 3.4.x reports the following
64
// compilation error:
65
// Eval.h:91: sorry, unimplemented: inlining failed in call to '...' :
66
// function body not available (from eigen library)
67
# if GNUC_AT_LEAST(4, 0)
68
# define ALWAYS_INLINE __attribute__((always_inline)) inline
69
# else
70
# define ALWAYS_INLINE ENFORCED_INLINE
71
# endif
72
73
# if (defined __GNUC__)
74
# define NO_INLINE __attribute__((noinline))
75
# elif (defined _MSC_VER)
76
# define NEVER_INLINE __declspec(noinline)
77
# else
78
# define NEVER_INLINE
79
# endif
80
# else // GUM_NO_INLINE
81
# define INLINE
82
# define STRONG_INLINE
83
# define ALWAYS_INLINE
84
# define NEVER_INLINE
85
# endif
/* GUM_NO_INLINE */
86
87
#endif
/* DOXYGEN_SHOULD_SKIP_THIS */
88
89
#endif
/* GUM_INLINE_H */