PROTON-949: fix proton build with ccache swig Moved macro calls and preprocessor directives out of %inline sections, seems to fix the problem.
NOTE: According to ccache-swig man page: "Known problems are using preprocessor directives within %inline blocks and the use of â#pragma SWIGâ." This includes using any macros in an %inline section. Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/2a1e1e7a Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/2a1e1e7a Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/2a1e1e7a Branch: refs/heads/go1 Commit: 2a1e1e7a03d6e23dea83ade03446d983026d4476 Parents: cdcc897 Author: Alan Conway <[email protected]> Authored: Tue Nov 3 10:12:40 2015 -0500 Committer: Alan Conway <[email protected]> Committed: Tue Nov 3 10:44:00 2015 -0500 ---------------------------------------------------------------------- proton-c/bindings/python/cproton.i | 13 +++++- proton-c/bindings/ruby/ruby.i | 75 +++++++++++++++++++-------------- 2 files changed, 54 insertions(+), 34 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/2a1e1e7a/proton-c/bindings/python/cproton.i ---------------------------------------------------------------------- diff --git a/proton-c/bindings/python/cproton.i b/proton-c/bindings/python/cproton.i index 0ead44d..f7f56e3 100644 --- a/proton-c/bindings/python/cproton.i +++ b/proton-c/bindings/python/cproton.i @@ -25,11 +25,22 @@ #include <proton/engine.h> #include <proton/url.h> #include <proton/message.h> +#include <proton/object.h> #include <proton/sasl.h> #include <proton/messenger.h> #include <proton/ssl.h> #include <proton/reactor.h> #include <proton/handlers.h> + +/* +NOTE: According to ccache-swig man page: "Known problems are using +preprocessor directives within %inline blocks and the use of â#pragma SWIGâ." +This includes using macros in an %inline section. + +Do any preprocessor work or macro expansions here before we get into the %inline sections. +*/ +PN_HANDLE(PNI_PYTRACER); + %} %include <cstring.i> @@ -354,8 +365,6 @@ bool pn_ssl_get_protocol_name(pn_ssl_t *ssl, char *OUTPUT, size_t MAX_OUTPUT_SIZ return chandler; } - PN_HANDLE(PNI_PYTRACER); - void pn_pytracer(pn_transport_t *transport, const char *message) { PyObject *pytracer = (PyObject *) pn_record_get(pn_transport_attachments(transport), PNI_PYTRACER); SWIG_PYTHON_THREAD_BEGIN_BLOCK; http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/2a1e1e7a/proton-c/bindings/ruby/ruby.i ---------------------------------------------------------------------- diff --git a/proton-c/bindings/ruby/ruby.i b/proton-c/bindings/ruby/ruby.i index dbbd719..eddd529 100644 --- a/proton-c/bindings/ruby/ruby.i +++ b/proton-c/bindings/ruby/ruby.i @@ -28,6 +28,47 @@ #include <proton/url.h> #include <proton/reactor.h> #include <proton/handlers.h> + + +/* +NOTE: According to ccache-swig man page: "Known problems are using +preprocessor directives within %inline blocks and the use of â#pragma SWIGâ." +This includes using any macros in an %inline section. + +Do any preprocessor work or macro expansions here before we get into the %inline sections. +*/ + +#define CID_Pn_rbkey CID_pn_void + +typedef struct { + void *registry; + char *method; + char *key_value; +} Pn_rbkey_t; + +void Pn_rbkey_initialize(Pn_rbkey_t *rbkey) { + assert(rbkey); + rbkey->registry = NULL; + rbkey->method = NULL; + rbkey->key_value = NULL; +} + +void Pn_rbkey_finalize(Pn_rbkey_t *rbkey) { + if(rbkey && rbkey->registry && rbkey->method && rbkey->key_value) { + rb_funcall((VALUE )rbkey->registry, rb_intern(rbkey->method), 1, rb_str_new2(rbkey->key_value)); + } + if(rbkey->key_value) { + free(rbkey->key_value); + rbkey->key_value = NULL; + } +} + +#define Pn_rbkey_inspect NULL +#define Pn_rbkey_compare NULL +#define Pn_rbkey_hashcode NULL + +PN_CLASSDEF(Pn_rbkey) + %} %include <cstring.i> @@ -465,37 +506,6 @@ bool pn_ssl_get_protocol_name(pn_ssl_t *ssl, char *OUTPUT, size_t MAX_OUTPUT_SIZ %inline %{ -#define CID_Pn_rbkey CID_pn_void - -typedef struct { - void *registry; - char *method; - char *key_value; -} Pn_rbkey_t; - -void Pn_rbkey_initialize(Pn_rbkey_t *rbkey) { - assert(rbkey); - rbkey->registry = NULL; - rbkey->method = NULL; - rbkey->key_value = NULL; -} - -void Pn_rbkey_finalize(Pn_rbkey_t *rbkey) { - if(rbkey && rbkey->registry && rbkey->method && rbkey->key_value) { - rb_funcall((VALUE )rbkey->registry, rb_intern(rbkey->method), 1, rb_str_new2(rbkey->key_value)); - } - if(rbkey->key_value) { - free(rbkey->key_value); - rbkey->key_value = NULL; - } -} - -#define Pn_rbkey_inspect NULL -#define Pn_rbkey_compare NULL -#define Pn_rbkey_hashcode NULL - -PN_CLASSDEF(Pn_rbkey) - void Pn_rbkey_set_registry(Pn_rbkey_t *rbkey, void *registry) { assert(rbkey); rbkey->registry = registry; @@ -569,7 +579,8 @@ int pn_ssl_get_peer_hostname(pn_ssl_t *ssl, char *OUTPUT, size_t *OUTPUT_SIZE); } VALUE pni_ruby_get_from_registry(VALUE key) { - rb_funcall(pni_ruby_get_proton_module(), rb_intern("get_from_registry"), 1, key); + + return rb_funcall(pni_ruby_get_proton_module(), rb_intern("get_from_registry"), 1, key); } void pni_ruby_delete_from_registry(VALUE stored_key) { --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
