Ruby  3.4.0dev (2024-11-22 revision 0989400a925cd201defdca9eb28eb87200b30785)
restrict.h
Go to the documentation of this file.
1 #ifndef RBIMPL_ATTR_RESTRICT_H /*-*-C++-*-vi:se ft=cpp:*/
2 #define RBIMPL_ATTR_RESTRICT_H
25 
26 /* :FIXME: config.h includes conflicting `#define restrict`. MSVC can be
27  * detected using `RBIMPL_COMPILER_SINCE()`, but Clang & family cannot use
28  * `__has_declspec_attribute()` which involves macro substitution. */
29 
31 #if RBIMPL_COMPILER_SINCE(MSVC, 14, 0, 0)
32 # define RBIMPL_ATTR_RESTRICT() __declspec(re ## strict)
33 
34 #elif RBIMPL_HAS_ATTRIBUTE(malloc)
35 # define RBIMPL_ATTR_RESTRICT() __attribute__((__malloc__))
36 
37 #elif RBIMPL_COMPILER_SINCE(SunPro, 5, 10, 0)
38 # define RBIMPL_ATTR_RESTRICT() _Pragma("returns_new_memory")
39 
40 #else
41 # define RBIMPL_ATTR_RESTRICT() /* void */
42 #endif
43 
44 #endif /* RBIMPL_ATTR_RESTRICT_H */
Defines RBIMPL_HAS_ATTRIBUTE.
Defines RBIMPL_COMPILER_SINCE.