Skip to content

Commit

Permalink
Using fallback version of span when std::span do not support range.
Browse files Browse the repository at this point in the history
Signed-off-by: owent <[email protected]>
  • Loading branch information
owent committed Dec 9, 2022
1 parent 62a8d64 commit f7dfa56
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 50 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,18 @@ jobs:
with:
submodules: 'recursive'
- name: setup
env:
CMAKE_VERSION: "3.20.6"
run: |
sudo ./ci/setup_ci_environment.sh
sudo ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
sudo -E ./ci/setup_cmake.sh
- name: run tests
env:
CMAKE_VERSION: "3.20.6"
run: ./ci/do_ci.sh cmake.c++20.test
- name: run tests (enable stl)
env:
CMAKE_VERSION: "3.20.6"
run: ./ci/do_ci.sh cmake.c++20.stl.test

cmake_test_cxx20_clang:
Expand All @@ -183,6 +189,7 @@ jobs:
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
Expand All @@ -191,12 +198,14 @@ jobs:
CC: /usr/bin/clang
CXX: /usr/bin/clang++
CXXFLAGS: "-stdlib=libc++"
CMAKE_VERSION: "3.20.6"
run: ./ci/do_ci.sh cmake.c++20.test
- name: run tests (enable stl)
env:
CC: /usr/bin/clang
CXX: /usr/bin/clang++
CXXFLAGS: "-stdlib=libc++"
CMAKE_VERSION: "3.20.6"
run: ./ci/do_ci.sh cmake.c++20.stl.test

cmake_otprotocol_test:
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ Increment the:

## [Unreleased]

* [TESTS] Upgrade default version of googletest to 1.12.1 ([#1852](https:/open-telemetry/opentelemetry-cpp/pull/1852))
* [TESTS] Upgrade default version of googletest to 1.12.1, using cmake 3.20.6
with C++20 [#1852](https:/open-telemetry/opentelemetry-cpp/pull/1852)
* [BUILD] Fix OTELCPP_MAINTAINER_MODE [#1844](https:/open-telemetry/opentelemetry-cpp/pull/1844)

## [1.8.1] 2022-12-04
Expand Down
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,6 @@ if(BUILD_TESTING)
endif()
endif()

include("${CMAKE_CURRENT_LIST_DIR}/cmake/compiler-detection.cmake")
include(CMakePackageConfigHelpers)

include_directories(api/include)
Expand Down
22 changes: 21 additions & 1 deletion api/include/opentelemetry/nostd/span.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,27 @@

// Try to use either `std::span` or `gsl::span`
#ifdef HAVE_CPP_STDLIB
# include "opentelemetry/std/span.h"
# include <array>
# include <cstddef>
# include <iterator>
# include <type_traits>

/**
* @brief Clang 14.0.0 with libc++ do not support implicitly construct a span for a range.We just
* use our fallback version.
*
*/
# if defined(_LIBCPP_VERSION)
# if _LIBCPP_VERSION <= 14000
# define OPENTELEMETRY_OPTION_USE_STD_SPAN 0
# endif
# endif
# ifndef OPENTELEMETRY_OPTION_USE_STD_SPAN
# define OPENTELEMETRY_OPTION_USE_STD_SPAN 1
# endif
# if OPENTELEMETRY_OPTION_USE_STD_SPAN
# include "opentelemetry/std/span.h"
# endif
#endif

// Fallback to `nostd::span` if necessary
Expand Down
45 changes: 0 additions & 45 deletions cmake/compiler-detection.cmake

This file was deleted.

0 comments on commit f7dfa56

Please sign in to comment.