Skip to content

Commit

Permalink
Breaking change: disallow incorrect ctype usage
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 597091014
  • Loading branch information
mkruskal-google authored and Copybara-Service committed Jan 10, 2024
1 parent 0ce457f commit 755b690
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 8 deletions.
2 changes: 0 additions & 2 deletions src/google/protobuf/compiler/cpp/generator.cc
Expand Up @@ -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(
Expand All @@ -391,7 +390,6 @@ absl::Status CppGenerator::ValidateFeatures(const FileDescriptor* file) const {
}
}
}
#endif // !PROTOBUF_FUTURE_REMOVE_WRONG_CTYPE
});
return status;
}
Expand Down
2 changes: 0 additions & 2 deletions src/google/protobuf/compiler/cpp/generator_unittest.cc
Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions src/google/protobuf/port_def.inc
Expand Up @@ -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
Expand Down

0 comments on commit 755b690

Please sign in to comment.