Use STATIC_INLINE, which will be introduced at 5.14.0
[gitmo/Mouse.git] / mouse.h
diff --git a/mouse.h b/mouse.h
index bfb7836..74c46f0 100644 (file)
--- a/mouse.h
+++ b/mouse.h
 #define GvNAMELEN_get GvNAMELEN
 #endif
 
+#ifndef CvGV_set
+#define CvGV_set(cv, gv) (CvGV(cv) = (gv))
+#endif
+
 #ifndef mro_get_linear_isa
 #define no_mro_get_linear_isa
 #define mro_get_linear_isa(stash) mouse_mro_get_linear_isa(aTHX_ stash)
 AV* mouse_mro_get_linear_isa(pTHX_ HV* const stash);
+#define mro_method_changed_in(stash) ((void)++PL_sub_generation)
 #endif /* !mro_get_linear_isa */
 
 #ifndef mro_get_pkg_gen
@@ -39,11 +44,13 @@ AV* mouse_mro_get_linear_isa(pTHX_ HV* const stash);
 #endif /* !no_mro_get_linear_isa */
 #endif /* mro_get_package_gen */
 
-#if !defined(__GNUC__)
-#  if (!defined(__cplusplus__) || !defined(__STDC_VERSION__) ||  (__STDC_VERSION__ < 199901L)) && !defined(inline)
-#    define inline /* nothing */
-#  endif
-#endif
+#ifndef STATIC_INLINE /* from 5.13.4 */
+#   if defined(__GNUC__) || defined(__cplusplus__) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
+#       define STATIC_INLINE static inline
+#   else
+#       define STATIC_INLINE static
+#   endif
+#endif /* STATIC_INLINE */
 
 /* Mouse stuff */
 
@@ -70,6 +77,15 @@ mouse_throw_error(SV* const metaobject, SV* const data /* not used */, const cha
     ;
 #endif
 
+/* workaround RT #69939 */
+I32
+mouse_call_sv_safe(pTHX_ SV*, I32);
+
+#define call_sv_safe(sv, flags)     mouse_call_sv_safe(aTHX_ sv, flags)
+#define call_method_safe(m, flags)  mouse_call_sv_safe(aTHX_ newSVpvn_flags(m, strlen(m), SVs_TEMP), flags | G_METHOD)
+#define call_method_safes(m, flags) mouse_call_sv_safe(aTHX_ newSVpvs_flags(m, SVs_TEMP),            flags | G_METHOD)
+
+
 #define is_class_loaded(sv) mouse_is_class_loaded(aTHX_ sv)
 bool mouse_is_class_loaded(pTHX_ SV*);
 
@@ -172,7 +188,6 @@ void mouse_instance_weaken_slot(pTHX_ SV* const instance, SV* const slot);
 
 CV* mouse_simple_accessor_generate(pTHX_ const char* const fq_name, const char* const key, I32 const keylen, XSUBADDR_t const accessor_impl, void* const dptr, I32 const dlen);
 
-XS(XS_Mouse_simple_accessor);
 XS(XS_Mouse_simple_reader);
 XS(XS_Mouse_simple_writer);
 XS(XS_Mouse_simple_clearer);