Skip to content

Commit

Permalink
Merge branch 'main' into fix-attributes-processor
Browse files Browse the repository at this point in the history
  • Loading branch information
lalitb authored Jan 23, 2024
2 parents d3cfa08 + 8da71b7 commit b349be3
Show file tree
Hide file tree
Showing 14 changed files with 314 additions and 40 deletions.
105 changes: 80 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,25 @@ jobs:
./ci/do_ci.sh cmake.test
cmake_gcc_maintainer_sync_test:
name: CMake gcc 12 (maintainer mode, sync)
name: CMake gcc 13 (maintainer mode, sync)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: setup
env:
CC: /usr/bin/gcc-12
CXX: /usr/bin/g++-12
CC: /usr/bin/gcc-13
CXX: /usr/bin/g++-13
PROTOBUF_VERSION: 21.12
run: |
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
sudo -E ./ci/install_protobuf.sh
- name: run cmake gcc (maintainer mode, sync)
env:
CC: /usr/bin/gcc-12
CXX: /usr/bin/g++-12
CC: /usr/bin/gcc-13
CXX: /usr/bin/g++-13
run: |
./ci/do_ci.sh cmake.maintainer.sync.test
- name: generate test cert
Expand All @@ -61,25 +61,25 @@ jobs:
(cd ./functional/otlp; ./run_test.sh)
cmake_gcc_maintainer_async_test:
name: CMake gcc 12 (maintainer mode, async)
name: CMake gcc 13 (maintainer mode, async)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: setup
env:
CC: /usr/bin/gcc-12
CXX: /usr/bin/g++-12
CC: /usr/bin/gcc-13
CXX: /usr/bin/g++-13
PROTOBUF_VERSION: 21.12
run: |
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
sudo -E ./ci/install_protobuf.sh
- name: run cmake gcc (maintainer mode, async)
env:
CC: /usr/bin/gcc-12
CXX: /usr/bin/g++-12
CC: /usr/bin/gcc-13
CXX: /usr/bin/g++-13
run: |
./ci/do_ci.sh cmake.maintainer.async.test
- name: generate test cert
Expand All @@ -93,25 +93,25 @@ jobs:
(cd ./functional/otlp; ./run_test.sh)
cmake_clang_maintainer_sync_test:
name: CMake clang 14 (maintainer mode, sync)
name: CMake clang 15 (maintainer mode, sync)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: setup
env:
CC: /usr/bin/clang-14
CXX: /usr/bin/clang++-14
CC: /usr/bin/clang-15
CXX: /usr/bin/clang++-15
PROTOBUF_VERSION: 21.12
run: |
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
sudo -E ./ci/install_protobuf.sh
- name: run cmake clang (maintainer mode, sync)
env:
CC: /usr/bin/clang-14
CXX: /usr/bin/clang++-14
CC: /usr/bin/clang-15
CXX: /usr/bin/clang++-15
run: |
./ci/do_ci.sh cmake.maintainer.sync.test
- name: generate test cert
Expand All @@ -125,25 +125,25 @@ jobs:
(cd ./functional/otlp; ./run_test.sh)
cmake_clang_maintainer_async_test:
name: CMake clang 14 (maintainer mode, async)
name: CMake clang 15 (maintainer mode, async)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: setup
env:
CC: /usr/bin/clang-14
CXX: /usr/bin/clang++-14
CC: /usr/bin/clang-15
CXX: /usr/bin/clang++-15
PROTOBUF_VERSION: 21.12
run: |
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
sudo -E ./ci/install_protobuf.sh
- name: run cmake clang (maintainer mode, async)
env:
CC: /usr/bin/clang-14
CXX: /usr/bin/clang++-14
CC: /usr/bin/clang-15
CXX: /usr/bin/clang++-15
run: |
./ci/do_ci.sh cmake.maintainer.async.test
- name: generate test cert
Expand All @@ -157,25 +157,25 @@ jobs:
(cd ./functional/otlp; ./run_test.sh)
cmake_clang_maintainer_abiv2_test:
name: CMake clang 14 (maintainer mode, abiv2)
name: CMake clang 15 (maintainer mode, abiv2)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: setup
env:
CC: /usr/bin/clang-14
CXX: /usr/bin/clang++-14
CC: /usr/bin/clang-15
CXX: /usr/bin/clang++-15
PROTOBUF_VERSION: 21.12
run: |
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
sudo -E ./ci/install_protobuf.sh
- name: run cmake clang (maintainer mode, abiv2)
env:
CC: /usr/bin/clang-14
CXX: /usr/bin/clang++-14
CC: /usr/bin/clang-15
CXX: /usr/bin/clang++-15
run: |
./ci/do_ci.sh cmake.maintainer.abiv2.test
- name: generate test cert
Expand Down Expand Up @@ -358,6 +358,59 @@ jobs:
CXX_STANDARD: '20'
run: ./ci/do_ci.sh cmake.c++20.stl.test

