Skip to content

Commit

Permalink
[Code Health] Include what you use, part 6 (#3216)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcalff authored Jan 8, 2025
1 parent c33f800 commit e5a1a15
Show file tree
Hide file tree
Showing 168 changed files with 169 additions and 228 deletions.
1 change: 1 addition & 0 deletions .iwyu.imp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
{ "include": ["<gtest/gtest-param-test.h>", "private", "<gtest/gtest.h>", "public"] },
{ "include": ["<gtest/gtest_pred_impl.h>", "private", "<gtest/gtest.h>", "public"] },
{ "include": ["<gtest/gtest-typed-test.h>", "private", "<gtest/gtest.h>", "public"] },
{ "include": ["<gtest/gtest-assertion-result.h>", "private", "<gtest/gtest.h>", "public"] },

# We prefer to include <gmock/gmock.h> for simplicity
{ "include": ["<gmock/gmock-function-mocker.h>", "private", "<gmock/gmock.h>", "public"] },
Expand Down
4 changes: 2 additions & 2 deletions api/test/baggage/baggage_benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

#include <benchmark/benchmark.h>
#include <stddef.h>
#include <memory>
#include <string>

#include "opentelemetry/baggage/baggage.h"
#include "opentelemetry/nostd/function_ref.h"
#include "opentelemetry/nostd/shared_ptr.h"
#include "opentelemetry/nostd/string_view.h"
#include "opentelemetry/nostd/utility.h"

using namespace opentelemetry::baggage;
namespace nostd = opentelemetry::nostd;
Expand Down
1 change: 1 addition & 0 deletions api/test/baggage/baggage_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include "opentelemetry/baggage/baggage.h"
#include "opentelemetry/common/kv_properties.h"
#include "opentelemetry/nostd/function_ref.h"
#include "opentelemetry/nostd/shared_ptr.h"
#include "opentelemetry/nostd/string_view.h"

Expand Down
5 changes: 3 additions & 2 deletions api/test/baggage/propagation/baggage_propagator_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// SPDX-License-Identifier: Apache-2.0

#include <gtest/gtest.h>
#include <initializer_list>
#include <map>
#include <memory>
#include <string>
#include <utility>
#include <vector>
Expand All @@ -14,8 +14,9 @@
#include "opentelemetry/baggage/propagation/baggage_propagator.h"
#include "opentelemetry/context/context.h"
#include "opentelemetry/context/propagation/text_map_propagator.h"
#include "opentelemetry/nostd/function_ref.h"
#include "opentelemetry/nostd/shared_ptr.h"
#include "opentelemetry/nostd/string_view.h"
#include "opentelemetry/nostd/utility.h"

using namespace opentelemetry;
using namespace opentelemetry::baggage::propagation;
Expand Down
2 changes: 1 addition & 1 deletion api/test/common/kv_properties_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#include <vector>

#include <opentelemetry/common/kv_properties.h>
#include "opentelemetry/nostd/function_ref.h"
#include "opentelemetry/nostd/string_view.h"
#include "opentelemetry/nostd/utility.h"

// ------------------------- Entry class tests ---------------------------------

Expand Down
2 changes: 1 addition & 1 deletion api/test/common/spinlock_benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// SPDX-License-Identifier: Apache-2.0

#include <benchmark/benchmark.h>
#include <stdint.h>
#include <algorithm>
#include <atomic>
#include <cstdint>
#include <thread>
#include <vector>

Expand Down
1 change: 0 additions & 1 deletion api/test/context/context_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#include "opentelemetry/context/context.h"
#include "opentelemetry/context/context_value.h"
#include "opentelemetry/nostd/shared_ptr.h"
#include "opentelemetry/nostd/string_view.h"
#include "opentelemetry/nostd/variant.h"

Expand Down
1 change: 1 addition & 0 deletions api/test/context/propagation/composite_propagator_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "opentelemetry/context/propagation/composite_propagator.h"
#include "opentelemetry/context/propagation/text_map_propagator.h"
#include "opentelemetry/context/runtime_context.h"
#include "opentelemetry/nostd/function_ref.h"
#include "opentelemetry/nostd/shared_ptr.h"
#include "opentelemetry/nostd/span.h"
#include "opentelemetry/nostd/string_view.h"
Expand Down
1 change: 0 additions & 1 deletion api/test/context/runtime_context_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "opentelemetry/context/context.h"
#include "opentelemetry/context/context_value.h"
#include "opentelemetry/context/runtime_context.h"
#include "opentelemetry/nostd/shared_ptr.h"
#include "opentelemetry/nostd/string_view.h"
#include "opentelemetry/nostd/unique_ptr.h"
#include "opentelemetry/nostd/variant.h"
Expand Down
1 change: 1 addition & 0 deletions api/test/core/timestamp_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <gtest/gtest.h>
#include <stdlib.h>
#include <chrono>
#include <string>

#include "opentelemetry/common/timestamp.h"

Expand Down
2 changes: 1 addition & 1 deletion api/test/logs/logger_benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <functional>
#include <mutex>
#include <thread>
#include <utility>
#include <vector>

#include "opentelemetry/common/key_value_iterable_view.h"
Expand All @@ -18,7 +19,6 @@
#include "opentelemetry/logs/provider.h"
#include "opentelemetry/logs/severity.h"
#include "opentelemetry/nostd/shared_ptr.h"
#include "opentelemetry/nostd/span.h"
#include "opentelemetry/nostd/string_view.h"

using opentelemetry::logs::EventId;
Expand Down
1 change: 0 additions & 1 deletion api/test/logs/logger_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "opentelemetry/nostd/span.h"
#include "opentelemetry/nostd/string_view.h"
#include "opentelemetry/nostd/unique_ptr.h"
#include "opentelemetry/nostd/utility.h"

using opentelemetry::logs::EventId;
using opentelemetry::logs::Logger;
Expand Down
5 changes: 2 additions & 3 deletions api/test/logs/provider_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@
#include <string>

#include "opentelemetry/common/key_value_iterable.h"
#include "opentelemetry/logs/event_logger.h"
#include "opentelemetry/logs/event_logger.h" // IWYU pragma: keep
#include "opentelemetry/logs/event_logger_provider.h"
#include "opentelemetry/logs/logger.h"
#include "opentelemetry/logs/logger.h" // IWYU pragma: keep
#include "opentelemetry/logs/logger_provider.h"
#include "opentelemetry/logs/provider.h"
#include "opentelemetry/nostd/shared_ptr.h"
#include "opentelemetry/nostd/string_view.h"
#include "opentelemetry/nostd/utility.h"

using opentelemetry::logs::EventLogger;
using opentelemetry::logs::EventLoggerProvider;
Expand Down
1 change: 0 additions & 1 deletion api/test/metrics/meter_provider_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include <gtest/gtest.h>

#include "opentelemetry/metrics/meter_provider.h"
#include "opentelemetry/metrics/noop.h"
#include "opentelemetry/metrics/provider.h"
#include "opentelemetry/nostd/shared_ptr.h"
Expand Down
1 change: 1 addition & 0 deletions api/test/metrics/noop_sync_instrument_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <map>
#include <memory>
#include <string>
#include <utility>

#include "opentelemetry/context/context.h"
#include "opentelemetry/metrics/noop.h"
Expand Down
4 changes: 3 additions & 1 deletion api/test/nostd/function_ref_test.cc
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

#include <gtest/gtest.h>
#include <string>

#include "opentelemetry/nostd/function_ref.h"

#include <gtest/gtest.h>
using namespace opentelemetry::nostd;

int Call(function_ref<int()> f)
Expand Down
1 change: 1 addition & 0 deletions api/test/nostd/shared_ptr_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <gtest/gtest.h>
#include <stddef.h>
#include <algorithm>
#include <string>
#include <utility>
#include <vector>

Expand Down
1 change: 1 addition & 0 deletions api/test/nostd/span_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <array>
#include <iterator>
#include <list>
#include <string>
#include <type_traits>
#include <vector>

Expand Down
1 change: 1 addition & 0 deletions api/test/nostd/unique_ptr_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

#include <gtest/gtest.h>
#include <string>
#include <type_traits>
#include <utility>

Expand Down
1 change: 1 addition & 0 deletions api/test/nostd/utility_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <gtest/gtest.h>
#include <initializer_list>
#include <string>
#include <tuple>
#include <type_traits>
#include <vector>
Expand Down
4 changes: 1 addition & 3 deletions api/test/nostd/variant_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@

#include "opentelemetry/nostd/variant.h"

#include <string>
#include <type_traits>

#include <gtest/gtest.h>
#include <string>

namespace nostd = opentelemetry::nostd;

Expand Down
1 change: 1 addition & 0 deletions api/test/plugin/dynamic_load_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <string>

#include "opentelemetry/plugin/dynamic_load.h"
#include "opentelemetry/plugin/factory.h"

TEST(LoadFactoryTest, FailureTest)
{
Expand Down
1 change: 0 additions & 1 deletion api/test/singleton/component_a.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

#include "opentelemetry/context/context_value.h"
#include "opentelemetry/nostd/shared_ptr.h"
#include "opentelemetry/trace/provider.h"
#include "opentelemetry/trace/scope.h"
Expand Down
1 change: 0 additions & 1 deletion api/test/singleton/component_b.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

#include "opentelemetry/context/context_value.h"
#include "opentelemetry/nostd/shared_ptr.h"
#include "opentelemetry/trace/provider.h"
#include "opentelemetry/trace/scope.h"
Expand Down
1 change: 0 additions & 1 deletion api/test/singleton/component_c.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

#include "opentelemetry/context/context_value.h"
#include "opentelemetry/nostd/shared_ptr.h"
#include "opentelemetry/trace/provider.h"
#include "opentelemetry/trace/scope.h"
Expand Down
1 change: 0 additions & 1 deletion api/test/singleton/component_d.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

#include "opentelemetry/context/context_value.h"
#include "opentelemetry/nostd/shared_ptr.h"
#include "opentelemetry/trace/provider.h"
#include "opentelemetry/trace/scope.h"
Expand Down
1 change: 0 additions & 1 deletion api/test/singleton/component_e.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

#include "opentelemetry/context/context_value.h"
#include "opentelemetry/nostd/shared_ptr.h"
#include "opentelemetry/trace/provider.h"
#include "opentelemetry/trace/scope.h"
Expand Down
1 change: 0 additions & 1 deletion api/test/singleton/component_f.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

#include "opentelemetry/context/context_value.h"
#include "opentelemetry/nostd/shared_ptr.h"
#include "opentelemetry/trace/provider.h"
#include "opentelemetry/trace/scope.h"
Expand Down
1 change: 0 additions & 1 deletion api/test/singleton/component_g.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

#include "opentelemetry/context/context_value.h"
#include "opentelemetry/nostd/shared_ptr.h"
#include "opentelemetry/trace/provider.h"
#include "opentelemetry/trace/scope.h"
Expand Down
1 change: 0 additions & 1 deletion api/test/singleton/component_h.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

#include "opentelemetry/context/context_value.h"
#include "opentelemetry/nostd/shared_ptr.h"
#include "opentelemetry/trace/provider.h"
#include "opentelemetry/trace/scope.h"
Expand Down
1 change: 0 additions & 1 deletion api/test/singleton/singleton_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "opentelemetry/common/key_value_iterable.h"
#include "opentelemetry/nostd/shared_ptr.h"
#include "opentelemetry/nostd/string_view.h"
#include "opentelemetry/nostd/utility.h"
#include "opentelemetry/trace/default_span.h"
#include "opentelemetry/trace/noop.h"
#include "opentelemetry/trace/provider.h"
Expand Down
2 changes: 1 addition & 1 deletion api/test/trace/key_value_iterable_view_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
#include "opentelemetry/common/attribute_value.h"
#include "opentelemetry/common/key_value_iterable.h"
#include "opentelemetry/common/key_value_iterable_view.h"
#include "opentelemetry/nostd/function_ref.h"
#include "opentelemetry/nostd/string_view.h"
#include "opentelemetry/nostd/type_traits.h"
#include "opentelemetry/nostd/utility.h"

using namespace opentelemetry;

Expand Down
1 change: 0 additions & 1 deletion api/test/trace/noop_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <vector>

#include "opentelemetry/common/timestamp.h"
#include "opentelemetry/context/context_value.h"
#include "opentelemetry/nostd/shared_ptr.h"
#include "opentelemetry/nostd/span.h"
#include "opentelemetry/nostd/unique_ptr.h"
Expand Down
1 change: 0 additions & 1 deletion api/test/trace/propagation/b3_propagation_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include "util.h"

#include "opentelemetry/context/context.h"
#include "opentelemetry/context/context_value.h"
#include "opentelemetry/context/propagation/text_map_propagator.h"
#include "opentelemetry/context/runtime_context.h"
#include "opentelemetry/nostd/shared_ptr.h"
Expand Down
1 change: 0 additions & 1 deletion api/test/trace/propagation/detail/hex_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <stdint.h>
#include <string>

#include "opentelemetry/nostd/string_view.h"
#include "opentelemetry/trace/propagation/detail/hex.h"

using namespace opentelemetry;
Expand Down
2 changes: 1 addition & 1 deletion api/test/trace/propagation/http_text_format_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
#include "util.h"

#include "opentelemetry/context/context.h"
#include "opentelemetry/context/context_value.h"
#include "opentelemetry/context/propagation/global_propagator.h"
#include "opentelemetry/context/propagation/text_map_propagator.h"
#include "opentelemetry/context/runtime_context.h"
#include "opentelemetry/nostd/function_ref.h"
#include "opentelemetry/nostd/shared_ptr.h"
#include "opentelemetry/nostd/span.h"
#include "opentelemetry/nostd/string_view.h"
Expand Down
2 changes: 1 addition & 1 deletion api/test/trace/propagation/jaeger_propagation_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
#include "util.h"

#include "opentelemetry/context/context.h"
#include "opentelemetry/context/context_value.h"
#include "opentelemetry/context/propagation/text_map_propagator.h"
#include "opentelemetry/context/runtime_context.h"
#include "opentelemetry/nostd/function_ref.h"
#include "opentelemetry/nostd/shared_ptr.h"
#include "opentelemetry/nostd/span.h"
#include "opentelemetry/nostd/string_view.h"
Expand Down
1 change: 0 additions & 1 deletion api/test/trace/provider_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include "opentelemetry/nostd/shared_ptr.h"
#include "opentelemetry/nostd/string_view.h"
#include "opentelemetry/trace/provider.h"
#include "opentelemetry/trace/tracer.h"
#include "opentelemetry/trace/tracer_provider.h"

using opentelemetry::trace::Provider;
Expand Down
1 change: 1 addition & 0 deletions api/test/trace/scope_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

#include <gtest/gtest.h>
#include <string>

#include "opentelemetry/context/context_value.h"
#include "opentelemetry/context/runtime_context.h"
Expand Down
1 change: 0 additions & 1 deletion api/test/trace/span_benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <benchmark/benchmark.h>
#include <cstdint>

#include "opentelemetry/context/context_value.h"
#include "opentelemetry/context/runtime_context.h"
#include "opentelemetry/nostd/shared_ptr.h"
#include "opentelemetry/nostd/span.h"
Expand Down
1 change: 1 addition & 0 deletions api/test/trace/span_context_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "opentelemetry/trace/trace_id.h"

#include <gtest/gtest.h>
#include <string>

using opentelemetry::trace::SpanContext;
namespace trace_api = opentelemetry::trace;
Expand Down
Loading

0 comments on commit e5a1a15

Please sign in to comment.