You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2018/02/14 16:51:22 UTC
[4/4] qpid-proton git commit: PROTON-1738: [ruby] Fix compile
warnings in SWIG source
PROTON-1738: [ruby] Fix compile warnings in SWIG source
Correct feature checks to cover >= 2.0.0, fix compile warnings for RB_BLOCKING_CALL.
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/9a8f9f59
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/9a8f9f59
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/9a8f9f59
Branch: refs/heads/master
Commit: 9a8f9f59a59d93d5bbe9755f3f893b47bf24aa76
Parents: 5c7db4d
Author: Alan Conway <ac...@redhat.com>
Authored: Wed Feb 14 11:36:31 2018 -0500
Committer: Alan Conway <ac...@redhat.com>
Committed: Wed Feb 14 11:36:31 2018 -0500
----------------------------------------------------------------------
proton-c/bindings/ruby/CMakeLists.txt | 14 ++++++++------
proton-c/bindings/ruby/cproton.i | 18 +++++++++++-------
2 files changed, 19 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9a8f9f59/proton-c/bindings/ruby/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/CMakeLists.txt b/proton-c/bindings/ruby/CMakeLists.txt
index e41b49f..8df7b55 100644
--- a/proton-c/bindings/ruby/CMakeLists.txt
+++ b/proton-c/bindings/ruby/CMakeLists.txt
@@ -30,12 +30,14 @@ include_directories (${RUBY_INCLUDE_PATH})
swig_add_library(cproton-ruby LANGUAGE ruby SOURCES cproton.i)
swig_link_libraries(cproton-ruby ${BINDING_DEPS} ${RUBY_LIBRARY})
-# set a compiler macro to relay the Ruby version to the extension.
-# Don't use the global CMAKE_C_FLAGS, -fvisibility=hidden causes an obscure
-# failure with release builds.
-string(REPLACE "." "" CFLAG_RUBY_VERSION "${RUBY_VERSION}")
-string(SUBSTRING "${CFLAG_RUBY_VERSION}" 0 2 CFLAG_RUBY_VERSION)
-set(CMAKE_C_FLAGS "-DRUBY${CFLAG_RUBY_VERSION}")
+# Set version-dependent compile flags
+if (RUBY_VERSION VERSION_LESS 2.0.0)
+ set(RUBY_C_FLAGS "-DRUBY_USE_rb_thread_blocking_region")
+else()
+ set(RUBY_C_FLAGS "-DRUBY_USE_rb_thread_call_without_gvl")
+endif()
+# Replace global CMAKE_C_FLAGS, -fvisibility=hidden causes an obscure failure with release builds.
+set(CMAKE_C_FLAGS "${RUBY_C_FLAGS}")
set_target_properties(cproton-ruby
PROPERTIES
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9a8f9f59/proton-c/bindings/ruby/cproton.i
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/cproton.i b/proton-c/bindings/ruby/cproton.i
index 0f162fa..4dcae01 100644
--- a/proton-c/bindings/ruby/cproton.i
+++ b/proton-c/bindings/ruby/cproton.i
@@ -324,19 +324,23 @@ bool pn_ssl_get_cipher_name(pn_ssl_t *ssl, char *OUTPUT, size_t MAX_OUTPUT_SIZE)
bool pn_ssl_get_protocol_name(pn_ssl_t *ssl, char *OUTPUT, size_t MAX_OUTPUT_SIZE);
%ignore pn_ssl_get_protocol_name;
-%inline %{
-#if defined(RUBY20) || defined(RUBY21)
+/* TODO aconway 2018-02-14: Remove RB_BLOCKING_CALL once messenger is deprecated */
+
+/* Don't use %inline sections for #define */
+%{
+#if defined(RUBY_USE_rb_thread_call_without_gvl)
+ #include <ruby/thread.h>
typedef void *non_blocking_return_t;
-#define RB_BLOCKING_CALL rb_thread_call_without_gvl
+ #define RB_BLOCKING_CALL (VALUE)rb_thread_call_without_gvl
-#elif defined(RUBY19)
+#elif defined(RUBY_USE_rb_thread_blocking_region)
- typedef VALUE non_blocking_return_t;
-#define RB_BLOCKING_CALL rb_thread_blocking_region
+ typedef VALUE non_blocking_return_t;
+ #define RB_BLOCKING_CALL rb_thread_blocking_region
#endif
- %}
+%}
%rename(pn_messenger_send) wrap_pn_messenger_send;
%rename(pn_messenger_recv) wrap_pn_messenger_recv;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org