Skip to content

Commit 4f49062

Browse files
authored
Merge pull request protocolbuffers#8885 from TeBoring/sync-stage
Integrate from Piper for C++, Java, and Python
2 parents 9675b28 + 24a5504 commit 4f49062

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+2893
-2532
lines changed

BUILD

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ cc_library(
189189
"src/google/protobuf/dynamic_message.cc",
190190
"src/google/protobuf/empty.pb.cc",
191191
"src/google/protobuf/extension_set_heavy.cc",
192-
"src/google/protobuf/field_access_listener.cc",
193192
"src/google/protobuf/field_mask.pb.cc",
193+
"src/google/protobuf/generated_message_bases.cc",
194194
"src/google/protobuf/generated_message_reflection.cc",
195195
"src/google/protobuf/generated_message_table_driven.cc",
196196
"src/google/protobuf/io/gzip_stream.cc",
@@ -667,6 +667,7 @@ cc_test(
667667
"src/google/protobuf/arena_unittest.cc",
668668
"src/google/protobuf/arenastring_unittest.cc",
669669
"src/google/protobuf/compiler/annotation_test_util.cc",
670+
"src/google/protobuf/compiler/command_line_interface_unittest.cc",
670671
"src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc",
671672
"src/google/protobuf/compiler/cpp/cpp_move_unittest.cc",
672673
"src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc",
@@ -741,7 +742,6 @@ cc_test(
741742
] + select({
742743
"//conditions:default": [
743744
# AUTOGEN(non_msvc_test_srcs)
744-
"src/google/protobuf/compiler/command_line_interface_unittest.cc",
745745
],
746746
":msvc": [],
747747
}),

cmake/conformance.cmake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,22 @@ add_custom_command(
1919
)
2020

2121
add_executable(conformance_test_runner
22-
${protobuf_source_dir}/conformance/conformance.pb.cc
23-
${protobuf_source_dir}/conformance/conformance_test.cc
2422
${protobuf_source_dir}/conformance/binary_json_conformance_suite.cc
2523
${protobuf_source_dir}/conformance/binary_json_conformance_suite.h
24+
${protobuf_source_dir}/conformance/conformance.pb.cc
25+
${protobuf_source_dir}/conformance/conformance_test.cc
2626
${protobuf_source_dir}/conformance/conformance_test_runner.cc
2727
${protobuf_source_dir}/conformance/third_party/jsoncpp/json.h
2828
${protobuf_source_dir}/conformance/third_party/jsoncpp/jsoncpp.cpp
29-
${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.pb.cc
3029
${protobuf_source_dir}/src/google/protobuf/test_messages_proto2.pb.cc
30+
${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.pb.cc
3131
)
3232

3333
add_executable(conformance_cpp
3434
${protobuf_source_dir}/conformance/conformance.pb.cc
3535
${protobuf_source_dir}/conformance/conformance_cpp.cc
36-
${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.pb.cc
3736
${protobuf_source_dir}/src/google/protobuf/test_messages_proto2.pb.cc
37+
${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.pb.cc
3838
)
3939

4040
target_include_directories(

cmake/extract_includes.bat.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\field_access_listener
5050
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\field_mask.pb.h" include\google\protobuf\field_mask.pb.h
5151
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_enum_reflection.h" include\google\protobuf\generated_enum_reflection.h
5252
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_enum_util.h" include\google\protobuf\generated_enum_util.h
53+
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_bases.h" include\google\protobuf\generated_message_bases.h
5354
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_reflection.h" include\google\protobuf\generated_message_reflection.h
5455
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_table_driven.h" include\google\protobuf\generated_message_table_driven.h
5556
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_tctable_decl.h" include\google\protobuf\generated_message_tctable_decl.h

cmake/libprotobuf-lite.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ set(libprotobuf_lite_includes
3737
${protobuf_source_dir}/src/google/protobuf/extension_set.h
3838
${protobuf_source_dir}/src/google/protobuf/generated_message_util.h
3939
${protobuf_source_dir}/src/google/protobuf/implicit_weak_message.h
40-
${protobuf_source_dir}/src/google/protobuf/parse_context.h
4140
${protobuf_source_dir}/src/google/protobuf/io/coded_stream.h
4241
${protobuf_source_dir}/src/google/protobuf/io/strtod.h
4342
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream.h
4443
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl.h
4544
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl_lite.h
4645
${protobuf_source_dir}/src/google/protobuf/message_lite.h
46+
${protobuf_source_dir}/src/google/protobuf/parse_context.h
4747
${protobuf_source_dir}/src/google/protobuf/repeated_field.h
4848
${protobuf_source_dir}/src/google/protobuf/stubs/bytestream.h
4949
${protobuf_source_dir}/src/google/protobuf/stubs/common.h

cmake/libprotobuf.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ set(libprotobuf_files
1111
${protobuf_source_dir}/src/google/protobuf/dynamic_message.cc
1212
${protobuf_source_dir}/src/google/protobuf/empty.pb.cc
1313
${protobuf_source_dir}/src/google/protobuf/extension_set_heavy.cc
14-
${protobuf_source_dir}/src/google/protobuf/field_access_listener.cc
1514
${protobuf_source_dir}/src/google/protobuf/field_mask.pb.cc
15+
${protobuf_source_dir}/src/google/protobuf/generated_message_bases.cc
1616
${protobuf_source_dir}/src/google/protobuf/generated_message_reflection.cc
1717
${protobuf_source_dir}/src/google/protobuf/generated_message_table_driven.cc
1818
${protobuf_source_dir}/src/google/protobuf/io/gzip_stream.cc
@@ -68,6 +68,7 @@ set(libprotobuf_includes
6868
${protobuf_source_dir}/src/google/protobuf/empty.pb.h
6969
${protobuf_source_dir}/src/google/protobuf/field_access_listener.h
7070
${protobuf_source_dir}/src/google/protobuf/field_mask.pb.h
71+
${protobuf_source_dir}/src/google/protobuf/generated_message_bases.h
7172
${protobuf_source_dir}/src/google/protobuf/generated_message_reflection.h
7273
${protobuf_source_dir}/src/google/protobuf/io/gzip_stream.h
7374
${protobuf_source_dir}/src/google/protobuf/io/printer.h

cmake/tests.cmake

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ set(tests_files
132132
${protobuf_source_dir}/src/google/protobuf/arena_unittest.cc
133133
${protobuf_source_dir}/src/google/protobuf/arenastring_unittest.cc
134134
${protobuf_source_dir}/src/google/protobuf/compiler/annotation_test_util.cc
135+
${protobuf_source_dir}/src/google/protobuf/compiler/command_line_interface_unittest.cc
135136
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc
136137
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_move_unittest.cc
137138
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc
@@ -205,21 +206,12 @@ set(tests_files
205206
${protobuf_source_dir}/src/google/protobuf/wire_format_unittest.inc
206207
)
207208

208-
set(non_msvc_tests_files
209-
${protobuf_source_dir}/src/google/protobuf/compiler/command_line_interface_unittest.cc
210-
)
211-
212-
set(all_tests_files
213-
${tests_files}
214-
${non_msvc_tests_files}
215-
)
216-
217209
if(protobuf_ABSOLUTE_TEST_PLUGIN_PATH)
218210
add_compile_options(-DGOOGLE_PROTOBUF_TEST_PLUGIN_PATH="$<TARGET_FILE:test_plugin>")
219211
endif()
220212

221213
if(MINGW)
222-
set_source_files_properties(${all_tests_files} PROPERTIES COMPILE_FLAGS "-Wno-narrowing")
214+
set_source_files_properties(${tests_files} PROPERTIES COMPILE_FLAGS "-Wno-narrowing")
223215

224216
# required for tests on MinGW Win64
225217
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
@@ -229,14 +221,14 @@ if(MINGW)
229221

230222
endif()
231223

232-
add_executable(tests ${all_tests_files} ${common_test_files} ${tests_proto_files} ${lite_test_proto_files})
224+
add_executable(tests ${tests_files} ${common_test_files} ${tests_proto_files} ${lite_test_proto_files})
233225
target_link_libraries(tests libprotoc libprotobuf gmock_main)
234226

235227
set(test_plugin_files
236228
${protobuf_source_dir}/src/google/protobuf/compiler/mock_code_generator.cc
229+
${protobuf_source_dir}/src/google/protobuf/compiler/test_plugin.cc
237230
${protobuf_source_dir}/src/google/protobuf/testing/file.cc
238231
${protobuf_source_dir}/src/google/protobuf/testing/file.h
239-
${protobuf_source_dir}/src/google/protobuf/compiler/test_plugin.cc
240232
)
241233

242234
add_executable(test_plugin ${test_plugin_files})

java/core/src/main/java/com/google/protobuf/FieldSet.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -832,8 +832,6 @@ static int computeElementSize(
832832
*/
833833
static int computeElementSizeNoTag(final WireFormat.FieldType type, final Object value) {
834834
switch (type) {
835-
// Note: Minor violation of 80-char limit rule here because this would
836-
// actually be harder to read if we wrapped the lines.
837835
case DOUBLE:
838836
return CodedOutputStream.computeDoubleSizeNoTag((Double) value);
839837
case FLOAT:

python/google/protobuf/pyext/descriptor.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -913,8 +913,9 @@ static int SetContainingType(PyBaseDescriptor *self, PyObject *value,
913913
}
914914

915915
static PyObject* GetExtensionScope(PyBaseDescriptor *self, void *closure) {
916+
const auto* desc = _GetDescriptor(self);
916917
const Descriptor* extension_scope =
917-
_GetDescriptor(self)->extension_scope();
918+
desc->is_extension() ? desc->extension_scope() : nullptr;
918919
if (extension_scope) {
919920
return PyMessageDescriptor_FromDescriptor(extension_scope);
920921
} else {

0 commit comments

Comments
 (0)