Merge pull request #10540 from mkruskal-google/sync-stage

Integrate from Piper for C++, Java, and Python
pull/10541/head
Mike Kruskal 2 years ago committed by GitHub
commit a2fe9065f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      CHANGES.txt
  2. 2
      python/google/protobuf/pyext/descriptor_containers.cc
  3. 2
      python/google/protobuf/pyext/descriptor_database.cc
  4. 3
      python/google/protobuf/pyext/descriptor_database.h
  5. 3
      python/google/protobuf/pyext/descriptor_pool.cc
  6. 1
      python/google/protobuf/pyext/extension_dict.cc
  7. 1
      python/google/protobuf/pyext/map_container.cc
  8. 1
      python/google/protobuf/pyext/message.cc
  9. 1
      python/google/protobuf/pyext/message_factory.cc
  10. 1
      python/google/protobuf/pyext/repeated_scalar_container.cc
  11. 2
      src/google/protobuf/compiler/cpp/helpers.h
  12. 8
      src/google/protobuf/io/printer.cc
  13. 7
      src/google/protobuf/port_def.inc
  14. 7
      src/google/protobuf/port_undef.inc
  15. 1
      src/google/protobuf/text_format.cc

@ -20,6 +20,8 @@
* Avoid inlining some large heavily duplicated routines in repeated_ptr_field.h * Avoid inlining some large heavily duplicated routines in repeated_ptr_field.h
* Add ReflectiveProtoHook to Reflection. * Add ReflectiveProtoHook to Reflection.
* Turns on table-driven parser for reflection based objects. * Turns on table-driven parser for reflection based objects.
* Save code space by avoiding inlining of large-in-aggregate code-space MessageLite::~MessageLite destructor.
* Undefine the macro `linux` when compiling protobuf
Kotlin Kotlin

@ -54,6 +54,8 @@
// This inclusion must appear before all the others. // This inclusion must appear before all the others.
#include <Python.h> #include <Python.h>
#include <string>
#include "google/protobuf/pyext/descriptor_containers.h" #include "google/protobuf/pyext/descriptor_containers.h"
// clang-format on // clang-format on

@ -34,6 +34,8 @@
#include "google/protobuf/pyext/descriptor_database.h" #include "google/protobuf/pyext/descriptor_database.h"
#include <cstdint> #include <cstdint>
#include <string>
#include <vector>
#include "google/protobuf/stubs/logging.h" #include "google/protobuf/stubs/logging.h"
#include "google/protobuf/stubs/common.h" #include "google/protobuf/stubs/common.h"

