-
Notifications
You must be signed in to change notification settings - Fork 524
[BUILD] Ignore deprecated warning #3845
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
Changes from all commits
ee13c73
d86b08d
2be52f7
cd63f5b
d798baa
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 |
|---|---|---|
|
|
@@ -15,6 +15,17 @@ OPENTELEMETRY_BEGIN_NAMESPACE | |
| namespace logs | ||
| { | ||
| #if OPENTELEMETRY_ABI_VERSION_NO < 2 | ||
| # if defined(_MSC_VER) | ||
| # pragma warning(push) | ||
| # pragma warning(disable : 4996) | ||
| # elif defined(__GNUC__) && !defined(__clang__) && !defined(__apple_build_version__) | ||
| # pragma GCC diagnostic push | ||
| # pragma GCC diagnostic ignored "-Wdeprecated-declarations" | ||
| # elif defined(__clang__) || defined(__apple_build_version__) | ||
| # pragma clang diagnostic push | ||
| # pragma clang diagnostic ignored "-Wdeprecated-declarations" | ||
| # endif | ||
|
|
||
|
Comment on lines
+18
to
+28
Member
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. This header file declares a deprecated class: Not tested on windows, but I in my understanding:
so there should be no changes in file event_logger.h and event_logger_provider.h.
Member
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. I think this is different for MSVC. MSVC with /sdl fires C4996 at declaration sites too, not just usage, in that case the suppression here is needed.
Member
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. With this change, code is deprecated and the deprecation warning is always suppressed and ignored, due to the pragma added. This makes no sense to me, why deprecating in the first place then ? Given that this patch is already approved by two maintainers, and given how it unblocks an issue downstream in opentelemetry-cpp-contribs (geneva), I am not blocking this merge it so it can be part of the 1.25 release, but I don't agree with this change. If we don't want deprecation warnings at all, why not remove the This area should be simplified in a follow up PR, in my opinion. Preparing the 1.25 release with warnings disabled for now, again, to unblock downstream. |
||
| /** | ||
| * Handles event log record creation. | ||
| **/ | ||
|
|
@@ -77,6 +88,14 @@ class OPENTELEMETRY_DEPRECATED EventLogger | |
| void IgnoreTraitResult(ValueType &&...) | ||
| {} | ||
| }; | ||
|
|
||
| # if defined(_MSC_VER) | ||
| # pragma warning(pop) | ||
| # elif defined(__GNUC__) && !defined(__clang__) && !defined(__apple_build_version__) | ||
| # pragma GCC diagnostic pop | ||
| # elif defined(__clang__) || defined(__apple_build_version__) | ||
| # pragma clang diagnostic pop | ||
| # endif | ||
| #endif | ||
| } // namespace logs | ||
| OPENTELEMETRY_END_NAMESPACE | ||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -12,3 +12,24 @@ target_include_directories(common_logs_foo_library | |||
| PUBLIC $<BUILD_INTERFACE:${EXAMPLES_COMMON_DIR}>) | ||||
|
|
||||
| target_link_libraries(common_logs_foo_library PUBLIC opentelemetry-cpp::api) | ||||
|
|
||||
| # Internal deprecated API calling should not failed the build in maintainer mode | ||||
| if(OTELCPP_MAINTAINER_MODE) | ||||
| if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang") | ||||
| get_target_property(COMMON_LOGS_FOO_COMPILE_OPTS common_logs_foo_library | ||||
| COMPILE_OPTIONS) | ||||
| list(REMOVE_ITEM COMMON_LOGS_FOO_COMPILE_OPTS | ||||
| -Wno-error=deprecated-declarations) | ||||
| set_target_properties( | ||||
| common_logs_foo_library PROPERTIES COMPILE_OPTIONS | ||||
|
Contributor
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. Would remove the option from the target property work? The option opentelemetry-cpp/CMakeLists.txt Line 197 in bb5fff0
Member
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 code already builds in CI in maintainer mode, why do we need extra changes in CMakeLists.txt ? |
||||
| "${COMMON_LOGS_FOO_COMPILE_OPTS}") | ||||
| elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") | ||||
| get_target_property(COMMON_LOGS_FOO_COMPILE_OPTS common_logs_foo_library | ||||
| COMPILE_OPTIONS) | ||||
| list(REMOVE_ITEM COMMON_LOGS_FOO_COMPILE_OPTS /wd4996) | ||||
| list(APPEND COMMON_LOGS_FOO_COMPILE_OPTS /w34996) | ||||
| set_target_properties( | ||||
| common_logs_foo_library PROPERTIES COMPILE_OPTIONS | ||||
| "${COMMON_LOGS_FOO_COMPILE_OPTS}") | ||||
| endif() | ||||
| 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.
nit - not blocker, can be done in subsequent PR - this suppression block is repeated quite often in code. Probably we can use the macros
OTEL_INTERNAL_SUPPRESS_WARNING_PUSH OTEL_INTERNAL_SUPPRESS_DEPRECATED // ... code referencing deprecated types ... OTEL_INTERNAL_SUPPRESS_WARNING_POP