-
Notifications
You must be signed in to change notification settings - Fork 443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
importing gsl::span if std::span is not available #1167
Changes from 3 commits
c676c16
3da1084
9af60ec
3071ae7
32cd796
f6a32fc
7350a45
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
#if defined __has_include | ||
# if __has_include(<version>) // Check for __cpp_{feature} | ||
# include <version> | ||
# if defined(__cpp_lib_span) | ||
# if defined(__cpp_lib_span) && __cplusplus > 201703L | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this check required? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. because There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Which should be ok right? If the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The behavior for |
||
# define HAVE_SPAN | ||
# endif | ||
# endif | ||
|
@@ -21,7 +21,7 @@ | |
# define HAVE_SPAN | ||
# endif | ||
# // Check for other compiler span implementation | ||
# if !defined(_MSVC_LANG) && __has_include(<span>) | ||
# if !defined(_MSVC_LANG) && __has_include(<span>) && __cplusplus > 201703L | ||
// This works as long as compiler standard is set to C++20 | ||
# define HAVE_SPAN | ||
# endif | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to clarify- with this PR, GSL library will only be used if the
WITH_GSL
flag is enabled?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes it is enabled only when the user explicitly asks for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I was thinking about this part in cmake:
opentelemetry-cpp/api/CMakeLists.txt
Lines 48 to 51 in 05d43d6
As it looks we are enabling HAVE_GSL macro with WITH_STL option, which would mean try using gsl::span from submodule if STL doesn't have std::span implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that is covered in
opentelemetry-cpp/api/include/opentelemetry/std/span.h
Lines 29 to 31 in bc1b469
WITH_GSL
is off.We shouldn't define it though, I cleaned it from the CMake file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, thanks for the clarification.