Ruby  3.4.0dev (2024-12-06 revision 892c46283a5ea4179500d951c9d4866c0051f27b)
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.