Ruby 3.5.0dev (2025-02-22 revision 412997300569c1853c09813e4924b6df3d7e8669)
const.h
Go to the documentation of this file.
1#ifndef RBIMPL_ATTR_CONST_H /*-*-C++-*-vi:se ft=cpp:*/
2#define RBIMPL_ATTR_CONST_H
26
28#if RBIMPL_HAS_ATTRIBUTE(const)
29# define RBIMPL_ATTR_CONST() __attribute__((__const__))
30#elif RBIMPL_HAS_DECLSPEC_ATTRIBUTE(noalias)
31# /* If a function can be a const, that is also a noalias. */
32# define RBIMPL_ATTR_CONST() __declspec(noalias)
33#elif RBIMPL_COMPILER_SINCE(SunPro, 5, 10, 0)
34# define RBIMPL_ATTR_CONST() _Pragma("no_side_effect")
35#else
36# define RBIMPL_ATTR_CONST() /* void */
37#endif
38
40#if !defined(RUBY_DEBUG) || !RUBY_DEBUG
41# define RBIMPL_ATTR_CONST_UNLESS_DEBUG() RBIMPL_ATTR_CONST()
42#else
43# define RBIMPL_ATTR_CONST_UNLESS_DEBUG() /* void */
44#endif
45
46#endif /* RBIMPL_ATTR_CONST_H */
Defines RBIMPL_HAS_ATTRIBUTE.
Defines RBIMPL_COMPILER_SINCE.
Defines RBIMPL_HAS_DECLSPEC_ATTRIBUTE.