-
Notifications
You must be signed in to change notification settings - Fork 519
Remove unused header files and use forward declarations when necessary #2043
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
|
|
|
Thanks for working on this, the code indeed needs some cleanup in this area. Some early comments:
|
cac8f8a to
955af97
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #2043 +/- ##
=======================================
Coverage 87.19% 87.19%
=======================================
Files 166 166
Lines 4784 4784
=======================================
Hits 4171 4171
Misses 613 613
|
955af97 to
fbe432b
Compare
|
Hello @marcalff, thanks for your suggestions!
Also, there are too many changes at once (more than 100 files), maybe I should to split up into more PRs to review by you easily. Maybe, they should be like a component-based PR. What do you think? |
77d9425 to
b18ff58
Compare
Hi @cngzhnp The very first thing you should do is to NOT use
For clang-format, make sure to use the proper version, and check for format failures in CI. See: |
|
Hello @marcalff, Thanks for your feedback but I do not see any rules on IMHO, you are totally right if only if PR is ready for review by others. However, it should be depending on contributor itself if PR is in draft phase. After PR is marked as ready to review then every changes including review comments has to be kept. Maybe, Also, thanks for the hint, I need to change my |
4a7fdb3 to
55a8db1
Compare
marcalff
left a comment
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 general cleanup.
Please see comments, with details to address.
Given the patch size, it will probably be merged by parts.
sdk/include/opentelemetry/sdk/instrumentationscope/instrumentation_scope.h
Outdated
Show resolved
Hide resolved
522fba8 to
4c9ff08
Compare
4c9ff08 to
827dd5a
Compare
5580a78 to
f7a4df2
Compare
marcalff
left a comment
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.
@cngzhnp Thanks for your work on this.
In this round, I limited my review to the content of api/ only,
with a minor comment on include new versus include exception in one file,
see detailed comments.
Consider the changes done in api/ approved by myself.
Please prepare a separate PR for the changes in api/ only,
so it can be merged independently.
After that, I will continue the review on the next parts (sdk, exporters, examples), in that order. The next parts are not ready (more comments to come), so not formally approving the whole PR yet.
@lalitb , @ThomsonTan , @esigo , @owent
The changes in api/ only look good to me (with 1 comment).
In particular:
- using forward declarations instead of include will help to clarify exact binary dependencies, when evaluating ABI changes (forward is better), so this cleanup is really needed, it is not just cosmetic.
- adding explicit includes, like version.h, follows the include-what-you-use concepts, and is also needed to have self contained headers, which also will help to identify explicitly all the dependencies from a given file, which will help for ABI checks.
When the PR for the content of api/ is posted by @cngzhnp , please review it as well, and merge api changes.
Do not merge this PR as a whole.
Thanks all.
| #include <memory> | ||
| #include <string> | ||
| #if __EXCEPTIONS | ||
| # include <exception> |
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.
Should this be "include new" instead, for std::bad_alloc ?
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 modern compilers, we can use __cpp_exceptions to check if exception is enabled.
And use __EXCEPTIONS in legacy gcc, use __has_feature(cxx_exceptions) in legacy clang , use _CPPUNWIND in legacy MSVC.
Is is better to add a macro in opentelemetry/common/macros.h and use it here?
e.g.
#if defined(__cpp_exceptions)
# define OPENTELEMETRY_HAVE_EXCEPTION __cpp_exceptions
#elif defined(__EXCEPTIONS) && __EXCEPTIONS
# define OPENTELEMETRY_HAVE_EXCEPTION 1
#elif defined(__clang__)
# if __has_feature(cxx_exceptions)
# define OPENTELEMETRY_HAVE_EXCEPTION 1
# endif
#elif defined(_MSC_VER)
# if defined(_CPPUNWIND)
# define OPENTELEMETRY_HAVE_EXCEPTION 1
# endif
#endif
Fixes # (issue)
Changes
Please provide a brief description of the changes here.
For significant contributions please make sure you have completed the following items:
CHANGELOG.mdupdated for non-trivial changes