From 755b690a7c31d92103343f20ba32d752495e60a3 Mon Sep 17 00:00:00 2001 From: Mike Kruskal Date: Tue, 9 Jan 2024 17:32:10 -0800 Subject: [PATCH] Breaking change: disallow incorrect ctype usage PiperOrigin-RevId: 597091014 --- src/google/protobuf/compiler/cpp/generator.cc | 2 -- src/google/protobuf/compiler/cpp/generator_unittest.cc | 2 -- src/google/protobuf/port_def.inc | 4 ---- 3 files changed, 8 deletions(-) diff --git a/src/google/protobuf/compiler/cpp/generator.cc b/src/google/protobuf/compiler/cpp/generator.cc index bd9ea7d1fb..cbff8cdaef 100644 --- a/src/google/protobuf/compiler/cpp/generator.cc +++ b/src/google/protobuf/compiler/cpp/generator.cc @@ -376,7 +376,6 @@ absl::Status CppGenerator::ValidateFeatures(const FileDescriptor* file) const { } } -#ifdef PROTOBUF_FUTURE_REMOVE_WRONG_CTYPE if (field.options().has_ctype()) { if (field.cpp_type() != FieldDescriptor::CPPTYPE_STRING) { status = absl::FailedPreconditionError(absl::StrCat( @@ -391,7 +390,6 @@ absl::Status CppGenerator::ValidateFeatures(const FileDescriptor* file) const { } } } -#endif // !PROTOBUF_FUTURE_REMOVE_WRONG_CTYPE }); return status; } diff --git a/src/google/protobuf/compiler/cpp/generator_unittest.cc b/src/google/protobuf/compiler/cpp/generator_unittest.cc index 454b7826e6..b1ee0e3785 100644 --- a/src/google/protobuf/compiler/cpp/generator_unittest.cc +++ b/src/google/protobuf/compiler/cpp/generator_unittest.cc @@ -148,7 +148,6 @@ TEST_F(CppGeneratorTest, LegacyClosedEnumImplicit) { "Field Foo.bar has a closed enum type with implicit presence."); } -#ifdef PROTOBUF_FUTURE_REMOVE_WRONG_CTYPE TEST_F(CppGeneratorTest, CtypeOnNoneStringFieldTest) { CreateTempFile("foo.proto", R"schema( @@ -181,7 +180,6 @@ TEST_F(CppGeneratorTest, CtypeOnExtensionTest) { "Extension bar specifies ctype=CORD which is " "not supported for extensions."); } -#endif // !PROTOBUF_FUTURE_REMOVE_WRONG_CTYPE } // namespace } // namespace cpp } // namespace compiler diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc index ac61dcd59a..a7edd9b6c5 100644 --- a/src/google/protobuf/port_def.inc +++ b/src/google/protobuf/port_def.inc @@ -167,10 +167,6 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3), // Owner: ezb@ #define PROTOBUF_FUTURE_REMOVE_CONST_REPEATEDFIELD_GETARENA_API 1 -// Used to lock down wrong ctype usages in proto file. -// Owner: jieluo@ -#define PROTOBUF_FUTURE_REMOVE_WRONG_CTYPE 1 - #endif // Defines the Protobuf C++ Version for checking version compatibility at