AGXDynamics  2.31.1.0
macros.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2021. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #ifndef AGX_MACROS_H
18 #define AGX_MACROS_H
19 
20 #include <agx/config.h>
21 #include <external/hedley/hedley.h>
22 
23 #define AGX_STATIC_ASSERT(X) static_assert(X, #X)
24 
25 #if !defined(AGX_DEBUG) && !defined(NDEBUG)
26 #define AGX_DEBUG
27 #endif
28 
29 #define AGX_STRINGIFY(A) #A
30 #define AGX_TOSTRING(x) AGX_STRINGIFY(x)
31 
38 #define _AGX_CONCAT(x,y) x ## y
39 #define AGX_CONCAT(x,y) _AGX_CONCAT(x,y)
40 
41 
42 #ifdef _MSC_VER
43 # define AGX_NOEXCEPT
44 #else
45 
46 #if AGX_USE_CPP11()
47 # define AGX_NOEXCEPT noexcept
48 #else
49 # define AGX_NOEXCEPT
50 #endif
51 
52 #endif
53 
54 // Index set iterator for kernels.
55 #define AGX_ITERATE_INDEX_SET(set, i) typename SetT::iterator _agx_set_iterator = set.begin(), _agx_set_end = set.end(); for (typename SetT::Type i; (_agx_set_iterator != _agx_set_end) && ((i = *_agx_set_iterator), true); ++_agx_set_iterator)
56 
57 #if defined(_MSC_VER)
58 # define AGX_FORCE_INLINE __forceinline
59 #elif defined(__GNUC__) && !defined(AGX_DEBUG)
60 # define AGX_FORCE_INLINE inline __attribute__((always_inline))
61 #else
62 # define AGX_FORCE_INLINE inline
63 #endif
64 
65 #ifdef _MSC_VER
66 #define AGX_ALIGNED( t, a ) __declspec( align( a ) ) t
67 #else
68 #define AGX_ALIGNED( t, a ) t __attribute__ ((aligned (a)))
69 #endif
70 
71 #ifdef CALLABLE_GENERATOR
72 #define CALLABLE __attribute__((annotate("CALLABLE")))
73 #define CALLABLE_UNIT(param) __attribute__((annotate("CALLABLE_UNIT " param)))
74 #define CALLABLE_IGNORE __attribute__((annotate("CALLABLE_IGNORE")))
75 #else
76 #define CALLABLE
77 #define CALLABLE_UNIT(param)
78 #define CALLABLE_IGNORE
79 #endif
80 
81 
83 #if defined(__GNUC__) && ( __GNUC__ >= 7)
84  #define AGX_MAYBE_UNUSED [[maybe_unused]]
85 #else
86  #define AGX_MAYBE_UNUSED
87 #endif
88 
89 #ifdef SWIG
90  #define AGX_DEPRECATED(since)
91  #define AGX_DEPRECATED_FOR(since, replacement)
92 #else
93  #define AGX_DEPRECATED(since) HEDLEY_DEPRECATED(since)
94  #define AGX_DEPRECATED_FOR(since, replacement) HEDLEY_DEPRECATED_FOR(since, replacement)
95 #endif
96 
97 
98 //
99 #ifdef AGX_HIDE_INTERNAL_DOCUMENTATION
100  #define DOXYGEN_START_INTERNAL_BLOCK()
101  #define DOXYGEN_END_INTERNAL_BLOCK()
102 #else
103  #define DOXYGEN_START_INTERNAL_BLOCK()
104  #define DOXYGEN_END_INTERNAL_BLOCK()
105 #endif
106 
107 
108 #endif