Skip to content

Commit

Permalink
[clang-format] Remove custom clang-format rules for include ordering (g…
Browse files Browse the repository at this point in the history
…rpc#37820)

Closes grpc#37820

PiperOrigin-RevId: 682352913
  • Loading branch information
ctiller authored and copybara-github committed Oct 4, 2024
1 parent 41dc97e commit dbb5164
Show file tree
Hide file tree
Showing 2,150 changed files with 5,746 additions and 9,439 deletions.
30 changes: 0 additions & 30 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,6 @@ IncludeCategories:
# ruby.h is even more first if it's included
- Regex: '^<ruby/ruby.h>'
Priority: -200
# Some platforms (namely msys) need wchar to be included BEFORE
# anything else, especially strsafe.h.
- Regex: '^<wchar.h>'
Priority: 5
# use priority 100+ for grpc headers so they sort last
# 'system' headers - include things that have " in the names to make them
# stand out and get fixed
- Regex: '^(<|")grpc'
Priority: 100
# similary using include/ to get system headers should stand out and get
# fixed
- Regex: '^"include/'
Priority: 100
# source headers go last
- Regex: '^"(src|test)/'
Priority: 101
# not-grpc headers follow
# first, non system headers that are included like <> - these are all
# local carveouts, and get sorted below c++ but before non grpc "" files
- Regex: '^<(openssl/|uv\.h|ares\.h|address_sorting/|gmock/|gtest/|zlib|zconf|benchmark/|google/)'
Priority: 30
# first C system headers - they have a . in the filename
- Regex: '^<.*\.'
Priority: 10
# then C++ system headers - no ., the only thing that will match now
- Regex: '^<'
Priority: 20
# finally other "" includes go between system headers and our headers
- Regex: '^"'
Priority: 40
---
Language: ObjC
BasedOnStyle: Google
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@
// limitations under the License.

#include <android/log.h>
#include <grpcpp/create_channel_binder.h>
#include <grpcpp/security/binder_security_policy.h>
#include <jni.h>

#include "examples/protos/helloworld.grpc.pb.h"
#include "examples/protos/helloworld.pb.h"

#include <grpcpp/create_channel_binder.h>
#include <grpcpp/security/binder_security_policy.h>

extern "C" JNIEXPORT jstring JNICALL
Java_io_grpc_binder_cpp_exampleclient_ButtonPressHandler_native_1entry(
JNIEnv* env, jobject /*this*/, jobject application) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@
// limitations under the License.

#include <android/log.h>
#include <jni.h>

#include "examples/protos/helloworld.grpc.pb.h"
#include "examples/protos/helloworld.pb.h"

#include <grpcpp/create_channel_binder.h>
#include <grpcpp/grpcpp.h>
#include <grpcpp/security/binder_credentials.h>
#include <grpcpp/security/binder_security_policy.h>
#include <jni.h>

#include "examples/protos/helloworld.grpc.pb.h"
#include "examples/protos/helloworld.pb.h"

namespace {
class GreeterService : public helloworld::Greeter::Service {
Expand Down
4 changes: 2 additions & 2 deletions examples/cpp/auth/ssl_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*
*/

#include <grpcpp/grpcpp.h>

#include <condition_variable>
#include <iostream>
#include <memory>
Expand All @@ -26,8 +28,6 @@
#include "absl/flags/parse.h"
#include "helper.h"

#include <grpcpp/grpcpp.h>

#ifdef BAZEL_BUILD
#include "examples/protos/helloworld.grpc.pb.h"
#else
Expand Down
4 changes: 2 additions & 2 deletions examples/cpp/auth/ssl_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <grpcpp/grpcpp.h>

#include <iostream>
#include <memory>
#include <string>
Expand All @@ -21,8 +23,6 @@
#include "absl/strings/str_format.h"
#include "helper.h"

#include <grpcpp/grpcpp.h>

#ifdef BAZEL_BUILD
#include "examples/protos/helloworld.grpc.pb.h"
#else
Expand Down
4 changes: 2 additions & 2 deletions examples/cpp/cancellation/client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <grpcpp/grpcpp.h>

#include <condition_variable>
#include <iostream>
#include <memory>
Expand All @@ -23,8 +25,6 @@
#include "absl/flags/parse.h"
#include "absl/strings/str_cat.h"

#include <grpcpp/grpcpp.h>

#ifdef BAZEL_BUILD
#include "examples/protos/helloworld.grpc.pb.h"
#else
Expand Down
4 changes: 2 additions & 2 deletions examples/cpp/cancellation/server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <grpcpp/grpcpp.h>

#include <iostream>
#include <memory>
#include <string>
Expand All @@ -21,8 +23,6 @@
#include "absl/flags/parse.h"
#include "absl/strings/str_format.h"

#include <grpcpp/grpcpp.h>

#ifdef BAZEL_BUILD
#include "examples/protos/helloworld.grpc.pb.h"
#else
Expand Down
4 changes: 2 additions & 2 deletions examples/cpp/compression/greeter_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
*
*/

#include <grpcpp/grpcpp.h>

#include <iostream>
#include <memory>
#include <string>

#include <grpcpp/grpcpp.h>

#ifdef BAZEL_BUILD
#include "examples/protos/helloworld.grpc.pb.h"
#else
Expand Down
4 changes: 2 additions & 2 deletions examples/cpp/compression/greeter_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
*
*/

#include <grpcpp/grpcpp.h>

#include <iostream>
#include <memory>
#include <string>

#include <grpcpp/grpcpp.h>

#ifdef BAZEL_BUILD
#include "examples/protos/helloworld.grpc.pb.h"
#else
Expand Down
7 changes: 3 additions & 4 deletions examples/cpp/csm/csm_greeter_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
*
*/

#include <grpcpp/ext/csm_observability.h>
#include <grpcpp/grpcpp.h>
#include <grpcpp/support/string_ref.h>
#include <sys/types.h>

#include <chrono>
Expand All @@ -34,10 +37,6 @@
#include "opentelemetry/exporters/prometheus/exporter_options.h"
#include "opentelemetry/sdk/metrics/meter_provider.h"

#include <grpcpp/ext/csm_observability.h>
#include <grpcpp/grpcpp.h>
#include <grpcpp/support/string_ref.h>

#ifdef BAZEL_BUILD
#include "examples/protos/helloworld.grpc.pb.h"
#else
Expand Down
15 changes: 7 additions & 8 deletions examples/cpp/csm/csm_greeter_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
*
*/

#include <grpcpp/ext/admin_services.h>
#include <grpcpp/ext/csm_observability.h>
#include <grpcpp/ext/proto_server_reflection_plugin.h>
#include <grpcpp/grpcpp.h>
#include <grpcpp/health_check_service_interface.h>
#include <grpcpp/xds_server_builder.h>

#include <iostream>
#include <memory>
#include <string>
Expand All @@ -27,14 +34,6 @@
#include "opentelemetry/exporters/prometheus/exporter_factory.h"
#include "opentelemetry/exporters/prometheus/exporter_options.h"
#include "opentelemetry/sdk/metrics/meter_provider.h"

#include <grpcpp/ext/admin_services.h>
#include <grpcpp/ext/csm_observability.h>
#include <grpcpp/ext/proto_server_reflection_plugin.h>
#include <grpcpp/grpcpp.h>
#include <grpcpp/health_check_service_interface.h>
#include <grpcpp/xds_server_builder.h>

#include "src/core/util/gethostname.h"

#ifdef BAZEL_BUILD
Expand Down
7 changes: 3 additions & 4 deletions examples/cpp/csm/observability/csm_greeter_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
*
*/

#include <grpcpp/ext/csm_observability.h>
#include <grpcpp/grpcpp.h>
#include <grpcpp/support/string_ref.h>
#include <sys/types.h>

#include <chrono>
Expand All @@ -32,10 +35,6 @@
#include "opentelemetry/exporters/prometheus/exporter_options.h"
#include "opentelemetry/sdk/metrics/meter_provider.h"

#include <grpcpp/ext/csm_observability.h>
#include <grpcpp/grpcpp.h>
#include <grpcpp/support/string_ref.h>

ABSL_FLAG(std::string, target, "xds:///helloworld:50051", "Target string");
ABSL_FLAG(std::string, prometheus_endpoint, "localhost:9464",
"Prometheus exporter endpoint");
Expand Down
14 changes: 7 additions & 7 deletions examples/cpp/csm/observability/csm_greeter_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
*
*/

#include <grpcpp/ext/admin_services.h>
#include <grpcpp/ext/csm_observability.h>
#include <grpcpp/ext/proto_server_reflection_plugin.h>
#include <grpcpp/grpcpp.h>
#include <grpcpp/health_check_service_interface.h>
#include <grpcpp/xds_server_builder.h>

#include <iostream>
#include <memory>
#include <string>
Expand All @@ -31,13 +38,6 @@
#include "opentelemetry/exporters/prometheus/exporter_options.h"
#include "opentelemetry/sdk/metrics/meter_provider.h"

#include <grpcpp/ext/admin_services.h>
#include <grpcpp/ext/csm_observability.h>
#include <grpcpp/ext/proto_server_reflection_plugin.h>
#include <grpcpp/grpcpp.h>
#include <grpcpp/health_check_service_interface.h>
#include <grpcpp/xds_server_builder.h>

ABSL_FLAG(int32_t, port, 50051, "Server port for service.");
ABSL_FLAG(std::string, prometheus_endpoint, "localhost:9464",
"Prometheus exporter endpoint");
Expand Down
4 changes: 2 additions & 2 deletions examples/cpp/deadline/client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <grpcpp/grpcpp.h>

#include <condition_variable>
#include <iostream>
#include <memory>
Expand All @@ -23,8 +25,6 @@
#include "absl/flags/parse.h"
#include "absl/strings/str_cat.h"

#include <grpcpp/grpcpp.h>

#ifdef BAZEL_BUILD
#include "examples/protos/helloworld.grpc.pb.h"
#else
Expand Down
4 changes: 2 additions & 2 deletions examples/cpp/deadline/server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <grpcpp/grpcpp.h>

#include <chrono>
#include <condition_variable>
#include <iostream>
Expand All @@ -25,8 +27,6 @@
#include "absl/strings/match.h"
#include "absl/strings/str_format.h"

#include <grpcpp/grpcpp.h>

#ifdef BAZEL_BUILD
#include "examples/protos/helloworld.grpc.pb.h"
#else
Expand Down
4 changes: 2 additions & 2 deletions examples/cpp/debugging/crashing_greeter_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <grpcpp/grpcpp.h>

#include <iostream>
#include <memory>
#include <string>

#include "absl/flags/flag.h"
#include "absl/flags/parse.h"

#include <grpcpp/grpcpp.h>

#ifdef BAZEL_BUILD
#include "examples/protos/helloworld.grpc.pb.h"
#else
Expand Down
10 changes: 5 additions & 5 deletions examples/cpp/debugging/greeter_callback_server_admin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <grpcpp/ext/admin_services.h>
#include <grpcpp/ext/proto_server_reflection_plugin.h>
#include <grpcpp/grpcpp.h>
#include <grpcpp/health_check_service_interface.h>

#include <iostream>
#include <memory>
#include <string>
Expand All @@ -20,11 +25,6 @@
#include "absl/flags/parse.h"
#include "absl/strings/str_format.h"

#include <grpcpp/ext/admin_services.h>
#include <grpcpp/ext/proto_server_reflection_plugin.h>
#include <grpcpp/grpcpp.h>
#include <grpcpp/health_check_service_interface.h>

#ifdef BAZEL_BUILD
#include "examples/protos/helloworld.grpc.pb.h"
#else
Expand Down
5 changes: 2 additions & 3 deletions examples/cpp/error_details/greeter_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <grpcpp/grpcpp.h>

#include <condition_variable>
#include <iostream>
#include <memory>
Expand All @@ -22,12 +24,9 @@
#include "absl/flags/parse.h"
#include "absl/strings/str_format.h"

#include <grpcpp/grpcpp.h>

#ifdef BAZEL_BUILD
#include "examples/protos/helloworld.grpc.pb.h"
#include "google/rpc/error_details.pb.h"

#include "src/proto/grpc/status/status.pb.h"
#else
#include "error_details.pb.h"
Expand Down
Loading

0 comments on commit dbb5164

Please sign in to comment.