From fe34585b5bdc1e2bc52989825539c0b834502590 Mon Sep 17 00:00:00 2001 From: Evgeny Yakimov Date: Tue, 6 Apr 2021 14:12:40 +0100 Subject: [PATCH 1/2] Add Threads to public CMake artefacts (#647) Threads is required by some targets which are exposed through the public CMake configs. When they are attempted to be used, they will cause an error if the including project doesn't call `find_package(Threads)` themselves. --- opentelemetry-cpp-config.cmake.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/opentelemetry-cpp-config.cmake.in b/opentelemetry-cpp-config.cmake.in index 0d04390324..589d4acabc 100644 --- a/opentelemetry-cpp-config.cmake.in +++ b/opentelemetry-cpp-config.cmake.in @@ -55,6 +55,8 @@ set(OPENTELEMETRY_VERSION # ############################################################################## +find_package(Threads) + set_and_check(OPENTELEMETRY_CPP_INCLUDE_DIRS "@PACKAGE_INCLUDE_INSTALL_DIR@") set_and_check(OPENTELEMETRY_CPP_LIBRARY_DIRS "@PACKAGE_CMAKE_INSTALL_LIBDIR@") From 1a5737af039d6739e19a762bef146bb893bcd9f0 Mon Sep 17 00:00:00 2001 From: Siim Kallas Date: Tue, 6 Apr 2021 18:50:09 +0300 Subject: [PATCH 2/2] add missing inline specifiers (#660) --- api/include/opentelemetry/trace/propagation/detail/context.h | 2 +- api/include/opentelemetry/trace/propagation/detail/hex.h | 4 ++-- api/include/opentelemetry/trace/propagation/detail/string.h | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/api/include/opentelemetry/trace/propagation/detail/context.h b/api/include/opentelemetry/trace/propagation/detail/context.h index 9a1e30db29..5a5e454bb9 100644 --- a/api/include/opentelemetry/trace/propagation/detail/context.h +++ b/api/include/opentelemetry/trace/propagation/detail/context.h @@ -9,7 +9,7 @@ namespace propagation namespace detail { -trace::SpanContext GetCurrentSpan(const context::Context &context) +inline trace::SpanContext GetCurrentSpan(const context::Context &context) { context::ContextValue span = context.GetValue(trace::kSpanKey); if (nostd::holds_alternative>(span)) diff --git a/api/include/opentelemetry/trace/propagation/detail/hex.h b/api/include/opentelemetry/trace/propagation/detail/hex.h index ebce903c6f..779eff55cf 100644 --- a/api/include/opentelemetry/trace/propagation/detail/hex.h +++ b/api/include/opentelemetry/trace/propagation/detail/hex.h @@ -32,7 +32,7 @@ inline int8_t HexToInt(char c) return kHexDigits[uint8_t(c)]; } -bool IsValidHex(nostd::string_view s) +inline bool IsValidHex(nostd::string_view s) { return std::all_of(s.begin(), s.end(), [](char c) { return HexToInt(c) != -1; }); } @@ -41,7 +41,7 @@ bool IsValidHex(nostd::string_view s) * Converts a hexadecimal to binary format if the hex string will fit the buffer. * Smaller hex strings are left padded with zeroes. */ -bool HexToBinary(nostd::string_view hex, uint8_t *buffer, size_t buffer_size) +inline bool HexToBinary(nostd::string_view hex, uint8_t *buffer, size_t buffer_size) { std::memset(buffer, 0, buffer_size); diff --git a/api/include/opentelemetry/trace/propagation/detail/string.h b/api/include/opentelemetry/trace/propagation/detail/string.h index c9ebcbf52c..a47fd4a2cc 100644 --- a/api/include/opentelemetry/trace/propagation/detail/string.h +++ b/api/include/opentelemetry/trace/propagation/detail/string.h @@ -14,7 +14,10 @@ namespace detail * Splits a string by separator, up to given buffer count words. * Returns the amount of words the input was split into. */ -size_t SplitString(nostd::string_view s, char separator, nostd::string_view *results, size_t count) +inline size_t SplitString(nostd::string_view s, + char separator, + nostd::string_view *results, + size_t count) { if (count == 0) {