cmake_test_cxx23_gcc:
name: CMake C++23 test(GCC)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: setup
env:
CMAKE_VERSION: 3.20.6
run: |
sudo -E ./ci/setup_ci_environment.sh
sudo -E ./ci/setup_cmake.sh
- name: run tests
env:
CXX_STANDARD: '23'
run: ./ci/do_ci.sh cmake.c++23.test
- name: run tests (enable stl)
env:
CXX_STANDARD: '23'
run: ./ci/do_ci.sh cmake.c++23.stl.test

cmake_test_cxx23_clang:
name: CMake C++23 test(Clang with libc++)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: setup
env:
CC: /usr/bin/clang
CXX: /usr/bin/clang++
CXXFLAGS: "-stdlib=libc++"
CMAKE_VERSION: 3.20.6
run: |
sudo -E ./ci/setup_ci_environment.sh
sudo -E ./ci/setup_cmake.sh
- name: run tests
env:
CC: /usr/bin/clang
CXX: /usr/bin/clang++
CXXFLAGS: "-stdlib=libc++"
CXX_STANDARD: '23'
run: ./ci/do_ci.sh cmake.c++23.test
- name: run tests (enable stl)
env:
CC: /usr/bin/clang
CXX: /usr/bin/clang++
CXXFLAGS: "-stdlib=libc++"
CXX_STANDARD: '23'
run: ./ci/do_ci.sh cmake.c++23.stl.test

