AGX Dynamics  2.35.0.1
macros.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. 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 #define AGX_NOEXCEPT noexcept
47 
48 #endif
49 
50 // Index set iterator for kernels.
51 #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)
52 
53 #if defined(_MSC_VER)
54 # define AGX_FORCE_INLINE __forceinline
55 #elif defined(__GNUC__) && !defined(AGX_DEBUG)
56 # define AGX_FORCE_INLINE inline __attribute__((always_inline))
57 #else
58 # define AGX_FORCE_INLINE inline
59 #endif
60 
61 #ifdef _MSC_VER
62 #define AGX_ALIGNED( t, a ) __declspec( align( a ) ) t
63 #else
64 #define AGX_ALIGNED( t, a ) t __attribute__ ((aligned (a)))
65 #endif
66 
67 #ifdef CALLABLE_GENERATOR
68 #define CALLABLE __attribute__((annotate("CALLABLE")))
69 #define CALLABLE_UNIT(param) __attribute__((annotate("CALLABLE_UNIT " param)))
70 #define CALLABLE_IGNORE __attribute__((annotate("CALLABLE_IGNORE")))
71 #else
72 #define CALLABLE
73 #define CALLABLE_UNIT(param)
74 #define CALLABLE_IGNORE
75 #endif
76 
77 
79 #if defined(__GNUC__) && ( __GNUC__ >= 7) || defined(__clang__) && ( __clang_major__ >= 10 )
80  #define AGX_MAYBE_UNUSED [[maybe_unused]]
81 #else
82  #define AGX_MAYBE_UNUSED
83 #endif
84 
85 #ifdef SWIG
86  #define AGX_DEPRECATED(since)
87  #define AGX_DEPRECATED_FOR(since, replacement)
88 #else
89  #define AGX_DEPRECATED(since) HEDLEY_DEPRECATED(since)
90  #define AGX_DEPRECATED_FOR(since, replacement) HEDLEY_DEPRECATED_FOR(since, replacement)
91 #endif
92 
93 
94 //
95 #ifdef AGX_HIDE_INTERNAL_DOCUMENTATION
96  #define DOXYGEN_START_INTERNAL_BLOCK()
97  #define DOXYGEN_END_INTERNAL_BLOCK()
98 #else
99  #define DOXYGEN_START_INTERNAL_BLOCK()
100  #define DOXYGEN_END_INTERNAL_BLOCK()
101 #endif
102 
103 
104 #endif