1 #ifndef RUBY_BACKWARD2_ATTRIBUTES_H
2 #define RUBY_BACKWARD2_ATTRIBUTES_H
30 #include "ruby/internal/config.h"
50 #define CONSTFUNC(x) RBIMPL_ATTR_CONST() x
53 #define PUREFUNC(x) RBIMPL_ATTR_PURE() x
56 #define DEPRECATED(x) RBIMPL_ATTR_DEPRECATED(("")) x
59 #define DEPRECATED_BY(n,x) RBIMPL_ATTR_DEPRECATED(("by: " # n)) x
61 #undef DEPRECATED_TYPE
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)
73 # define DEPRECATED_TYPE(mesg, decl) \
74 <-<-"DEPRECATED_TYPE is deprecated"->->
77 #undef RUBY_CXX_DEPRECATED
78 #define RUBY_CXX_DEPRECATED(mseg) RBIMPL_ATTR_DEPRECATED((mseg))
81 #define NOINLINE(x) RBIMPL_ATTR_NOINLINE() x
85 # define ALWAYS_INLINE(x) RBIMPL_ATTR_FORCEINLINE() x
89 #define ERRORFUNC(mesg, x) RBIMPL_ATTR_ERROR(mesg) x
90 #if RBIMPL_HAS_ATTRIBUTE(error)
91 # define HAVE_ATTRIBUTE_ERRORFUNC 1
95 #define WARNINGFUNC(mesg, x) RBIMPL_ATTR_WARNING(mesg) x
96 #if RBIMPL_HAS_ATTRIBUTE(warning)
97 # define HAVE_ATTRIBUTE_WARNINGFUNC 1
105 #define COLDFUNC RBIMPL_ATTR_COLD()
107 #define PRINTF_ARGS(decl, string_index, first_to_check) \
108 RBIMPL_ATTR_FORMAT(RBIMPL_PRINTF_FORMAT, (string_index), (first_to_check)) \
111 #undef RUBY_ATTR_ALLOC_SIZE
112 #define RUBY_ATTR_ALLOC_SIZE RBIMPL_ATTR_ALLOC_SIZE
114 #undef RUBY_ATTR_MALLOC
115 #define RUBY_ATTR_MALLOC RBIMPL_ATTR_RESTRICT()
117 #undef RUBY_ATTR_RETURNS_NONNULL
118 #define RUBY_ATTR_RETURNS_NONNULL RBIMPL_ATTR_RETURNS_NONNULL()
120 #ifndef FUNC_MINIMIZED
121 #define FUNC_MINIMIZED(x) x
124 #ifndef FUNC_UNOPTIMIZED
125 #define FUNC_UNOPTIMIZED(x) x
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;}
133 #ifndef RUBY_ALIAS_FUNCTION_VOID
134 #define RUBY_ALIAS_FUNCTION_VOID(prot, name, args) \
135 FUNC_MINIMIZED(void prot) {name args;}
138 #ifndef RUBY_ALIAS_FUNCTION
139 #define RUBY_ALIAS_FUNCTION(prot, name, args) \
140 RUBY_ALIAS_FUNCTION_TYPE(VALUE, prot, name, args)
143 #undef RUBY_FUNC_NONNULL
144 #define RUBY_FUNC_NONNULL(n, x) RBIMPL_ATTR_NONNULL(n) x
147 #define NORETURN(x) RBIMPL_ATTR_NORETURN() x
148 #define NORETURN_STYLE_NEW
150 #ifndef PACKED_STRUCT
151 # define PACKED_STRUCT(x) x
154 #ifndef PACKED_STRUCT_UNALIGNED
155 # if UNALIGNED_WORD_ACCESS
156 # define PACKED_STRUCT_UNALIGNED(x) PACKED_STRUCT(x)
158 # define PACKED_STRUCT_UNALIGNED(x) x
163 #define RB_UNUSED_VAR(x) x RBIMPL_ATTR_MAYBE_UNUSED()
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_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.