From 2bc4bfd7fb46ab1ca17c554c3c41f52f638053a5 Mon Sep 17 00:00:00 2001 From: Mark Stemm Date: Thu, 3 Oct 2019 18:36:15 -0700 Subject: [PATCH] Specify namespace compat w/ gcc 5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I wasn't able to compile the dev branch with gcc 5.4 (e.g. not using the builder), getting this error: ``` .../falco/userspace/falco/grpc_server.cpp:40:109: error: specialization of ‘template void falco::grpc::request_stream_context::start(falco::grpc::server*)’ in different namespace [-fpermissive] void falco::grpc::request_stream_context::start(server* srv) ^ In file included from .../falco/userspace/falco/grpc_server.cpp:26:0: .../falco/userspace/falco/grpc_server.h:102:7: error: from definition of ‘template void falco::grpc::request_stream_context::start(falco::grpc::server*)’ [-fpermissive] void start(server* srv); ``` It looks like gcc 5.4 doesn't handle a declaration with namespace blocks but a definition with namespaces in the function. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480 has more detail. A workaround is to add `namespace falco {` and `namespace grpc {` around the declarations. Signed-off-by: Mark Stemm --- userspace/falco/grpc_server.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/userspace/falco/grpc_server.cpp b/userspace/falco/grpc_server.cpp index 2ec98c5d..4aac8991 100644 --- a/userspace/falco/grpc_server.cpp +++ b/userspace/falco/grpc_server.cpp @@ -36,8 +36,13 @@ limitations under the License. ctx.start(this); \ } +namespace falco +{ +namespace grpc +{ + template<> -void falco::grpc::request_stream_context::start(server* srv) +void request_stream_context::start(server* srv) { m_state = request_context_base::REQUEST; m_srv_ctx.reset(new ::grpc::ServerContext); @@ -50,7 +55,7 @@ void falco::grpc::request_stream_context -void falco::grpc::request_stream_context::process(server* srv) +void request_stream_context::process(server* srv) { // When it is the 1st process call if(m_state == request_context_base::REQUEST) @@ -79,7 +84,7 @@ void falco::grpc::request_stream_context -void falco::grpc::request_stream_context::end(server* srv, bool errored) +void request_stream_context::end(server* srv, bool errored) { if(m_stream_ctx) { @@ -92,6 +97,8 @@ void falco::grpc::request_stream_context