Ruby: include/ruby/internal/attr/const.h Source File

Ruby 3.3.6p108 (2024-11-05 revision 75015d4c1f6965b5e85e96fb309f1f2129f933c0)

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
23#include "ruby/internal/compiler_since.h"
24#include "ruby/internal/has/attribute.h"
25#include "ruby/internal/has/declspec_attribute.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 */
attribute.h
Defines RBIMPL_HAS_ATTRIBUTE.
compiler_since.h
Defines RBIMPL_COMPILER_SINCE.
declspec_attribute.h
Defines RBIMPL_HAS_DECLSPEC_ATTRIBUTE.