Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 21 additions & 19 deletions api/include/opentelemetry/logs/noop.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,22 @@ class NoopLoggerProvider final : public LoggerProvider
};

#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 warning "-Wdeprecated-declarations"
# elif defined(__clang__) || defined(__apple_build_version__)
# pragma clang diagnostic push
# pragma clang diagnostic warning "-Wdeprecated-declarations"

Copilot AI Feb 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pragma directive #pragma GCC diagnostic warning "-Wdeprecated-declarations" will cause deprecation warnings to be emitted as warnings for GCC, which contradicts the intent of suppressing these internal implementation warnings. This should be #pragma GCC diagnostic ignored "-Wdeprecated-declarations" to suppress the warnings like it was before, matching the behavior for MSVC which uses disable : 4996.

Suggested change
# pragma GCC diagnostic warning "-Wdeprecated-declarations"
# elif defined(__clang__) || defined(__apple_build_version__)
# pragma clang diagnostic push
# pragma clang diagnostic warning "-Wdeprecated-declarations"
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
# elif defined(__clang__) || defined(__apple_build_version__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wdeprecated-declarations"

Copilot uses AI. Check for mistakes.

Copilot AI Feb 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pragma directive #pragma clang diagnostic warning "-Wdeprecated-declarations" will cause deprecation warnings to be emitted as warnings for Clang, which contradicts the intent of suppressing these internal implementation warnings. This should be #pragma clang diagnostic ignored "-Wdeprecated-declarations" to suppress the warnings like it was before, matching the behavior for MSVC which uses disable : 4996.

Suggested change
# pragma GCC diagnostic warning "-Wdeprecated-declarations"
# elif defined(__clang__) || defined(__apple_build_version__)
# pragma clang diagnostic push
# pragma clang diagnostic warning "-Wdeprecated-declarations"
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
# elif defined(__clang__) || defined(__apple_build_version__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wdeprecated-declarations"

Copilot uses AI. Check for mistakes.
# endif

class NoopEventLogger final : public EventLogger
{
public:
NoopEventLogger() : logger_{nostd::shared_ptr<NoopLogger>(new NoopLogger())} {}
~NoopEventLogger() override = default;

const nostd::string_view GetName() noexcept override { return "noop event logger"; }

Expand All @@ -112,27 +124,9 @@ class NoopEventLogger final : public EventLogger
class NoopEventLoggerProvider final : public EventLoggerProvider
{
public:
# 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

NoopEventLoggerProvider() : event_logger_{nostd::shared_ptr<EventLogger>(new NoopEventLogger())}
{}

# 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
~NoopEventLoggerProvider() override = default;

nostd::shared_ptr<EventLogger> CreateEventLogger(
nostd::shared_ptr<Logger> /*delegate_logger*/,
Expand All @@ -144,6 +138,14 @@ class NoopEventLoggerProvider final : public EventLoggerProvider
private:
nostd::shared_ptr<EventLogger> event_logger_;
};

# 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
Expand Down
31 changes: 24 additions & 7 deletions api/include/opentelemetry/logs/provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ class OPENTELEMETRY_EXPORT Provider
}

#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 warning "-Wdeprecated-declarations"
# elif defined(__clang__) || defined(__apple_build_version__)
# pragma clang diagnostic push
# pragma clang diagnostic warning "-Wdeprecated-declarations"

Copilot AI Feb 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pragma directive #pragma GCC diagnostic warning "-Wdeprecated-declarations" will cause deprecation warnings to be emitted as warnings for GCC, which contradicts the intent of suppressing these internal implementation warnings. This should be #pragma GCC diagnostic ignored "-Wdeprecated-declarations" to suppress the warnings like it was before, matching the behavior for MSVC which uses disable : 4996.

Suggested change
# pragma GCC diagnostic warning "-Wdeprecated-declarations"
# elif defined(__clang__) || defined(__apple_build_version__)
# pragma clang diagnostic push
# pragma clang diagnostic warning "-Wdeprecated-declarations"
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
# elif defined(__clang__) || defined(__apple_build_version__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wdeprecated-declarations"

Copilot uses AI. Check for mistakes.

Copilot AI Feb 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pragma directive #pragma clang diagnostic warning "-Wdeprecated-declarations" will cause deprecation warnings to be emitted as warnings for Clang, which contradicts the intent of suppressing these internal implementation warnings. This should be #pragma clang diagnostic ignored "-Wdeprecated-declarations" to suppress the warnings like it was before, matching the behavior for MSVC which uses disable : 4996.

Suggested change
# pragma GCC diagnostic warning "-Wdeprecated-declarations"
# elif defined(__clang__) || defined(__apple_build_version__)
# pragma clang diagnostic push
# pragma clang diagnostic warning "-Wdeprecated-declarations"
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
# elif defined(__clang__) || defined(__apple_build_version__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wdeprecated-declarations"

Copilot uses AI. Check for mistakes.
# endif
/**
* Returns the singleton EventLoggerProvider.
*
Expand All @@ -70,6 +80,13 @@ class OPENTELEMETRY_EXPORT Provider
std::lock_guard<common::SpinLockMutex> guard(GetLock());
GetEventProvider() = tp;
}
# 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

private:
Expand All @@ -80,23 +97,24 @@ class OPENTELEMETRY_EXPORT Provider
}

#if OPENTELEMETRY_ABI_VERSION_NO < 2
OPENTELEMETRY_DEPRECATED
OPENTELEMETRY_API_SINGLETON static nostd::shared_ptr<EventLoggerProvider> &
GetEventProvider() noexcept
{
# 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"
# pragma GCC diagnostic warning "-Wdeprecated-declarations"

Copilot AI Feb 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pragma directive #pragma GCC diagnostic warning "-Wdeprecated-declarations" will cause deprecation warnings to be emitted as warnings for GCC, which contradicts the intent of suppressing these internal implementation warnings. This should be #pragma GCC diagnostic ignored "-Wdeprecated-declarations" to suppress the warnings like it was before, matching the behavior for MSVC which uses disable : 4996.

Copilot uses AI. Check for mistakes.
# elif defined(__clang__) || defined(__apple_build_version__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
# pragma clang diagnostic warning "-Wdeprecated-declarations"

Copilot AI Feb 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pragma directive #pragma clang diagnostic warning "-Wdeprecated-declarations" will cause deprecation warnings to be emitted as warnings for Clang, which contradicts the intent of suppressing these internal implementation warnings. This should be #pragma clang diagnostic ignored "-Wdeprecated-declarations" to suppress the warnings like it was before, matching the behavior for MSVC which uses disable : 4996.

Copilot uses AI. Check for mistakes.
# endif

OPENTELEMETRY_DEPRECATED
OPENTELEMETRY_API_SINGLETON static nostd::shared_ptr<EventLoggerProvider> &
GetEventProvider() noexcept
{
static nostd::shared_ptr<EventLoggerProvider> provider(new NoopEventLoggerProvider);
return provider;
}

# if defined(_MSC_VER)
# pragma warning(pop)
Expand All @@ -105,7 +123,6 @@ class OPENTELEMETRY_EXPORT Provider
# elif defined(__clang__) || defined(__apple_build_version__)
# pragma clang diagnostic pop
# endif
}
#endif

OPENTELEMETRY_API_SINGLETON static common::SpinLockMutex &GetLock() noexcept
Expand Down
Loading