From 11f64fb34904914a85e7321c11cc477af1536a7b Mon Sep 17 00:00:00 2001 From: vjpai Date: Wed, 25 Mar 2015 14:23:59 -0700 Subject: Make a fake version of nullptr to satisfy old compilers --- include/grpc++/config.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/grpc++/config.h b/include/grpc++/config.h index 35bf507364..e10f00fb63 100644 --- a/include/grpc++/config.h +++ b/include/grpc++/config.h @@ -65,6 +65,26 @@ ::google::protobuf::io::ZeroCopyInputStream #endif +#ifdef __GNUC__ +#if (__GNUC__ * 100 + __GNUC_MINOR__ < 406) +#define GRPC_NO_NULLPTR +#endif +#endif + +#ifdef GRPC_NO_NULLPTR +#include +const class { +public: + template operator T*() const {return static_cast(0);} + template operator std::unique_ptr() const { + return std::unique_ptr(static_cast(0)); + } + operator bool() const {return false;} +private: + void operator&() const = delete; +} nullptr = {}; +#endif + namespace grpc { typedef GRPC_CUSTOM_STRING string; -- cgit v1.2.3 From 4bcab68012662b0cd63abb769f3e309604d1fb91 Mon Sep 17 00:00:00 2001 From: vjpai Date: Thu, 26 Mar 2015 13:21:24 -0700 Subject: Include the config.h file to make sure that nullptr is covered --- test/cpp/qps/timer.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/test/cpp/qps/timer.cc b/test/cpp/qps/timer.cc index 3c1342041c..d1b6bc1e55 100644 --- a/test/cpp/qps/timer.cc +++ b/test/cpp/qps/timer.cc @@ -36,6 +36,7 @@ #include #include #include +#include Timer::Timer() : start_(Sample()) {} -- cgit v1.2.3 From 92a928fa6846362c102d9628ce0453c6229fb9be Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Thu, 26 Mar 2015 16:30:22 -0400 Subject: Make string construction explicit as implicit conversion doesn't work in 4.4 --- test/cpp/end2end/async_end2end_test.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index 233c5b13a7..9938fcf12e 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -532,15 +532,19 @@ TEST_F(AsyncEnd2endTest, MetadataRpc) { send_request.set_message("Hello"); std::pair meta1("key1", "val1"); std::pair meta2( - "key2-bin", {"\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc", 13}); + "key2-bin", + grpc::string("\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc", + 13)); std::pair meta3("key3", "val3"); std::pair meta6( "key4-bin", - {"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d", 14}); + grpc::string("\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d", + 14)); std::pair meta5("key5", "val5"); std::pair meta4( "key6-bin", - {"\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee", 15}); + grpc::string("\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee", + 15)); cli_ctx.AddMetadata(meta1.first, meta1.second); cli_ctx.AddMetadata(meta2.first, meta2.second); -- cgit v1.2.3 From 6130809a8bc792c952cb15f4931634cc47b35219 Mon Sep 17 00:00:00 2001 From: vjpai Date: Thu, 26 Mar 2015 17:12:17 -0400 Subject: Work around a compiler limitation caused by inability to properly handle vectors created from initializer list --- test/cpp/interop/server.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/cpp/interop/server.cc b/test/cpp/interop/server.cc index eceb600d4c..780a7370ac 100644 --- a/test/cpp/interop/server.cc +++ b/test/cpp/interop/server.cc @@ -213,8 +213,11 @@ void RunServer() { builder.RegisterService(&service); std::shared_ptr creds = grpc::InsecureServerCredentials(); if (FLAGS_enable_ssl) { - SslServerCredentialsOptions ssl_opts = { - "", {{test_server1_key, test_server1_cert}}}; + SslServerCredentialsOptions::PemKeyCertPair pkcp = {test_server1_key, + test_server1_cert}; + SslServerCredentialsOptions ssl_opts; + ssl_opts.pem_root_certs = ""; + ssl_opts.pem_key_cert_pairs.push_back(pkcp); creds = grpc::SslServerCredentials(ssl_opts); } builder.AddListeningPort(server_address.str(), creds); -- cgit v1.2.3