diff --git a/CHANGES.current b/CHANGES.current index d923c2974..84842a830 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -7,6 +7,10 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/ Version 4.0.0 (in progress) =========================== +2018-04-03: olly + [Ruby] Fix to pass Qnil instead of NULL to rb_funcall(), which silences GCC + -Wconversion-null warning (on by default with recent GCC). + 2018-03-09: fultonwi [Java] #1184 Fix swigReleaseOwnership() and swigTakeOwnership() regression for non-director classes. Restores a dynamic_cast which was previously removed. diff --git a/Doc/Manual/Ruby.html b/Doc/Manual/Ruby.html index 04a4f1cee..433afd7ad 100644 --- a/Doc/Manual/Ruby.html +++ b/Doc/Manual/Ruby.html @@ -3704,7 +3704,7 @@ value:

%typemap(in) (int nattributes, const char **names, const int *values)
   (VALUE keys_arr, int i, VALUE key, VALUE val) {
     Check_Type($input, T_HASH);
-    $1 = NUM2INT(rb_funcall($input, rb_intern("size"), 0, NULL));
+    $1 = NUM2INT(rb_funcall($input, rb_intern("size"), 0, Qnil));
 }
@@ -3717,7 +3717,7 @@ the keys and values from the hash:

%typemap(in) (int nattributes, const char **names, const int *values)
   (VALUE keys_arr, int i, VALUE key, VALUE val) {
     Check_Type($input, T_HASH);
-    $1 = NUM2INT(rb_funcall($input, rb_intern("size"), 0, NULL));
+    $1 = NUM2INT(rb_funcall($input, rb_intern("size"), 0, Qnil));
     $2 = NULL;
     $3 = NULL;
     if ($1 > 0) {
@@ -3736,13 +3736,13 @@ of the keys) and then start looping over the elements in that array: 

%typemap(in) (int nattributes, const char **names, const int *values)
   (VALUE keys_arr, int i, VALUE key, VALUE val) {
     Check_Type($input, T_HASH);
-    $1 = NUM2INT(rb_funcall($input, rb_intern("size"), 0, NULL));
+    $1 = NUM2INT(rb_funcall($input, rb_intern("size"), 0, Qnil));
     $2 = NULL;
     $3 = NULL;
     if ($1 > 0) {
       $2 = (char **) malloc($1*sizeof(char *));
       $3 = (int *) malloc($1*sizeof(int));
-      keys_arr = rb_funcall($input, rb_intern("keys"), 0, NULL);
+      keys_arr = rb_funcall($input, rb_intern("keys"), 0, Qnil);
       for (i = 0; i < $1; i++) {
       }
     }
@@ -3758,13 +3758,13 @@ corresponding to that key in the hash: 

%typemap(in) (int nattributes, const char **names, const int *values)
   (VALUE keys_arr, int i, VALUE key, VALUE val) {
     Check_Type($input, T_HASH);
-    $1 = NUM2INT(rb_funcall($input, rb_intern("size"), 0, NULL));
+    $1 = NUM2INT(rb_funcall($input, rb_intern("size"), 0, Qnil));
     $2 = NULL;
     $3 = NULL;
     if ($1 > 0) {
       $2 = (char **) malloc($1*sizeof(char *));
       $3 = (int *) malloc($1*sizeof(int));
-      keys_arr = rb_funcall($input, rb_intern("keys"), 0, NULL);
+      keys_arr = rb_funcall($input, rb_intern("keys"), 0, Qnil);
       for (i = 0; i < $1; i++) {
         key = rb_ary_entry(keys_arr, i);
         val = rb_hash_aref($input, key);
@@ -3781,13 +3781,13 @@ value is a Fixnum: 

%typemap(in) (int nattributes, const char **names, const int *values)
   (VALUE keys_arr, int i, VALUE key, VALUE val) {
     Check_Type($input, T_HASH);
-    $1 = NUM2INT(rb_funcall($input, rb_intern("size"), 0, NULL));
+    $1 = NUM2INT(rb_funcall($input, rb_intern("size"), 0, Qnil));
     $2 = NULL;
     $3 = NULL;
     if ($1 > 0) {
       $2 = (char **) malloc($1*sizeof(char *));
       $3 = (int *) malloc($1*sizeof(int));
-      keys_arr = rb_funcall($input, rb_intern("keys"), 0, NULL);
+      keys_arr = rb_funcall($input, rb_intern("keys"), 0, Qnil);
       for (i = 0; i < $1; i++) {
         key = rb_ary_entry(keys_arr, i);
         val = rb_hash_aref($input, key);
@@ -3805,13 +3805,13 @@ equivalents and store them in our local C arrays: 

%typemap(in) (int nattributes, const char **names, const int *values)
   (VALUE keys_arr, int i, VALUE key, VALUE val) {
   Check_Type($input, T_HASH);
-  $1 = NUM2INT(rb_funcall($input, rb_intern("size"), 0, NULL));
+  $1 = NUM2INT(rb_funcall($input, rb_intern("size"), 0, Qnil));
   $2 = NULL;
   $3 = NULL;
   if ($1 > 0) {
     $2 = (char **) malloc($1*sizeof(char *));
     $3 = (int *) malloc($1*sizeof(int));
-    keys_arr = rb_funcall($input, rb_intern("keys"), 0, NULL);
+    keys_arr = rb_funcall($input, rb_intern("keys"), 0, Qnil);
     for (i = 0; i < $1; i++) {
       key = rb_ary_entry(keys_arr, i);
       val = rb_hash_aref($input, key);
diff --git a/Examples/ruby/hashargs/example.i b/Examples/ruby/hashargs/example.i
index 10e209e5f..4c3f3070b 100644
--- a/Examples/ruby/hashargs/example.i
+++ b/Examples/ruby/hashargs/example.i
@@ -2,13 +2,13 @@
 
 %typemap(in) (int nattributes, const char **names, const int *values) (VALUE keys_ary, int i, VALUE key, VALUE val) {
   Check_Type($input, T_HASH);
-  $1 = NUM2INT(rb_funcall($input, rb_intern("size"), 0, NULL));
+  $1 = NUM2INT(rb_funcall($input, rb_intern("size"), 0, Qnil));
   $2 = NULL;
   $3 = NULL;
   if ($1 > 0) {
     $2 = (char **) malloc($1*sizeof(char *));
     $3 = (int *) malloc($1*sizeof(int));
-    keys_ary = rb_funcall($input, rb_intern("keys"), 0, NULL);
+    keys_ary = rb_funcall($input, rb_intern("keys"), 0, Qnil);
     for (i = 0; i < $1; i++) {
       key = rb_ary_entry(keys_ary, i);
       val = rb_hash_aref($input, key);
diff --git a/Source/Modules/ruby.cxx b/Source/Modules/ruby.cxx
index 69a849d16..641604620 100644
--- a/Source/Modules/ruby.cxx
+++ b/Source/Modules/ruby.cxx
@@ -3046,7 +3046,7 @@ public:
       if (argc > 0) {
 	Printf(w->code, "%s = rb_funcall(swig_get_self(), rb_intern(\"%s\"), %d%s);\n", Swig_cresult_name(), methodName, argc, args);
       } else {
-	Printf(w->code, "%s = rb_funcall(swig_get_self(), rb_intern(\"%s\"), 0, NULL);\n", Swig_cresult_name(), methodName);
+	Printf(w->code, "%s = rb_funcall(swig_get_self(), rb_intern(\"%s\"), 0, Qnil);\n", Swig_cresult_name(), methodName);
       }
       if ( initstack ) Printf(w->code, "SWIG_RELEASE_STACK;\n");
     }