From c0fe7400d2a4fa334558c73be3a6f1f2dd0f0bf7 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Tue, 14 Sep 2010 06:34:57 +0000 Subject: Fix undefined behaviour with Ruby and autodoc generation git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12218 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/Modules/ruby.cxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'Source/Modules/ruby.cxx') diff --git a/Source/Modules/ruby.cxx b/Source/Modules/ruby.cxx index bcdfd69d3..3887d8a98 100644 --- a/Source/Modules/ruby.cxx +++ b/Source/Modules/ruby.cxx @@ -121,6 +121,7 @@ public: /* flags for the make_autodoc function */ enum autodoc_t { + AUTODOC_NOTSET, AUTODOC_CLASS, AUTODOC_CTOR, AUTODOC_DTOR, @@ -580,6 +581,9 @@ private: case AUTODOC_SETTER: Printf(doc, " Document-method: %s.%s=\n\n", full_name, symname); break; + case AUTODOC_NOTSET: + assert(0); + break; } } @@ -608,6 +612,9 @@ private: if (type) Printf(doc, " -> %s", type); break; } + case AUTODOC_NOTSET: + assert(0); + break; default: break; } @@ -665,6 +672,9 @@ private: if (type) Printf(doc, " -> %s", type); break; } + case AUTODOC_NOTSET: + assert(0); + break; } } @@ -698,6 +708,9 @@ private: case AUTODOC_SETTER: Printf(doc, "Set new value for attribute.\n"); break; + case AUTODOC_NOTSET: + assert(0); + break; } } @@ -762,6 +775,7 @@ public: modvar = 0; feature = 0; prefix = 0; + last_mode = AUTODOC_NOTSET, last_autodoc = NewString(""); current = NO_CPP; classes = 0; -- cgit v1.2.1 From a202bf98183f8ef66d83d3c75e22078bcfdc4922 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Tue, 14 Sep 2010 18:52:18 +0000 Subject: Fix undefined behaviour git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12220 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/Modules/ruby.cxx | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'Source/Modules/ruby.cxx') diff --git a/Source/Modules/ruby.cxx b/Source/Modules/ruby.cxx index 3887d8a98..bcdfd69d3 100644 --- a/Source/Modules/ruby.cxx +++ b/Source/Modules/ruby.cxx @@ -121,7 +121,6 @@ public: /* flags for the make_autodoc function */ enum autodoc_t { - AUTODOC_NOTSET, AUTODOC_CLASS, AUTODOC_CTOR, AUTODOC_DTOR, @@ -581,9 +580,6 @@ private: case AUTODOC_SETTER: Printf(doc, " Document-method: %s.%s=\n\n", full_name, symname); break; - case AUTODOC_NOTSET: - assert(0); - break; } } @@ -612,9 +608,6 @@ private: if (type) Printf(doc, " -> %s", type); break; } - case AUTODOC_NOTSET: - assert(0); - break; default: break; } @@ -672,9 +665,6 @@ private: if (type) Printf(doc, " -> %s", type); break; } - case AUTODOC_NOTSET: - assert(0); - break; } } @@ -708,9 +698,6 @@ private: case AUTODOC_SETTER: Printf(doc, "Set new value for attribute.\n"); break; - case AUTODOC_NOTSET: - assert(0); - break; } } @@ -775,7 +762,6 @@ public: modvar = 0; feature = 0; prefix = 0; - last_mode = AUTODOC_NOTSET, last_autodoc = NewString(""); current = NO_CPP; classes = 0; -- cgit v1.2.1 From 1e051820ec601ca34bbd8abc4926193319708e3e Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Tue, 21 Sep 2010 06:07:06 +0000 Subject: Line/file reporting corrections for warnings: WARN_RUBY_MULTIPLE_INHERITANCE, WARN_TYPE_UNDEFINED_CLASS, WARN_MODULA3_MULTIPLE_INHERITANCE git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12225 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/Modules/ruby.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Modules/ruby.cxx') diff --git a/Source/Modules/ruby.cxx b/Source/Modules/ruby.cxx index bcdfd69d3..ab1210a79 100644 --- a/Source/Modules/ruby.cxx +++ b/Source/Modules/ruby.cxx @@ -2395,7 +2395,7 @@ public: } String *proxyclassname = SwigType_str(Getattr(n, "classtypeobj"), 0); String *baseclassname = SwigType_str(Getattr(base.item, "name"), 0); - Swig_warning(WARN_RUBY_MULTIPLE_INHERITANCE, input_file, line_number, + Swig_warning(WARN_RUBY_MULTIPLE_INHERITANCE, Getfile(n), Getline(n), "Warning for %s proxy: Base %s ignored. Multiple inheritance is not supported in Ruby.\n", proxyclassname, baseclassname); base = Next(base); } -- cgit v1.2.1 From eaada32f264f828ec326f4c91f5c1a73399a8897 Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Fri, 1 Oct 2010 04:42:29 +0000 Subject: [Ruby] Avoid segfault when a method node has no parentNode (SF#3034054). git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12237 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/Modules/ruby.cxx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'Source/Modules/ruby.cxx') diff --git a/Source/Modules/ruby.cxx b/Source/Modules/ruby.cxx index ab1210a79..8461b8bef 100644 --- a/Source/Modules/ruby.cxx +++ b/Source/Modules/ruby.cxx @@ -2054,8 +2054,15 @@ public: // Construct real method name String* methodName = NewString(""); - if ( isMethod ) - Printv( methodName, Getattr(parentNode(sibl),"sym:name"), ".", NIL ); + if ( isMethod ) { + // Sometimes a method node has no parent (SF#3034054). + // This value is used in an exception message, so just skip the class + // name in this case so at least we don't segfault. This is probably + // just working around a problem elsewhere though. + Node *parent_node = parentNode(sibl); + if (parent_node) + Printv( methodName, Getattr(parent_node,"sym:name"), ".", NIL ); + } Append( methodName, Getattr(sibl,"sym:name" ) ); if ( isCtor ) Append( methodName, ".new" ); -- cgit v1.2.1