summaryrefslogtreecommitdiff
path: root/ruby/src/IceRuby/Util.cpp
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2018-10-26 17:17:11 -0400
committerBernard Normier <bernard@zeroc.com>2018-10-26 17:17:11 -0400
commit42c905a3ca29a1e911e7def9c2d9d9b8e95383cd (patch)
tree1b704d084e39c0acd15859f2dd258eff7aaa7fc6 /ruby/src/IceRuby/Util.cpp
parentDo not use time.clock() with Python >= 3.3 as it is deprecated (diff)
downloadice-42c905a3ca29a1e911e7def9c2d9d9b8e95383cd.tar.bz2
ice-42c905a3ca29a1e911e7def9c2d9d9b8e95383cd.tar.xz
ice-42c905a3ca29a1e911e7def9c2d9d9b8e95383cd.zip
Extra C++ warning flags with clang and g++.
Fixes 223.
Diffstat (limited to 'ruby/src/IceRuby/Util.cpp')
-rw-r--r--ruby/src/IceRuby/Util.cpp23
1 files changed, 5 insertions, 18 deletions
diff --git a/ruby/src/IceRuby/Util.cpp b/ruby/src/IceRuby/Util.cpp
index 1e042914306..dc151808771 100644
--- a/ruby/src/IceRuby/Util.cpp
+++ b/ruby/src/IceRuby/Util.cpp
@@ -22,22 +22,10 @@ using namespace IceRuby;
namespace
{
-#ifndef NDEBUG
-bool
-checkIsInstance(VALUE p, const char* type)
-{
- volatile VALUE rbType = callRuby(rb_path2class, type);
- assert(!NIL_P(rbType));
- return callRuby(rb_obj_is_instance_of, p, rbType) == Qtrue;
-}
-#endif
-
template<typename T>
bool
-setVersion(VALUE p, const T& version, const char* type)
+setVersion(VALUE p, const T& version)
{
- assert(checkIsInstance(p, type));
-
volatile VALUE major = callRuby(rb_int2inum, version.major);
volatile VALUE minor = callRuby(rb_int2inum, version.minor);
rb_ivar_set(p, rb_intern("@major"), major);
@@ -48,9 +36,8 @@ setVersion(VALUE p, const T& version, const char* type)
template<typename T>
bool
-getVersion(VALUE p, T& v, const char* type)
+getVersion(VALUE p, T& v)
{
- assert(checkIsInstance(p, type));
volatile VALUE major = callRuby(rb_ivar_get, p, rb_intern("@major"));
volatile VALUE minor = callRuby(rb_ivar_get, p, rb_intern("@minor"));
@@ -84,7 +71,7 @@ createVersion(const T& version, const char* type)
volatile VALUE obj = callRuby(rb_class_new_instance, 0, static_cast<VALUE*>(0), rbType);
- if(!setVersion<T>(obj, version, type))
+ if(!setVersion<T>(obj, version))
{
return Qnil;
}
@@ -104,7 +91,7 @@ versionToString(VALUE p, const char* type)
}
T v;
- if(!getVersion<T>(p, v, type))
+ if(!getVersion<T>(p, v))
{
return Qnil;
}
@@ -552,7 +539,7 @@ IceRuby::getEncodingVersion(VALUE p, Ice::EncodingVersion& v)
throw RubyException(rb_eTypeError, "value is not an Ice::EncodingVersion");
}
- if(!getVersion<Ice::EncodingVersion>(p, v, Ice_EncodingVersion))
+ if(!getVersion<Ice::EncodingVersion>(p, v))
{
return false;
}