Ruby  3.1.4p223 (2023-03-30 revision HEAD)
attributes.h
1 #ifndef RUBY_BACKWARD2_ATTRIBUTES_H /*-*-C++-*-vi:se ft=cpp:*/
2 #define RUBY_BACKWARD2_ATTRIBUTES_H
30 #include "ruby/internal/config.h"
47 
48 /* function attributes */
49 #undef CONSTFUNC
50 #define CONSTFUNC(x) RBIMPL_ATTR_CONST() x
51 
52 #undef PUREFUNC
53 #define PUREFUNC(x) RBIMPL_ATTR_PURE() x
54 
55 #undef DEPRECATED
56 #define DEPRECATED(x) RBIMPL_ATTR_DEPRECATED(("")) x
57 
58 #undef DEPRECATED_BY
59 #define DEPRECATED_BY(n,x) RBIMPL_ATTR_DEPRECATED(("by: " # n)) x
60 
61 #undef DEPRECATED_TYPE
62 #if defined(__GNUC__)
63 # define DEPRECATED_TYPE(mesg, decl) \
64  _Pragma("message \"DEPRECATED_TYPE is deprecated\""); \
65  decl RBIMPL_ATTR_DEPRECATED(mseg)
66 #elif defined(_MSC_VER)
67 # pragma deprecated(DEPRECATED_TYPE)
68 # define DEPRECATED_TYPE(mesg, decl) \
69  __pragma(message(__FILE__"("STRINGIZE(__LINE__)"): warning: " \
70  "DEPRECATED_TYPE is deprecated")) \
71  decl RBIMPL_ATTR_DEPRECATED(mseg)
72 #else
73 # define DEPRECATED_TYPE(mesg, decl) \
74  <-<-"DEPRECATED_TYPE is deprecated"->->
75 #endif
76 
77 #undef RUBY_CXX_DEPRECATED
78 #define RUBY_CXX_DEPRECATED(mseg) RBIMPL_ATTR_DEPRECATED((mseg))
79 
80 #undef NOINLINE
81 #define NOINLINE(x) RBIMPL_ATTR_NOINLINE() x
82 
83 #ifndef MJIT_HEADER
84 # undef ALWAYS_INLINE
85 # define ALWAYS_INLINE(x) RBIMPL_ATTR_FORCEINLINE() x
86 #endif
87 
88 #undef ERRORFUNC
89 #define ERRORFUNC(mesg, x) RBIMPL_ATTR_ERROR(mesg) x
90 #if RBIMPL_HAS_ATTRIBUTE(error)
91 # define HAVE_ATTRIBUTE_ERRORFUNC 1
92 #endif
93 
94 #undef WARNINGFUNC
95 #define WARNINGFUNC(mesg, x) RBIMPL_ATTR_WARNING(mesg) x
96 #if RBIMPL_HAS_ATTRIBUTE(warning)
97 # define HAVE_ATTRIBUTE_WARNINGFUNC 1
98 #endif
99 
100 /*
101  cold attribute for code layout improvements
102  RUBY_FUNC_ATTRIBUTE not used because MSVC does not like nested func macros
103  */
104 #undef COLDFUNC
105 #define COLDFUNC RBIMPL_ATTR_COLD()
106 
107 #define PRINTF_ARGS(decl, string_index, first_to_check) \
108  RBIMPL_ATTR_FORMAT(RBIMPL_PRINTF_FORMAT, (string_index), (first_to_check)) \
109  decl
110 
111 #undef RUBY_ATTR_ALLOC_SIZE
112 #define RUBY_ATTR_ALLOC_SIZE RBIMPL_ATTR_ALLOC_SIZE
113 
114 #undef RUBY_ATTR_MALLOC
115 #define RUBY_ATTR_MALLOC RBIMPL_ATTR_RESTRICT()
116 
117 #undef RUBY_ATTR_RETURNS_NONNULL
118 #define RUBY_ATTR_RETURNS_NONNULL RBIMPL_ATTR_RETURNS_NONNULL()
119 
120 #ifndef FUNC_MINIMIZED
121 #define FUNC_MINIMIZED(x) x
122 #endif
123 
124 #ifndef FUNC_UNOPTIMIZED
125 #define FUNC_UNOPTIMIZED(x) x
126 #endif
127 
128 #ifndef RUBY_ALIAS_FUNCTION_TYPE
129 #define RUBY_ALIAS_FUNCTION_TYPE(type, prot, name, args) \
130  FUNC_MINIMIZED(type prot) {return (type)name args;}
131 #endif
132 
133 #ifndef RUBY_ALIAS_FUNCTION_VOID
134 #define RUBY_ALIAS_FUNCTION_VOID(prot, name, args) \
135  FUNC_MINIMIZED(void prot) {name args;}
136 #endif
137 
138 #ifndef RUBY_ALIAS_FUNCTION
139 #define RUBY_ALIAS_FUNCTION(prot, name, args) \
140  RUBY_ALIAS_FUNCTION_TYPE(VALUE, prot, name, args)
141 #endif
142 
143 #undef RUBY_FUNC_NONNULL
144 #define RUBY_FUNC_NONNULL(n, x) RBIMPL_ATTR_NONNULL(n) x
145 
146 #undef NORETURN
147 #define NORETURN(x) RBIMPL_ATTR_NORETURN() x
148 #define NORETURN_STYLE_NEW
149 
150 #ifndef PACKED_STRUCT
151 # define PACKED_STRUCT(x) x
152 #endif
153 
154 #ifndef PACKED_STRUCT_UNALIGNED
155 # if UNALIGNED_WORD_ACCESS
156 # define PACKED_STRUCT_UNALIGNED(x) PACKED_STRUCT(x)
157 # else
158 # define PACKED_STRUCT_UNALIGNED(x) x
159 # endif
160 #endif
161 
162 #undef RB_UNUSED_VAR
163 #define RB_UNUSED_VAR(x) x RBIMPL_ATTR_MAYBE_UNUSED()
164 
165 #endif /* RUBY_BACKWARD2_ATTRIBUTES_H */
Defines RBIMPL_ATTR_ALLOC_SIZE.
Defines RBIMPL_ATTR_WARNING.
Defines RBIMPL_HAS_ATTRIBUTE.
Defines RBIMPL_ATTR_COLD.
Defines RBIMPL_ATTR_CONST.
Defines RBIMPL_ATTR_DEPRECATED.
Defines RBIMPL_ATTR_FORCEINLINE.
Defines RBIMPL_ATTR_FORMAT.
Defines RBIMPL_ATTR_ERROR.
Defines RBIMPL_ATTR_MAYBE_UNUSED.
Defines RBIMPL_ATTR_NOINLINE.
Defines RBIMPL_ATTR_NONNULL.
Defines RBIMPL_ATTR_NORETURN.
Defines RBIMPL_ATTR_PURE.
Defines RBIMPL_ATTR_RESTRICT.
Defines RBIMPL_ATTR_RETURNS_NONNULL.