Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)
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
26
27/* :FIXME: config.h includes conflicting `#define restrict`. MSVC can be
28 * detected using `RBIMPL_COMPILER_SINCE()`, but Clang & family cannot use
29 * `__has_declspec_attribute()` which involves macro substitution. */
30
32#if RBIMPL_COMPILER_SINCE(MSVC, 14, 0, 0)
33# define RBIMPL_ATTR_RESTRICT() __declspec(RBIMPL_TOKEN_PASTE(re, strict))
34
35#elif RBIMPL_HAS_ATTRIBUTE(malloc)
36# define RBIMPL_ATTR_RESTRICT() __attribute__((__malloc__))
37
38#elif RBIMPL_COMPILER_SINCE(SunPro, 5, 10, 0)
39# define RBIMPL_ATTR_RESTRICT() _Pragma("returns_new_memory")
40
41#else
42# define RBIMPL_ATTR_RESTRICT() /* void */
43#endif
44
45#endif /* RBIMPL_ATTR_RESTRICT_H */
Defines RBIMPL_HAS_ATTRIBUTE.
Defines RBIMPL_COMPILER_SINCE.
Defines RBIMPL_TOKEN_PASTE.