swig/0003-Move-new-macros-for-Ruby-to-their-dedicated-namespac.patch
Martin Pluskal 15e360eabd Accepting request 794144 from home:kwk:branches:devel:tools:building
- Ruby 2.7 support (cherry-picked from upstream)
  0001-Fix-code-generated-for-Ruby-global-variables.patch
  0002-Add-support-for-Ruby-2.7.patch
  0003-Move-new-macros-for-Ruby-to-their-dedicated-namespac.patch
  0004-Improve-description-of-cast-macros-for-Ruby.patch

OBS-URL: https://build.opensuse.org/request/show/794144
OBS-URL: https://build.opensuse.org/package/show/devel:tools:building/swig?expand=0&rev=116
2020-04-15 12:46:08 +00:00

77 lines
2.9 KiB
Diff

From 04be77635ca0198c6cbefaf2793d634c315a6d20 Mon Sep 17 00:00:00 2001
From: Thomas Reitmayr <treitmayr@devbase.at>
Date: Fri, 3 Jan 2020 21:45:53 +0100
Subject: [PATCH 3/4] Move new macros for Ruby to their dedicated namespace
---
Lib/ruby/rubyhead.swg | 8 ++++----
Lib/ruby/rubytracking.swg | 8 ++++++--
Source/Modules/ruby.cxx | 2 +-
3 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/Lib/ruby/rubyhead.swg b/Lib/ruby/rubyhead.swg
index 9a0400eea971..89d6f1466296 100644
--- a/Lib/ruby/rubyhead.swg
+++ b/Lib/ruby/rubyhead.swg
@@ -114,14 +114,14 @@
# define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)
# define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
# define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
-# define VOID_ANYARGS_FUNC(f) ((void (*)(ANYARGS))(f))
-# define INT_ANYARGS_FUNC(f) ((int (*)(ANYARGS))(f))
+# define SWIG_RUBY_VOID_ANYARGS_FUNC(f) ((void (*)(ANYARGS))(f))
+# define SWIG_RUBY_INT_ANYARGS_FUNC(f) ((int (*)(ANYARGS))(f))
#else
# define PROTECTFUNC(f) (f)
# define VALUEFUNC(f) (f)
# define VOIDFUNC(f) (f)
-# define VOID_ANYARGS_FUNC(f) (f)
-# define INT_ANYARGS_FUNC(f) (f)
+# define SWIG_RUBY_VOID_ANYARGS_FUNC(f) (f)
+# define SWIG_RUBY_INT_ANYARGS_FUNC(f) (f)
#endif
/* Don't use for expressions have side effect */
diff --git a/Lib/ruby/rubytracking.swg b/Lib/ruby/rubytracking.swg
index 221a68193964..1edcc56819be 100644
--- a/Lib/ruby/rubytracking.swg
+++ b/Lib/ruby/rubytracking.swg
@@ -69,7 +69,9 @@ SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) {
swig_ruby_trackings = (st_table*)NUM2SWIG(trackings_value);
}
- rb_define_virtual_variable("SWIG_TRACKINGS_COUNT", VALUEFUNC(swig_ruby_trackings_count), VOID_ANYARGS_FUNC((rb_gvar_setter_t*)NULL));
+ rb_define_virtual_variable("SWIG_TRACKINGS_COUNT",
+ VALUEFUNC(swig_ruby_trackings_count),
+ SWIG_RUBY_VOID_ANYARGS_FUNC((rb_gvar_setter_t*)NULL));
}
/* Add a Tracking from a C/C++ struct to a Ruby object */
@@ -124,7 +126,9 @@ static int swig_ruby_internal_iterate_callback(st_data_t ptr, st_data_t obj, st_
}
SWIGRUNTIME void SWIG_RubyIterateTrackings( void(*meth)(void* ptr, VALUE obj) ) {
- st_foreach(swig_ruby_trackings, INT_ANYARGS_FUNC(swig_ruby_internal_iterate_callback), (st_data_t)meth);
+ st_foreach(swig_ruby_trackings,
+ SWIG_RUBY_INT_ANYARGS_FUNC(swig_ruby_internal_iterate_callback),
+ (st_data_t)meth);
}
#ifdef __cplusplus
diff --git a/Source/Modules/ruby.cxx b/Source/Modules/ruby.cxx
index 01b75befa504..fcbcb7a5c1ba 100644
--- a/Source/Modules/ruby.cxx
+++ b/Source/Modules/ruby.cxx
@@ -2274,7 +2274,7 @@ public:
if (CPlusPlus) {
Insert(getfname, 0, "VALUEFUNC(");
Append(getfname, ")");
- Insert(setfname, 0, (use_virtual_var) ? "VOID_ANYARGS_FUNC(" : "VALUEFUNC(");
+ Insert(setfname, 0, (use_virtual_var) ? "SWIG_RUBY_VOID_ANYARGS_FUNC(" : "VALUEFUNC(");
Append(setfname, ")");
}
--
2.26.0