diff options
author | Craig Tiller <ctiller@google.com> | 2024-04-09 08:57:27 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2024-04-09 09:10:57 -0700 |
commit | 3383b8182fb8397ed56787cf2bd43e79199f962d (patch) | |
tree | 9177868de5b4bb464adc34b353df701c8e4468d9 | |
parent | 83a17ff4684dc1fb3493a151ac0b655b1c55e766 (diff) | |
download | grpc-grpc-3383b8182fb8397ed56787cf2bd43e79199f962d.tar.gz |
[clang-format] Remove requirement that port_platform.h is at the top (#36274)
Closes #36274
COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36274 from ctiller:port_platform-include-grpc-clang-format e368acfad9ba00b401ed3483ccee7fe29f50c351
PiperOrigin-RevId: 623182400
34 files changed, 38 insertions, 65 deletions
diff --git a/include/grpc/.clang-format b/include/grpc/.clang-format index 64387e9e51..5f150ef6ed 100644 --- a/include/grpc/.clang-format +++ b/include/grpc/.clang-format @@ -5,9 +5,6 @@ DerivePointerAlignment: false PointerAlignment: Left IncludeBlocks: Regroup IncludeCategories: - # port_platform.h is before almost everything - - Regex: '^<grpc/(support|impl/codegen)/port_platform.h>' - Priority: -100 # ruby.h is even more first if it's included - Regex: '^<ruby/ruby.h>' Priority: -200 diff --git a/include/grpc/byte_buffer.h b/include/grpc/byte_buffer.h index 65b526496d..dc8fc5739e 100644 --- a/include/grpc/byte_buffer.h +++ b/include/grpc/byte_buffer.h @@ -19,10 +19,9 @@ #ifndef GRPC_BYTE_BUFFER_H #define GRPC_BYTE_BUFFER_H -#include <grpc/support/port_platform.h> - #include <grpc/impl/grpc_types.h> #include <grpc/slice_buffer.h> +#include <grpc/support/port_platform.h> #ifdef __cplusplus extern "C" { diff --git a/include/grpc/census.h b/include/grpc/census.h index 4894f1c096..64db78b0d0 100644 --- a/include/grpc/census.h +++ b/include/grpc/census.h @@ -19,9 +19,8 @@ #ifndef GRPC_CENSUS_H #define GRPC_CENSUS_H -#include <grpc/support/port_platform.h> - #include <grpc/grpc.h> +#include <grpc/support/port_platform.h> #ifdef __cplusplus extern "C" { diff --git a/include/grpc/compression.h b/include/grpc/compression.h index ce8ec4ef03..0f07a514b2 100644 --- a/include/grpc/compression.h +++ b/include/grpc/compression.h @@ -19,12 +19,11 @@ #ifndef GRPC_COMPRESSION_H #define GRPC_COMPRESSION_H -#include <grpc/support/port_platform.h> - #include <stdlib.h> #include <grpc/impl/compression_types.h> // IWYU pragma: export #include <grpc/slice.h> +#include <grpc/support/port_platform.h> #ifdef __cplusplus extern "C" { diff --git a/include/grpc/event_engine/endpoint_config.h b/include/grpc/event_engine/endpoint_config.h index 68dae44cae..ea1699afc5 100644 --- a/include/grpc/event_engine/endpoint_config.h +++ b/include/grpc/event_engine/endpoint_config.h @@ -14,13 +14,13 @@ #ifndef GRPC_EVENT_ENGINE_ENDPOINT_CONFIG_H #define GRPC_EVENT_ENGINE_ENDPOINT_CONFIG_H -#include <grpc/support/port_platform.h> - #include <string> #include "absl/strings/string_view.h" #include "absl/types/optional.h" +#include <grpc/support/port_platform.h> + namespace grpc_event_engine { namespace experimental { diff --git a/include/grpc/event_engine/event_engine.h b/include/grpc/event_engine/event_engine.h index 93c94664bc..7e2cd0346a 100644 --- a/include/grpc/event_engine/event_engine.h +++ b/include/grpc/event_engine/event_engine.h @@ -14,8 +14,6 @@ #ifndef GRPC_EVENT_ENGINE_EVENT_ENGINE_H #define GRPC_EVENT_ENGINE_EVENT_ENGINE_H -#include <grpc/support/port_platform.h> - #include <vector> #include "absl/functional/any_invocable.h" @@ -27,6 +25,7 @@ #include <grpc/event_engine/memory_allocator.h> #include <grpc/event_engine/port.h> #include <grpc/event_engine/slice_buffer.h> +#include <grpc/support/port_platform.h> // TODO(vigneshbabu): Define the Endpoint::Write metrics collection system namespace grpc_event_engine { diff --git a/include/grpc/event_engine/extensible.h b/include/grpc/event_engine/extensible.h index 77483c82ab..51812f935c 100644 --- a/include/grpc/event_engine/extensible.h +++ b/include/grpc/event_engine/extensible.h @@ -15,10 +15,10 @@ #ifndef GRPC_EVENT_ENGINE_EXTENSIBLE_H #define GRPC_EVENT_ENGINE_EXTENSIBLE_H -#include <grpc/support/port_platform.h> - #include "absl/strings/string_view.h" +#include <grpc/support/port_platform.h> + namespace grpc_event_engine { namespace experimental { diff --git a/include/grpc/event_engine/internal/memory_allocator_impl.h b/include/grpc/event_engine/internal/memory_allocator_impl.h index e34ffc7f9c..91cba5a949 100644 --- a/include/grpc/event_engine/internal/memory_allocator_impl.h +++ b/include/grpc/event_engine/internal/memory_allocator_impl.h @@ -14,8 +14,6 @@ #ifndef GRPC_EVENT_ENGINE_INTERNAL_MEMORY_ALLOCATOR_IMPL_H #define GRPC_EVENT_ENGINE_INTERNAL_MEMORY_ALLOCATOR_IMPL_H -#include <grpc/support/port_platform.h> - #include <algorithm> #include <memory> #include <type_traits> @@ -23,6 +21,7 @@ #include <grpc/event_engine/memory_request.h> #include <grpc/slice.h> +#include <grpc/support/port_platform.h> namespace grpc_event_engine { namespace experimental { diff --git a/include/grpc/event_engine/memory_allocator.h b/include/grpc/event_engine/memory_allocator.h index cd14e3a933..3a347c3b5c 100644 --- a/include/grpc/event_engine/memory_allocator.h +++ b/include/grpc/event_engine/memory_allocator.h @@ -14,8 +14,6 @@ #ifndef GRPC_EVENT_ENGINE_MEMORY_ALLOCATOR_H #define GRPC_EVENT_ENGINE_MEMORY_ALLOCATOR_H -#include <grpc/support/port_platform.h> - #include <stdlib.h> // for abort() #include <algorithm> @@ -25,6 +23,7 @@ #include <grpc/event_engine/internal/memory_allocator_impl.h> #include <grpc/slice.h> +#include <grpc/support/port_platform.h> namespace grpc_event_engine { namespace experimental { diff --git a/include/grpc/event_engine/memory_request.h b/include/grpc/event_engine/memory_request.h index fa15e26cbf..2018b3d476 100644 --- a/include/grpc/event_engine/memory_request.h +++ b/include/grpc/event_engine/memory_request.h @@ -14,12 +14,12 @@ #ifndef GRPC_EVENT_ENGINE_MEMORY_REQUEST_H #define GRPC_EVENT_ENGINE_MEMORY_REQUEST_H -#include <grpc/support/port_platform.h> - #include <stddef.h> #include "absl/strings/string_view.h" +#include <grpc/support/port_platform.h> + namespace grpc_event_engine { namespace experimental { diff --git a/include/grpc/event_engine/slice.h b/include/grpc/event_engine/slice.h index ce7693f648..8153f983a4 100644 --- a/include/grpc/event_engine/slice.h +++ b/include/grpc/event_engine/slice.h @@ -15,8 +15,6 @@ #ifndef GRPC_EVENT_ENGINE_SLICE_H #define GRPC_EVENT_ENGINE_SLICE_H -#include <grpc/support/port_platform.h> - #include <string.h> #include <cstdint> @@ -28,6 +26,7 @@ #include <grpc/event_engine/internal/slice_cast.h> #include <grpc/slice.h> #include <grpc/support/log.h> +#include <grpc/support/port_platform.h> // This public slice definition largely based of the internal grpc_core::Slice // implementation. Changes to this implementation might warrant changes to the diff --git a/include/grpc/event_engine/slice_buffer.h b/include/grpc/event_engine/slice_buffer.h index 0e94db056f..0009089a6b 100644 --- a/include/grpc/event_engine/slice_buffer.h +++ b/include/grpc/event_engine/slice_buffer.h @@ -15,8 +15,6 @@ #ifndef GRPC_EVENT_ENGINE_SLICE_BUFFER_H #define GRPC_EVENT_ENGINE_SLICE_BUFFER_H -#include <grpc/support/port_platform.h> - #include <string.h> #include <cstdint> @@ -31,6 +29,7 @@ #include <grpc/slice.h> #include <grpc/slice_buffer.h> #include <grpc/support/log.h> +#include <grpc/support/port_platform.h> namespace grpc_event_engine { namespace experimental { diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index ad475897b1..2052773035 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -19,8 +19,6 @@ #ifndef GRPC_GRPC_H #define GRPC_GRPC_H -#include <grpc/support/port_platform.h> - #include <stddef.h> #include <grpc/byte_buffer.h> @@ -29,6 +27,7 @@ #include <grpc/impl/propagation_bits.h> #include <grpc/slice.h> #include <grpc/status.h> +#include <grpc/support/port_platform.h> #include <grpc/support/time.h> #ifdef __cplusplus diff --git a/include/grpc/grpc_audit_logging.h b/include/grpc/grpc_audit_logging.h index 0fda104395..4c30593f2f 100644 --- a/include/grpc/grpc_audit_logging.h +++ b/include/grpc/grpc_audit_logging.h @@ -19,8 +19,6 @@ #ifndef GRPC_GRPC_AUDIT_LOGGING_H #define GRPC_GRPC_AUDIT_LOGGING_H -#include <grpc/support/port_platform.h> - #include <memory> #include <string> @@ -28,6 +26,7 @@ #include "absl/strings/string_view.h" #include <grpc/support/json.h> +#include <grpc/support/port_platform.h> namespace grpc_core { namespace experimental { diff --git a/include/grpc/grpc_crl_provider.h b/include/grpc/grpc_crl_provider.h index 5baea14e2a..04e8ffa090 100644 --- a/include/grpc/grpc_crl_provider.h +++ b/include/grpc/grpc_crl_provider.h @@ -19,8 +19,6 @@ #ifndef GRPC_GRPC_CRL_PROVIDER_H #define GRPC_GRPC_CRL_PROVIDER_H -#include <grpc/support/port_platform.h> - #include <memory> #include <string> @@ -28,6 +26,7 @@ #include "absl/strings/string_view.h" #include <grpc/grpc_security.h> +#include <grpc/support/port_platform.h> namespace grpc_core { namespace experimental { diff --git a/include/grpc/grpc_cronet.h b/include/grpc/grpc_cronet.h index 289cfcda67..b8ce11da6e 100644 --- a/include/grpc/grpc_cronet.h +++ b/include/grpc/grpc_cronet.h @@ -19,9 +19,8 @@ #ifndef GRPC_GRPC_CRONET_H #define GRPC_GRPC_CRONET_H -#include <grpc/support/port_platform.h> - #include <grpc/grpc.h> +#include <grpc/support/port_platform.h> #ifdef __cplusplus extern "C" { diff --git a/include/grpc/grpc_posix.h b/include/grpc/grpc_posix.h index a237cb36c7..3f59a4423d 100644 --- a/include/grpc/grpc_posix.h +++ b/include/grpc/grpc_posix.h @@ -19,12 +19,11 @@ #ifndef GRPC_GRPC_POSIX_H #define GRPC_GRPC_POSIX_H -#include <grpc/support/port_platform.h> - #include <stddef.h> #include <grpc/grpc.h> #include <grpc/impl/grpc_types.h> +#include <grpc/support/port_platform.h> #ifdef __cplusplus extern "C" { diff --git a/include/grpc/grpc_security.h b/include/grpc/grpc_security.h index c81b81a207..5524170a2a 100644 --- a/include/grpc/grpc_security.h +++ b/include/grpc/grpc_security.h @@ -19,13 +19,12 @@ #ifndef GRPC_GRPC_SECURITY_H #define GRPC_GRPC_SECURITY_H -#include <grpc/support/port_platform.h> - #include <stdbool.h> #include <grpc/grpc.h> #include <grpc/grpc_security_constants.h> #include <grpc/status.h> +#include <grpc/support/port_platform.h> #ifdef __cplusplus extern "C" { diff --git a/include/grpc/impl/call.h b/include/grpc/impl/call.h index d1f7c2642b..ea298f2ef5 100644 --- a/include/grpc/impl/call.h +++ b/include/grpc/impl/call.h @@ -15,11 +15,10 @@ #ifndef GRPC_IMPL_CALL_H #define GRPC_IMPL_CALL_H -#include <grpc/support/port_platform.h> - #include "absl/functional/any_invocable.h" #include <grpc/grpc.h> +#include <grpc/support/port_platform.h> // Run a callback in the call's EventEngine. // Internal-only diff --git a/include/grpc/impl/grpc_types.h b/include/grpc/impl/grpc_types.h index 9250ce8f6b..b1305114eb 100644 --- a/include/grpc/impl/grpc_types.h +++ b/include/grpc/impl/grpc_types.h @@ -21,14 +21,13 @@ // IWYU pragma: private, include <grpc/grpc.h> -#include <grpc/support/port_platform.h> - #include <stddef.h> #include <grpc/impl/channel_arg_names.h> #include <grpc/impl/compression_types.h> #include <grpc/slice.h> #include <grpc/status.h> +#include <grpc/support/port_platform.h> #include <grpc/support/time.h> #ifdef __cplusplus diff --git a/include/grpc/impl/slice_type.h b/include/grpc/impl/slice_type.h index 4776f4b6c4..5e35446ef9 100644 --- a/include/grpc/impl/slice_type.h +++ b/include/grpc/impl/slice_type.h @@ -21,10 +21,10 @@ // IWYU pragma: private, include <grpc/slice.h> -#include <grpc/support/port_platform.h> - #include <stddef.h> +#include <grpc/support/port_platform.h> + typedef struct grpc_slice grpc_slice; /** Slice API diff --git a/include/grpc/slice.h b/include/grpc/slice.h index 7318a0e715..8b50cf28bd 100644 --- a/include/grpc/slice.h +++ b/include/grpc/slice.h @@ -19,9 +19,8 @@ #ifndef GRPC_SLICE_H #define GRPC_SLICE_H -#include <grpc/support/port_platform.h> - #include <grpc/impl/slice_type.h> // IWYU pragma: export +#include <grpc/support/port_platform.h> #include <grpc/support/sync.h> #ifdef __cplusplus diff --git a/include/grpc/slice_buffer.h b/include/grpc/slice_buffer.h index d8c6b91818..ea0afa5469 100644 --- a/include/grpc/slice_buffer.h +++ b/include/grpc/slice_buffer.h @@ -19,9 +19,8 @@ #ifndef GRPC_SLICE_BUFFER_H #define GRPC_SLICE_BUFFER_H -#include <grpc/support/port_platform.h> - #include <grpc/slice.h> +#include <grpc/support/port_platform.h> #ifdef __cplusplus extern "C" { diff --git a/include/grpc/support/alloc.h b/include/grpc/support/alloc.h index d440e4be8c..fdfa63c8e8 100644 --- a/include/grpc/support/alloc.h +++ b/include/grpc/support/alloc.h @@ -19,10 +19,10 @@ #ifndef GRPC_SUPPORT_ALLOC_H #define GRPC_SUPPORT_ALLOC_H -#include <grpc/support/port_platform.h> - #include <stddef.h> +#include <grpc/support/port_platform.h> + #ifdef __cplusplus extern "C" { #endif diff --git a/include/grpc/support/json.h b/include/grpc/support/json.h index bae9268271..7b850e1cc2 100644 --- a/include/grpc/support/json.h +++ b/include/grpc/support/json.h @@ -17,8 +17,6 @@ #ifndef GRPC_SUPPORT_JSON_H #define GRPC_SUPPORT_JSON_H -#include <grpc/support/port_platform.h> - #include <stdint.h> #include <map> @@ -29,6 +27,8 @@ #include "absl/strings/str_cat.h" #include "absl/types/variant.h" +#include <grpc/support/port_platform.h> + namespace grpc_core { namespace experimental { diff --git a/include/grpc/support/log.h b/include/grpc/support/log.h index 1f987fd35d..a118561904 100644 --- a/include/grpc/support/log.h +++ b/include/grpc/support/log.h @@ -19,11 +19,11 @@ #ifndef GRPC_SUPPORT_LOG_H #define GRPC_SUPPORT_LOG_H -#include <grpc/support/port_platform.h> - #include <stdarg.h> #include <stdlib.h> /* for abort() */ +#include <grpc/support/port_platform.h> + #ifdef __cplusplus extern "C" { #endif diff --git a/include/grpc/support/metrics.h b/include/grpc/support/metrics.h index bf80f91c38..7462e6aba6 100644 --- a/include/grpc/support/metrics.h +++ b/include/grpc/support/metrics.h @@ -15,10 +15,10 @@ #ifndef GRPC_SUPPORT_METRICS_H #define GRPC_SUPPORT_METRICS_H -#include <grpc/support/port_platform.h> - #include "absl/strings/string_view.h" +#include <grpc/support/port_platform.h> + namespace grpc_core { namespace experimental { diff --git a/include/grpc/support/string_util.h b/include/grpc/support/string_util.h index d047369eab..07f296ed7c 100644 --- a/include/grpc/support/string_util.h +++ b/include/grpc/support/string_util.h @@ -20,7 +20,6 @@ #define GRPC_SUPPORT_STRING_UTIL_H #include <grpc/support/port_platform.h> - #include <grpc/support/time.h> #ifdef __cplusplus diff --git a/include/grpc/support/sync.h b/include/grpc/support/sync.h index 2ed89ca086..76d2a10c47 100644 --- a/include/grpc/support/sync.h +++ b/include/grpc/support/sync.h @@ -21,7 +21,6 @@ /* Platform-specific type declarations of gpr_mu and gpr_cv. */ #include <grpc/support/port_platform.h> - #include <grpc/support/time.h> /* for gpr_timespec */ #ifdef __cplusplus diff --git a/include/grpc/support/sync_abseil.h b/include/grpc/support/sync_abseil.h index 8515319199..f10283c5d7 100644 --- a/include/grpc/support/sync_abseil.h +++ b/include/grpc/support/sync_abseil.h @@ -20,7 +20,6 @@ #define GRPC_SUPPORT_SYNC_ABSEIL_H #include <grpc/support/port_platform.h> - #include <grpc/support/sync_generic.h> #ifdef GPR_ABSEIL_SYNC diff --git a/include/grpc/support/sync_custom.h b/include/grpc/support/sync_custom.h index c0e6975f07..f80db78027 100644 --- a/include/grpc/support/sync_custom.h +++ b/include/grpc/support/sync_custom.h @@ -20,7 +20,6 @@ #define GRPC_SUPPORT_SYNC_CUSTOM_H #include <grpc/support/port_platform.h> - #include <grpc/support/sync_generic.h> /* Users defining GPR_CUSTOM_SYNC need to define the following macros. */ diff --git a/include/grpc/support/sync_generic.h b/include/grpc/support/sync_generic.h index 9e92eb2fec..b3e638ce54 100644 --- a/include/grpc/support/sync_generic.h +++ b/include/grpc/support/sync_generic.h @@ -21,9 +21,8 @@ /* Generic type definitions for gpr_sync. */ -#include <grpc/support/port_platform.h> - #include <grpc/support/atm.h> +#include <grpc/support/port_platform.h> /* gpr_event */ typedef struct { diff --git a/include/grpc/support/sync_posix.h b/include/grpc/support/sync_posix.h index b7aba57244..5348bac951 100644 --- a/include/grpc/support/sync_posix.h +++ b/include/grpc/support/sync_posix.h @@ -19,10 +19,9 @@ #ifndef GRPC_SUPPORT_SYNC_POSIX_H #define GRPC_SUPPORT_SYNC_POSIX_H -#include <grpc/support/port_platform.h> - #include <pthread.h> +#include <grpc/support/port_platform.h> #include <grpc/support/sync_generic.h> #ifdef GRPC_ASAN_ENABLED diff --git a/include/grpc/support/time.h b/include/grpc/support/time.h index 6f0ae9f787..7adbfcedd1 100644 --- a/include/grpc/support/time.h +++ b/include/grpc/support/time.h @@ -19,11 +19,11 @@ #ifndef GRPC_SUPPORT_TIME_H #define GRPC_SUPPORT_TIME_H -#include <grpc/support/port_platform.h> - #include <stddef.h> #include <time.h> +#include <grpc/support/port_platform.h> + #ifdef __cplusplus extern "C" { #endif |