cmake_otprotocol_test:
name: CMake test (with otlp-exporter)
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -732,6 +785,8 @@ jobs:
./ci/install_windows_protobuf.ps1
- name: run cmake test (DLL build)
run: ./ci/do_ci.ps1 cmake.dll.test
- name: run cmake cxx20 test (DLL build)
run: ./ci/do_ci.ps1 cmake.dll.cxx20.test
- name: run otprotocol test (DLL build)
run: ./ci/do_ci.ps1 cmake.exporter.otprotocol.dll.test

Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Increment the:
[#2449](https://github.com/open-telemetry/opentelemetry-cpp/pull/2449)
* [BUILD] Introduce CXX 20 CI pipeline for MSVC/Windows
[#2450](https://github.com/open-telemetry/opentelemetry-cpp/pull/2450)
* [BUILD] Add DLL build CI pipeline with CXX20
[#2465](https://github.com/open-telemetry/opentelemetry-cpp/pull/2465)
* [EXPORTER] Set `is_monotonic` flag for Observable Counters
[#2478](https://github.com/open-telemetry/opentelemetry-cpp/pull/2478)
* [PROTO] Upgrade to opentelemetry-proto v1.1.0
Expand Down
1 change: 0 additions & 1 deletion api/include/opentelemetry/common/spin_lock_mutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ class SpinLockMutex
~SpinLockMutex() noexcept = default;
SpinLockMutex(const SpinLockMutex &) = delete;
SpinLockMutex &operator=(const SpinLockMutex &) = delete;
SpinLockMutex &operator=(const SpinLockMutex &) volatile = delete;

static inline void fast_yield() noexcept
{
Expand Down
8 changes: 4 additions & 4 deletions api/include/opentelemetry/nostd/function_ref.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ class function_ref<R(Args...)>
void BindTo(F &f) noexcept
{
callable_ = static_cast<void *>(std::addressof(f));
invoker_ = [](void *callable_, Args... args) -> R {
return (*static_cast<FunctionPointer<F>>(callable_))(std::forward<Args>(args)...);
invoker_ = [](void *callable, Args... args) -> R {
return (*static_cast<FunctionPointer<F>>(callable))(std::forward<Args>(args)...);
};
}

Expand All @@ -49,8 +49,8 @@ class function_ref<R(Args...)>
return BindTo(nullptr);
}
callable_ = reinterpret_cast<void *>(f);
invoker_ = [](void *callable_, Args... args) -> R {
return (F(callable_))(std::forward<Args>(args)...);
invoker_ = [](void *callable, Args... args) -> R {
return (F(callable))(std::forward<Args>(args)...);
};
}

Expand Down
13 changes: 13 additions & 0 deletions api/include/opentelemetry/nostd/internal/absl/base/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ static_assert(OTABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||
#ifdef OTABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE
#error OTABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE cannot be directly set
#elif defined(_LIBCPP_VERSION) || \
(defined(__clang__) && __clang_major__ >= 15) || \
(!defined(__clang__) && defined(__GNUC__) && defined(__GLIBCXX__) && \
(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))) || \
defined(_MSC_VER)
Expand All @@ -194,6 +195,7 @@ static_assert(OTABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||
#elif defined(OTABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE)
#error OTABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE cannot directly set
#elif (defined(__clang__) && defined(_LIBCPP_VERSION)) || \
(defined(__clang__) && __clang_major__ >= 15) || \
(!defined(__clang__) && defined(__GNUC__) && \
(__GNUC__ > 7 || (__GNUC__ == 7 && __GNUC_MINOR__ >= 4)) && \
(defined(_LIBCPP_VERSION) || defined(__GLIBCXX__))) || \
Expand All @@ -202,6 +204,17 @@ static_assert(OTABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||
#define OTABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE 1
#endif

// OTABSL_HAVE_STD_IS_TRIVIALLY_COPYABLE
//
// Checks whether `std::is_trivially_copyable<T>` is supported.
//
// Notes: Clang 15+ with libc++ supports these features, GCC hasn't been tested.
#if defined(OTABSL_HAVE_STD_IS_TRIVIALLY_COPYABLE)
#error OTABSL_HAVE_STD_IS_TRIVIALLY_COPYABLE cannot be directly set
#elif defined(__clang__) && (__clang_major__ >= 15)
#define OTABSL_HAVE_STD_IS_TRIVIALLY_COPYABLE 1
#endif

// OTABSL_HAVE_SOURCE_LOCATION_CURRENT
//
// Indicates whether `absl::SourceLocation::current()` will return useful
Expand Down
22 changes: 22 additions & 0 deletions api/include/opentelemetry/nostd/internal/absl/meta/type_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,12 @@ struct is_function
// https://gcc.gnu.org/onlinedocs/gcc/Type-Traits.html#Type-Traits.
template <typename T>
struct is_trivially_destructible
#ifdef OTABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE
: std::is_trivially_destructible<T> {
#else
: std::integral_constant<bool, __has_trivial_destructor(T) &&
std::is_destructible<T>::value> {
#endif
#ifdef OTABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE
private:
static constexpr bool compliant = std::is_trivially_destructible<T>::value ==
Expand Down Expand Up @@ -345,9 +349,13 @@ struct is_trivially_destructible
// Nontrivially destructible types will cause the expression to be nontrivial.
template <typename T>
struct is_trivially_default_constructible
#if defined(OTABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE)
: std::is_trivially_default_constructible<T> {
#else
: std::integral_constant<bool, __has_trivial_constructor(T) &&
std::is_default_constructible<T>::value &&
is_trivially_destructible<T>::value> {
#endif
#if defined(OTABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE) && \
!defined( \
OTABSL_META_INTERNAL_STD_CONSTRUCTION_TRAITS_DONT_CHECK_DESTRUCTION)
Expand Down Expand Up @@ -379,10 +387,14 @@ struct is_trivially_default_constructible
// expression to be nontrivial.
template <typename T>
struct is_trivially_move_constructible
#if defined(OTABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE)
: std::is_trivially_move_constructible<T> {
#else
: std::conditional<
std::is_object<T>::value && !std::is_array<T>::value,
type_traits_internal::IsTriviallyMoveConstructibleObject<T>,
std::is_reference<T>>::type::type {
#endif
#if defined(OTABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE) && \
!defined( \
OTABSL_META_INTERNAL_STD_CONSTRUCTION_TRAITS_DONT_CHECK_DESTRUCTION)
Expand Down Expand Up @@ -488,9 +500,13 @@ struct is_trivially_move_assignable
// `is_trivially_assignable<T&, const T&>`.
template <typename T>
struct is_trivially_copy_assignable
#ifdef OTABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE
: std::is_trivially_copy_assignable<T> {
#else
: std::integral_constant<
bool, __has_trivial_assign(typename std::remove_reference<T>::type) &&
absl::is_copy_assignable<T>::value> {
#endif
#ifdef OTABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE
private:
static constexpr bool compliant =
Expand Down Expand Up @@ -521,6 +537,11 @@ namespace type_traits_internal {
// destructible. Arrays of trivially copyable types are trivially copyable.
//
// We expose this metafunction only for internal use within absl.

#if defined(OTABSL_HAVE_STD_IS_TRIVIALLY_COPYABLE)
template <typename T>
struct is_trivially_copyable : std::is_trivially_copyable<T> {};
#else
template <typename T>
class is_trivially_copyable_impl {
using ExtentsRemoved = typename std::remove_all_extents<T>::type;
Expand All @@ -546,6 +567,7 @@ template <typename T>
struct is_trivially_copyable
: std::integral_constant<
bool, type_traits_internal::is_trivially_copyable_impl<T>::kValue> {};
#endif
} // namespace type_traits_internal

// -----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion api/test/common/spinlock_benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ inline void SpinThrash(benchmark::State &s, SpinLockType &spinlock, LockF lock,
// Value we will increment, fighting over a spinlock.
// The contention is meant to be brief, as close to our expected
// use cases of "updating pointers" or "pushing an event onto a buffer".
std::int64_t value = 0;
std::int64_t value OPENTELEMETRY_MAYBE_UNUSED = 0;

std::vector<std::thread> threads;
threads.reserve(num_threads);
Expand Down
Loading

0 comments on commit b349be3

Please sign in to comment.