diff --git a/cmake/GoogleCloudCppCommon.cmake b/cmake/GoogleCloudCppCommon.cmake index d6084628cbf52..334f2fc196eb3 100644 --- a/cmake/GoogleCloudCppCommon.cmake +++ b/cmake/GoogleCloudCppCommon.cmake @@ -80,6 +80,8 @@ elseif (GOOGLE_CLOUD_CPP_GENERATE_DOXYGEN) "GOOGLE_CLOUD_CPP_IAM_DEPRECATED(x)=" "GOOGLE_CLOUD_CPP_BIGTABLE_IAM_DEPRECATED(x)=" "GOOGLE_CLOUD_CPP_SPANNER_ADMIN_API_DEPRECATED(x)=" + "GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN=inline namespace omit_this_inline_ns {" + "GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END=}" "GOOGLE_CLOUD_CPP_NS=omit_this_inline_ns") set(DOXYGEN_HTML_TIMESTAMP YES) set(DOXYGEN_STRIP_FROM_INC_PATH "${PROJECT_SOURCE_DIR}") diff --git a/google/cloud/version.h b/google/cloud/version.h index 782f2d39d193d..cfd155c3b4d00 100644 --- a/google/cloud/version.h +++ b/google/cloud/version.h @@ -33,6 +33,24 @@ GOOGLE_CLOUD_CPP_VEVAL(GOOGLE_CLOUD_CPP_VERSION_MAJOR, \ GOOGLE_CLOUD_CPP_VERSION_MINOR) +/** + * Versioned inline namespace that users should generally avoid spelling. + * + * The actual inline namespace name will change with each release, and if you + * use it your code will be tightly coupled to a specific release. Omitting the + * inline namespace name will make upgrading to newer releases easier. + * + * However, applications may need to link multiple versions of the Google Cloud + * C++ Libraries, for example, if they link a library that uses an older + * version of the libraries than they do. This namespace is inlined, so + * applications can use `google::cloud::Foo` in their source, but the symbols + * are versioned, i.e., the symbol becomes `google::cloud::vXYZ::Foo`. + */ +#define GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN \ + inline namespace GOOGLE_CLOUD_CPP_NS { +#define GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END \ + } // namespace GOOGLE_CLOUD_CPP_NS + // This preprocessor symbol is deprecated and should never be used anywhere. It // exists solely for backward compatibility to avoid breaking anyone who may // have been using it.