-
Notifications
You must be signed in to change notification settings - Fork 501
Fix defining OPENTELEMETRY_TRIVIALITY_TYPE_TRAITS #3337
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
Conversation
✅ Deploy Preview for opentelemetry-cpp-api-docs canceled.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3337 +/- ##
==========================================
+ Coverage 89.55% 89.56% +0.02%
==========================================
Files 210 210
Lines 6502 6502
==========================================
+ Hits 5822 5823 +1
+ Misses 680 679 -1 🚀 New features to boost your workflow:
|
@georgthegreat Thanks for the PR. Concerning the issue, we also use clang-18 in our CI, and this never broke this way.
Concerning the fix, I agree it should be simplified. |
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.
Thanks for the PR.
See suggestion to simplify even more.
Seem also related to |
Related to: |
62255d3
to
4b27a56
Compare
@marcalff, we use clang-18, I have removed |
@marcalff let's merge it. |
* std::is_trivialy_move_assignable | ||
*/ | ||
#ifdef OPENTELEMETRY_TRIVIALITY_TYPE_TRAITS | ||
#if defined(OPENTELEMETRY_STL_VERSION) && OPENTELEMETRY_STL_VERSION >= 2011 |
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.
The fallback implementation relies on GCC's API, making it exclusive to GCC. It should be updated to support all compilers.
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.
Why should it? Opentelemetry does not support cxx03 standard.
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.
I mean the code in #else
branch
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.
This is a dead code, opentelemetry does not support cxx03 standard / libstdc++ 5.
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.
In theory, yes, this is dead code.
In practice, no, this code is not totally dead now, there are historical reasons to maintain this part working.
What we need here is a fix that solves the trivial cases of building with recent compilers, using std:: type
traits when they are available, instead of using the alternate nostd::
implementation.
The issue is probably that we need to do this independently of WITH_STL
: that is, test __cplusplus
instead of OPENTELEMETRY_STL_VERSION
.
Now, for old cases when std::
classes are not available, like this old work around for gcc 4.8, the code needs to implement the work around as before.
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.
I hope I understood you correctly.
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.
#if !defined(OPENTELEMETRY_HAVE_STD_TYPE_TRAITS)
can be removed now.
#endif | ||
|
||
#if !defined(OPENTELEMETRY_HAVE_STD_TYPE_TRAITS) | ||
# include <array> |
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.
#if !defined(OPENTELEMETRY_HAVE_STD_TYPE_TRAITS)
Can be removed, but these headers are still required.
I am done with it. |
Fixes # (issue)
Changes
Upon updating to 1.20.0 we have encountered a bunch of the following errors:
(we use clang-18 to build our code).
It turned out that some old compatibility code got broken.
@marcalff, according to README.md opentelemetry-cpp does no longer support standards below C++11, hence we can always use these type_traits from the standard library.
Can we drop the C++03 compat and simplify the things even further?
For significant contributions please make sure you have completed the following items:
CHANGELOG.md
updated for non-trivial changes