From 4f0540eb1cb88fc30bca403b422aa23ab73b8400 Mon Sep 17 00:00:00 2001 From: Yuval Lifshitz Date: Sun, 11 Apr 2021 19:37:39 +0300 Subject: [PATCH] rgw/amqp/test: fix mock prototype for librabbitmq-0.11.0 also use extern C for to get compilation errors when function prototype change Fixes: https://tracker.ceph.com/issues/50291 Signed-off-by: Yuval Lifshitz (cherry picked from commit 2ba598ec4c294bd09d2df18ccd2096382e303d39) --- src/test/rgw/amqp_mock.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/test/rgw/amqp_mock.cc b/src/test/rgw/amqp_mock.cc index e37151e48fc72..0d0c4a2719886 100644 --- a/src/test/rgw/amqp_mock.cc +++ b/src/test/rgw/amqp_mock.cc @@ -98,6 +98,8 @@ struct amqp_socket_t_ { } }; +extern "C" { + amqp_connection_state_t AMQP_CALL amqp_new_connection(void) { auto s = new amqp_connection_state_t_; return s; @@ -256,7 +258,11 @@ amqp_confirm_select_ok_t* amqp_confirm_select(amqp_connection_state_t state, amq return state->confirm; } +#if AMQP_VERSION >= AMQP_VERSION_CODE(0, 11, 0, 1) +int amqp_simple_wait_frame_noblock(amqp_connection_state_t state, amqp_frame_t *decoded_frame, const struct timeval* tv) { +#else int amqp_simple_wait_frame_noblock(amqp_connection_state_t state, amqp_frame_t *decoded_frame, struct timeval* tv) { +#endif if (state->socket && state->socket->open_called && state->login_called && state->channel1 && state->channel2 && state->exchange && state->queue && state->consume && state->confirm && !FAIL_NEXT_READ) { @@ -320,6 +326,8 @@ amqp_basic_consume_ok_t* amqp_basic_consume( return state->consume; } +} // extern "C" + // amqp_parse_url() is linked via the actual rabbitmq-c library code. see: amqp_url.c // following functions are the actual implementation copied from rabbitmq-c library @@ -345,3 +353,4 @@ amqp_bytes_t amqp_bytes_malloc_dup(amqp_bytes_t src) { return result; } + -- 2.47.3