Skip to content

Commit 755b690

Browse files
mkruskal-googlecopybara-github
authored andcommitted
Breaking change: disallow incorrect ctype usage
PiperOrigin-RevId: 597091014
1 parent 0ce457f commit 755b690

3 files changed

Lines changed: 0 additions & 8 deletions

File tree

src/google/protobuf/compiler/cpp/generator.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,6 @@ absl::Status CppGenerator::ValidateFeatures(const FileDescriptor* file) const {
376376
}
377377
}
378378

379-
#ifdef PROTOBUF_FUTURE_REMOVE_WRONG_CTYPE
380379
if (field.options().has_ctype()) {
381380
if (field.cpp_type() != FieldDescriptor::CPPTYPE_STRING) {
382381
status = absl::FailedPreconditionError(absl::StrCat(
@@ -391,7 +390,6 @@ absl::Status CppGenerator::ValidateFeatures(const FileDescriptor* file) const {
391390
}
392391
}
393392
}
394-
#endif // !PROTOBUF_FUTURE_REMOVE_WRONG_CTYPE
395393
});
396394
return status;
397395
}

src/google/protobuf/compiler/cpp/generator_unittest.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ TEST_F(CppGeneratorTest, LegacyClosedEnumImplicit) {
148148
"Field Foo.bar has a closed enum type with implicit presence.");
149149
}
150150

151-
#ifdef PROTOBUF_FUTURE_REMOVE_WRONG_CTYPE
152151
TEST_F(CppGeneratorTest, CtypeOnNoneStringFieldTest) {
153152
CreateTempFile("foo.proto",
154153
R"schema(
@@ -181,7 +180,6 @@ TEST_F(CppGeneratorTest, CtypeOnExtensionTest) {
181180
"Extension bar specifies ctype=CORD which is "
182181
"not supported for extensions.");
183182
}
184-
#endif // !PROTOBUF_FUTURE_REMOVE_WRONG_CTYPE
185183
} // namespace
186184
} // namespace cpp
187185
} // namespace compiler

src/google/protobuf/port_def.inc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,6 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3),
167167
// Owner: ezb@
168168
#define PROTOBUF_FUTURE_REMOVE_CONST_REPEATEDFIELD_GETARENA_API 1
169169

170-
// Used to lock down wrong ctype usages in proto file.
171-
// Owner: jieluo@
172-
#define PROTOBUF_FUTURE_REMOVE_WRONG_CTYPE 1
173-
174170
#endif
175171

176172
// Defines the Protobuf C++ Version for checking version compatibility at

0 commit comments

Comments
 (0)