From 7bd4744da61bee1cce186747c67125c9b473589d Mon Sep 17 00:00:00 2001 From: Mike Kruskal Date: Wed, 27 Sep 2023 15:32:00 -0700 Subject: [PATCH] Remove enforce_utf8 from edition zero test cases. PiperOrigin-RevId: 568978635 --- .../protobuf/editions/codegen_tests/BUILD | 6 ----- .../codegen_tests/proto3_utf8_disabled.proto | 15 ----------- .../golden/editions_transform_proto2.proto | 9 +++---- .../editions_transform_proto2_lite.proto | 2 -- ...tions_transform_proto2_utf8_disabled.proto | 2 -- .../golden/editions_transform_proto3.proto | 4 --- ...tions_transform_proto3_utf8_disabled.proto | 2 -- .../proto/editions_transform_proto2.proto | 27 +++++++------------ .../editions_transform_proto2_lite.proto | 2 -- ...tions_transform_proto2_utf8_disabled.proto | 2 -- .../proto/editions_transform_proto3.proto | 4 --- ...tions_transform_proto3_utf8_disabled.proto | 2 -- src/google/protobuf/editions/transform.awk | 3 --- 13 files changed, 14 insertions(+), 66 deletions(-) delete mode 100644 src/google/protobuf/editions/codegen_tests/proto3_utf8_disabled.proto diff --git a/src/google/protobuf/editions/codegen_tests/BUILD b/src/google/protobuf/editions/codegen_tests/BUILD index f3ab7544fc..f2853fe42d 100644 --- a/src/google/protobuf/editions/codegen_tests/BUILD +++ b/src/google/protobuf/editions/codegen_tests/BUILD @@ -79,12 +79,6 @@ proto_library( strip_import_prefix = "/src", ) -proto_library( - name = "proto3_utf8_disabled_proto", - srcs = ["proto3_utf8_disabled.proto"], - strip_import_prefix = "/src", -) - proto_library( name = "proto2_import_proto", srcs = ["proto2_import.proto"], diff --git a/src/google/protobuf/editions/codegen_tests/proto3_utf8_disabled.proto b/src/google/protobuf/editions/codegen_tests/proto3_utf8_disabled.proto deleted file mode 100644 index 0e7b3f19ab..0000000000 --- a/src/google/protobuf/editions/codegen_tests/proto3_utf8_disabled.proto +++ /dev/null @@ -1,15 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2023 Google Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file or at -// https://developers.google.com/open-source/licenses/bsd - -syntax = "proto3"; - -package protobuf_editions_test.proto3; - -message Proto3Utf8Disabled { - string string_field = 1; - map map_field = 10; -} diff --git a/src/google/protobuf/editions/golden/editions_transform_proto2.proto b/src/google/protobuf/editions/golden/editions_transform_proto2.proto index 831bd07594..193b7e06d3 100644 --- a/src/google/protobuf/editions/golden/editions_transform_proto2.proto +++ b/src/google/protobuf/editions/golden/editions_transform_proto2.proto @@ -59,11 +59,6 @@ extend ParentMessage.ExtendedMessage { message TestMessage { string string_field = 1; - string string_field_utf = 2; - string string_field_noutf = 3; - string options_strip_beginning = 4 [ ctype = STRING_PIECE, default = "hello world abcd" ]; - string options_strip_middle = 5 [ ctype = STRING_PIECE, default = "hello world abcd" ]; - string options_strip_end = 6 [ ctype = STRING_PIECE, default = "hello world abcd" ]; map string_map_field = 7; @@ -71,6 +66,10 @@ message TestMessage { repeated int32 int_field_packed = 9 [features.repeated_field_encoding = PACKED]; repeated int32 int_field_unpacked = 10; + repeated int32 options_strip_beginning = 4 [ /* inline comment*/ debug_redact = true, deprecated = false ]; + repeated int32 options_strip_middle = 5 [debug_redact = true, deprecated = false]; + repeated int32 options_strip_end = 6 [debug_redact = true, deprecated = false]; + message OptionalGroup { int32 a = 17; } diff --git a/src/google/protobuf/editions/golden/editions_transform_proto2_lite.proto b/src/google/protobuf/editions/golden/editions_transform_proto2_lite.proto index ee471d54c0..df5a49d01c 100644 --- a/src/google/protobuf/editions/golden/editions_transform_proto2_lite.proto +++ b/src/google/protobuf/editions/golden/editions_transform_proto2_lite.proto @@ -19,8 +19,6 @@ option optimize_for = LITE_RUNTIME; message TestMessageLite { string string_field = 1; - string string_field_utf = 2; - string string_field_noutf = 3; map string_map_field = 4; diff --git a/src/google/protobuf/editions/golden/editions_transform_proto2_utf8_disabled.proto b/src/google/protobuf/editions/golden/editions_transform_proto2_utf8_disabled.proto index dc1fc4d35c..810810390e 100644 --- a/src/google/protobuf/editions/golden/editions_transform_proto2_utf8_disabled.proto +++ b/src/google/protobuf/editions/golden/editions_transform_proto2_utf8_disabled.proto @@ -18,8 +18,6 @@ package protobuf_editions_test; message TestMessageUtf8Disabled { string string_field = 1; - string string_field_utf = 2; - string string_field_noutf = 3; map string_map_field = 4; diff --git a/src/google/protobuf/editions/golden/editions_transform_proto3.proto b/src/google/protobuf/editions/golden/editions_transform_proto3.proto index 6ee1c8040b..454f7d1504 100644 --- a/src/google/protobuf/editions/golden/editions_transform_proto3.proto +++ b/src/google/protobuf/editions/golden/editions_transform_proto3.proto @@ -12,12 +12,8 @@ package protobuf_editions_test; message TestMessageProto3 { string string_field = 1; - string string_field_utf = 2; - string string_field_noutf = 3 [features.utf8_validation = UNVERIFIED]; map string_map_field = 4; - map string_map_field_utf = 5; - map string_map_field_noutf = 6 [features.utf8_validation = UNVERIFIED]; repeated int32 int_field = 7; repeated int32 int_field_packed = 8; diff --git a/src/google/protobuf/editions/golden/editions_transform_proto3_utf8_disabled.proto b/src/google/protobuf/editions/golden/editions_transform_proto3_utf8_disabled.proto index 0abf58a54c..26ba294f08 100644 --- a/src/google/protobuf/editions/golden/editions_transform_proto3_utf8_disabled.proto +++ b/src/google/protobuf/editions/golden/editions_transform_proto3_utf8_disabled.proto @@ -13,8 +13,6 @@ package protobuf_editions_test; message TestMessageProto3 { string string_field = 1; - string string_field_utf = 2; - string string_field_noutf = 3 [features.utf8_validation = UNVERIFIED]; map string_map_field = 4; diff --git a/src/google/protobuf/editions/proto/editions_transform_proto2.proto b/src/google/protobuf/editions/proto/editions_transform_proto2.proto index 604387c88f..a10fdebf41 100644 --- a/src/google/protobuf/editions/proto/editions_transform_proto2.proto +++ b/src/google/protobuf/editions/proto/editions_transform_proto2.proto @@ -54,23 +54,6 @@ extend ParentMessage.ExtendedMessage { message TestMessage { optional string string_field = 1; - optional string string_field_utf = 2; - optional string string_field_noutf = 3; - optional string options_strip_beginning = 4 [ - enforce_utf8 = false, - ctype = STRING_PIECE, - default = "hello world abcd" - ]; - optional string options_strip_middle = 5 [ - ctype = STRING_PIECE, - enforce_utf8 = false, - default = "hello world abcd" - ]; - optional string options_strip_end = 6 [ - ctype = STRING_PIECE, - default = "hello world abcd", - enforce_utf8 = false - ]; map string_map_field = 7; @@ -78,6 +61,16 @@ message TestMessage { repeated int32 int_field_packed = 9 [packed = true]; repeated int32 int_field_unpacked = 10 [packed = false]; + repeated int32 options_strip_beginning = 4 [ + packed = false, + /* inline comment*/ debug_redact = true, + deprecated = false + ]; + repeated int32 options_strip_middle = 5 + [debug_redact = true, packed = false, deprecated = false]; + repeated int32 options_strip_end = 6 + [debug_redact = true, deprecated = false, packed = false]; + optional group OptionalGroup = 16 { optional int32 a = 17; } diff --git a/src/google/protobuf/editions/proto/editions_transform_proto2_lite.proto b/src/google/protobuf/editions/proto/editions_transform_proto2_lite.proto index 1c09fa0a7c..19b808a258 100644 --- a/src/google/protobuf/editions/proto/editions_transform_proto2_lite.proto +++ b/src/google/protobuf/editions/proto/editions_transform_proto2_lite.proto @@ -13,8 +13,6 @@ option optimize_for = LITE_RUNTIME; message TestMessageLite { optional string string_field = 1; - optional string string_field_utf = 2; - optional string string_field_noutf = 3; map string_map_field = 4; diff --git a/src/google/protobuf/editions/proto/editions_transform_proto2_utf8_disabled.proto b/src/google/protobuf/editions/proto/editions_transform_proto2_utf8_disabled.proto index 8d0ca6fefe..985f863f69 100644 --- a/src/google/protobuf/editions/proto/editions_transform_proto2_utf8_disabled.proto +++ b/src/google/protobuf/editions/proto/editions_transform_proto2_utf8_disabled.proto @@ -12,8 +12,6 @@ package protobuf_editions_test; message TestMessageUtf8Disabled { optional string string_field = 1; - optional string string_field_utf = 2; - optional string string_field_noutf = 3; map string_map_field = 4; diff --git a/src/google/protobuf/editions/proto/editions_transform_proto3.proto b/src/google/protobuf/editions/proto/editions_transform_proto3.proto index e0fbb1255c..0c9ec4f00d 100644 --- a/src/google/protobuf/editions/proto/editions_transform_proto3.proto +++ b/src/google/protobuf/editions/proto/editions_transform_proto3.proto @@ -11,12 +11,8 @@ package protobuf_editions_test; message TestMessageProto3 { string string_field = 1; - string string_field_utf = 2; - string string_field_noutf = 3; map string_map_field = 4; - map string_map_field_utf = 5; - map string_map_field_noutf = 6; repeated int32 int_field = 7; repeated int32 int_field_packed = 8 [packed = true]; diff --git a/src/google/protobuf/editions/proto/editions_transform_proto3_utf8_disabled.proto b/src/google/protobuf/editions/proto/editions_transform_proto3_utf8_disabled.proto index a667b2a886..b7d2b6980e 100644 --- a/src/google/protobuf/editions/proto/editions_transform_proto3_utf8_disabled.proto +++ b/src/google/protobuf/editions/proto/editions_transform_proto3_utf8_disabled.proto @@ -12,8 +12,6 @@ package protobuf_editions_test; message TestMessageProto3 { string string_field = 1; - string string_field_utf = 2; - string string_field_noutf = 3; map string_map_field = 4; diff --git a/src/google/protobuf/editions/transform.awk b/src/google/protobuf/editions/transform.awk index 3ffc715040..945ac98c1d 100644 --- a/src/google/protobuf/editions/transform.awk +++ b/src/google/protobuf/editions/transform.awk @@ -72,7 +72,6 @@ function transform_field(field) sub(/\/, "features.repeated_field_encoding = PACKED", existing_options) existing_options = strip_option("packed = false", existing_options) - existing_options = strip_option("enforce_utf8 = (true|false)", existing_options) if (match(field_def, /^\s*required\>/)) { sub(/\/, "features.utf8_validation = UNVERIFIED", existing_options) sub(/\/, "features.repeated_field_encoding = EXPANDED", existing_options) existing_options = strip_option("packed = true", existing_options) - existing_options = strip_option("enforce_utf8 = (true|false)", existing_options) if (match($0, /\/)) { sub(/\