Merge tag 'refs/tags/sync-piper' into sync-stage

pull/10540/head
Mike Kruskal 2 years ago
commit b8b06a62c6
  1. 2
      python/google/protobuf/pyext/descriptor_containers.cc
  2. 2
      python/google/protobuf/pyext/descriptor_database.cc
  3. 3
      python/google/protobuf/pyext/descriptor_database.h
  4. 3
      python/google/protobuf/pyext/descriptor_pool.cc
  5. 1
      python/google/protobuf/pyext/extension_dict.cc
  6. 1
      python/google/protobuf/pyext/map_container.cc
  7. 1
      python/google/protobuf/pyext/message.cc
  8. 1
      python/google/protobuf/pyext/message_factory.cc
  9. 1
      python/google/protobuf/pyext/repeated_scalar_container.cc
  10. 2
      src/google/protobuf/compiler/cpp/helpers.h
  11. 8
      src/google/protobuf/io/printer.cc
  12. 7
      src/google/protobuf/port_def.inc
  13. 7
      src/google/protobuf/port_undef.inc
  14. 1
      src/google/protobuf/text_format.cc

@ -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