c++ client: adjust kudu::client::sp In an upcoming change we'll begin using libc++ on Linux for TSAN builds. As macOS developers are probably aware, libc++ lacks TR1 support, so we need to extend our existing macOS-specific workaround for TR1 shared_ptrs to apply to any libc++ build.
This has no bearing on backwards compatibility as libc++ is still only used in non-shipping environments. Change-Id: I01a1ef6319c3464a8ec84f066adc885da200af70 Reviewed-on: http://gerrit.cloudera.org:8080/4510 Reviewed-by: Dan Burkert <[email protected]> Tested-by: Adar Dembo <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/kudu/repo Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/36001f40 Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/36001f40 Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/36001f40 Branch: refs/heads/master Commit: 36001f40c683d213aa1e8b35270c9796ce51979c Parents: bafbc4a Author: Adar Dembo <[email protected]> Authored: Tue Sep 20 16:21:52 2016 -0700 Committer: Adar Dembo <[email protected]> Committed: Mon Sep 26 19:20:52 2016 +0000 ---------------------------------------------------------------------- src/kudu/client/shared_ptr.h | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kudu/blob/36001f40/src/kudu/client/shared_ptr.h ---------------------------------------------------------------------- diff --git a/src/kudu/client/shared_ptr.h b/src/kudu/client/shared_ptr.h index fb66a4b..79155e5 100644 --- a/src/kudu/client/shared_ptr.h +++ b/src/kudu/client/shared_ptr.h @@ -25,18 +25,15 @@ /// does not require c++11. We use std::tr1::shared_ptr in our public interface /// to hold shared instances of KuduClient, KuduSession, and KuduTable. /// -/// Unfortunately, if using clang on OS X, libc++ is the default -/// C++ standard library implementation and it is required when compiling -/// with c++11. However, libc++ does not include the TR1 APIs. As a workaround, -/// we use std::shared_ptr on OS X. Since OS X is for development only, -/// it is acceptable to require clients to compile with c++11. +/// However, if building with libc++ (e.g. if building on macOS), the TR1 APIs +/// are not implemented. As a workaround, we use std::shared_ptr with libc++. /// -/// In order to allow applications to compile against Kudu on both Linux and OS -/// X, we provide this typedef which resolves to std::tr1::shared_ptr on Linux -/// and std::shared_ptr on OS X. Clients are encouraged to use these typedefs in -/// order to ensure that applications will compile on both Linux and OS X. +/// In order to allow applications to compile against Kudu with libstdc++ as +/// well as with libc++, macros are provided that will resolve to the correct +/// namespace in either case. Clients are encouraged to use these macros in +/// order to ensure that applications compile universally. -#if defined(__APPLE__) +#if defined(_LIBCPP_VERSION) #include <memory> namespace kudu {
