Breaking change: disallow incorrect ctype usage

PiperOrigin-RevId: 597091014
pull/15365/head
Mike Kruskal 1 year ago committed by Copybara-Service
parent 0ce457f6e7
commit 755b690a7c
  1. 2
      src/google/protobuf/compiler/cpp/generator.cc
  2. 2
      src/google/protobuf/compiler/cpp/generator_unittest.cc
  3. 4
      src/google/protobuf/port_def.inc

@ -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;
}

@ -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

@ -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

Loading…
Cancel
Save