@ -34,6 +34,9 @@
#define PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN
#include <Python.h> #include <Python.h>
#include <string>
#include <vector>
#include "google/protobuf/descriptor_database.h" #include "google/protobuf/descriptor_database.h"
namespace google { namespace google {

@ -30,7 +30,10 @@
// Implements the DescriptorPool, which collects all descriptors. // Implements the DescriptorPool, which collects all descriptors.
#include <string>
#include <unordered_map> #include <unordered_map>
#include <utility>
#include <vector>
#define PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN
#include <Python.h> #include <Python.h>

@ -35,6 +35,7 @@
#include <cstdint> #include <cstdint>
#include <memory> #include <memory>
#include <vector>
#include "google/protobuf/stubs/logging.h" #include "google/protobuf/stubs/logging.h"
#include "google/protobuf/stubs/common.h" #include "google/protobuf/stubs/common.h"

@ -34,6 +34,7 @@
#include <cstdint> #include <cstdint>
#include <memory> #include <memory>
#include <string>
#include "google/protobuf/stubs/logging.h" #include "google/protobuf/stubs/logging.h"
#include "google/protobuf/stubs/common.h" #include "google/protobuf/stubs/common.h"

@ -38,6 +38,7 @@
#include <cstdint> #include <cstdint>
#include <map> #include <map>
#include <memory> #include <memory>
#include <set>
#include <string> #include <string>
#include <vector> #include <vector>

@ -29,6 +29,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <unordered_map> #include <unordered_map>
#include <utility>
#define PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN
#include <Python.h> #include <Python.h>

@ -35,6 +35,7 @@
#include <cstdint> #include <cstdint>
#include <memory> #include <memory>
#include <string>
#include "google/protobuf/stubs/common.h" #include "google/protobuf/stubs/common.h"
#include "google/protobuf/stubs/logging.h" #include "google/protobuf/stubs/logging.h"

@ -220,7 +220,7 @@ inline const Descriptor* FieldScope(const FieldDescriptor* field) {
std::string FieldMessageTypeName(const FieldDescriptor* field, std::string FieldMessageTypeName(const FieldDescriptor* field,
const Options& options); const Options& options);
// Get the C++ type name for a primitive type (e.g. "double", "::google::protobuf::int32", etc.). // Get the C++ type name for a primitive type (e.g. "double", "::int32", etc.).
const char* PrimitiveTypeName(FieldDescriptor::CppType type); const char* PrimitiveTypeName(FieldDescriptor::CppType type);
std::string PrimitiveTypeName(const Options& options, std::string PrimitiveTypeName(const Options& options,
FieldDescriptor::CppType type); FieldDescriptor::CppType type);

@ -169,7 +169,13 @@ void Printer::Emit(
absl::flat_hash_map<absl::string_view, absl::flat_hash_map<absl::string_view,
absl::variant<std::string, std::function<void()>>> absl::variant<std::string, std::function<void()>>>
map = vars; map;
map.reserve(vars.size());
for (auto& var : vars) {
auto result = map.insert(var);
GOOGLE_CHECK(result.second) << "repeated variable in Emit() call: \"" << var.first
<< "\"";
}
var_lookups_.emplace_back([&map](absl::string_view var) -> LookupResult { var_lookups_.emplace_back([&map](absl::string_view var) -> LookupResult {
auto it = map.find(var); auto it = map.find(var);

@ -875,6 +875,13 @@
#undef PACKAGE #undef PACKAGE
#endif #endif
// linux is a legacy MACRO defined in most popular C++ standards.
#ifdef linux
#pragma push_macro("linux")
#undef linux
#define PROTOBUF_DID_UNDEF_LINUX
#endif
// Windows declares several inconvenient macro names. We #undef them and then // Windows declares several inconvenient macro names. We #undef them and then
// restore them in port_undef.inc. // restore them in port_undef.inc.
#ifdef _WIN32 #ifdef _WIN32

@ -121,12 +121,17 @@
#undef PROTOBUF_FUTURE_FINAL #undef PROTOBUF_FUTURE_FINAL
// Restore macros that may have been #undef'd in port_def.inc.
#ifdef PROTOBUF_DID_UNDEF_PACKAGE #ifdef PROTOBUF_DID_UNDEF_PACKAGE
#pragma pop_macro("PACKAGE") #pragma pop_macro("PACKAGE")
#undef PROTOBUF_DID_UNDEF_PACKAGE #undef PROTOBUF_DID_UNDEF_PACKAGE
#endif #endif
// Restore macro that may have been #undef'd in port_def.inc. #ifdef PROTOBUF_DID_UNDEF_LINUX
#pragma pop_macro("linux")
#endif
#ifdef _WIN32 #ifdef _WIN32
#pragma pop_macro("CREATE_NEW") #pragma pop_macro("CREATE_NEW")
#pragma pop_macro("DELETE") #pragma pop_macro("DELETE")

@ -53,6 +53,7 @@
#include "google/protobuf/stubs/strutil.h" #include "google/protobuf/stubs/strutil.h"
#include "absl/strings/ascii.h" #include "absl/strings/ascii.h"
#include "absl/strings/escaping.h" #include "absl/strings/escaping.h"
#include "absl/strings/numbers.h"
#include "absl/strings/str_cat.h" #include "absl/strings/str_cat.h"
#include "absl/strings/str_join.h" #include "absl/strings/str_join.h"
#include "absl/strings/string_view.h" #include "absl/strings/string_view.h"

Loading…
Cancel
Save