aGrUM
3.1.1
a C++ library for (probabilistic) graphical models
inline.h
Go to the documentation of this file.
1
/****************************************************************************
2
* This file is part of the aGrUM/pyAgrum library. *
3
* *
4
* Copyright (c) 2005-2026 by *
5
* - Pierre-Henri WUILLEMIN(_at_LIP6) *
6
* - Christophe GONZALES(_at_AMU) *
7
* *
8
* The aGrUM/pyAgrum library is free software; you can redistribute it *
9
* and/or modify it under the terms of either : *
10
* *
11
* - the GNU Lesser General Public License as published by *
12
* the Free Software Foundation, either version 3 of the License, *
13
* or (at your option) any later version, *
14
* - the MIT license (MIT), *
15
* - or both in dual license, as here. *
16
* *
17
* (see https://agrum.gitlab.io/articles/dual-licenses-lgplv3mit.html) *
18
* *
19
* This aGrUM/pyAgrum library is distributed in the hope that it will be *
20
* useful, but WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
21
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES MERCHANTABILITY or FITNESS *
22
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
23
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
24
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
25
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
26
* OTHER DEALINGS IN THE SOFTWARE. *
27
* *
28
* See LICENCES for more details. *
29
* *
30
* SPDX-FileCopyrightText: Copyright 2005-2026 *
31
* - Pierre-Henri WUILLEMIN(_at_LIP6) *
32
* - Christophe GONZALES(_at_AMU) *
33
* SPDX-License-Identifier: LGPL-3.0-or-later OR MIT *
34
* *
35
* Contact : info_at_agrum_dot_org *
36
* homepage : http://agrum.gitlab.io *
37
* gitlab : https://gitlab.com/agrumery/agrum *
38
* *
39
****************************************************************************/
40
41
58
#ifndef GUM_INLINE_H
59
#define GUM_INLINE_H
60
61
#include <agrum/config.h>
62
63
#ifndef DOXYGEN_SHOULD_SKIP_THIS
64
65
# ifndef GUM_NO_INLINE
66
67
# define INLINE inline
68
69
// ENFORCED_INLINE is a stronger version of the inline, using _forceinline_ on
70
// MSVC, but it still doesn't use GCC's always_inline. This is useful in
71
// (common) situations where MSVC needs forceinline but GCC is still doing fine
72
// with just inline. (from eigen library)
73
# if (defined _MSC_VER) || (defined _INTEL_COMPILER_)
74
# define ENFORCED_INLINE __forceinline
75
# else
76
# define ENFORCED_INLINE inline
77
# endif
78
79
// ALWAYS_INLINE is the strongest, it has the effect of making the function
80
// inline and adding every possible attribute to maximize inlining. This should
81
// only be used when really necessary: in particular, it uses
82
// __attribute__((always_inline)) on GCC, which most of the time is useless and
83
// can severely harm compile times.
84
// @warning with the always_inline attribute, gcc 3.4.x reports the following
85
// compilation error:
86
// Eval.h:91: sorry, unimplemented: inlining failed in call to '...' :
87
// function body not available (from eigen library)
88
# if GNUC_AT_LEAST(4, 0)
89
# define ALWAYS_INLINE __attribute__((always_inline)) inline
90
# else
91
# define ALWAYS_INLINE ENFORCED_INLINE
92
# endif
93
94
# if (defined __GNUC__)
95
# define NO_INLINE __attribute__((noinline))
96
# elif (defined _MSC_VER)
97
# define NEVER_INLINE _declspec_(noinline)
98
# else
99
# define NEVER_INLINE
100
# endif
101
# else
// GUM_NO_INLINE
102
# define INLINE
103
# define STRONG_INLINE
104
# define ALWAYS_INLINE
105
# define NEVER_INLINE
106
# endif
/* GUM_NO_INLINE */
107
108
#endif
/* DOXYGEN_SHOULD_SKIP_THIS */
109
110
#endif
/* GUM_INLINE_H */