File tree Expand file tree Collapse file tree 3 files changed +28
-0
lines changed Expand file tree Collapse file tree 3 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 22
22
#endif
23
23
#endif
24
24
25
+ #ifndef USING_ATTR_NS
26
+ #if defined(__clang__)
27
+ #define USING_ATTR_NS using clang:
28
+ #else
29
+ #define USING_ATTR_NS using gnu:
30
+ #endif
31
+ #endif
32
+
25
33
#ifndef ALWAYS_INLINE
26
34
#define ALWAYS_INLINE inline __attribute__ ((always_inline))
27
35
#endif
30
38
#define NEVER_INLINE __attribute__ ((noinline))
31
39
#endif
32
40
41
+ #ifndef FLATTEN
42
+ #define FLATTEN __attribute__ ((flatten))
43
+ #endif
44
+
33
45
#ifndef MUSTTAIL
34
46
#if defined(__clang__)
35
47
#define MUSTTAIL [[clang::musttail]]
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ add_tests(
31
31
byterator
32
32
cached
33
33
callable
34
+ compiler
34
35
concepts
35
36
conditional
36
37
ct_conversions
Original file line number Diff line number Diff line change
1
+ #include < stdx/compiler.hpp>
2
+
3
+ #include < catch2/catch_test_macros.hpp>
4
+
5
+ TEST_CASE (" using attribute namespace" , " [compiler]" ) {
6
+ [[USING_ATTR_NS warn_unused_result]] auto f (int ) -> int ;
7
+ }
8
+
9
+ ALWAYS_INLINE auto f1 (int ) -> void;
10
+
11
+ TEST_CASE (" NEVER_INLINE" , " [compiler]" ) { NEVER_INLINE auto f2 (int ) -> void ; }
12
+
13
+ TEST_CASE (" FLATTEN" , " [compiler]" ) { FLATTEN auto f3 (int ) -> void ; }
14
+
15
+ ALWAYS_INLINE FLATTEN auto f4 (int ) -> void;
You can’t perform that action at this time.
0 commit comments