From 28ef0fff71f2ebe6547be7275a78e5a0d93c2232 Mon Sep 17 00:00:00 2001 From: Leding Li Date: Tue, 11 Oct 2022 17:54:33 +0800 Subject: [PATCH] Fix build on gcc-11 (#46808) * Add missing * Fix some iterator type * Currently use host protobuf to bypass build failure --- paddle/fluid/memory/allocation/memory_block.h | 1 + paddle/fluid/pybind/eager_utils.cc | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/paddle/fluid/memory/allocation/memory_block.h b/paddle/fluid/memory/allocation/memory_block.h index ee634e272d..1ddf88ce8b 100644 --- a/paddle/fluid/memory/allocation/memory_block.h +++ b/paddle/fluid/memory/allocation/memory_block.h @@ -13,6 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. */ #pragma once +#include #include #include diff --git a/paddle/fluid/pybind/eager_utils.cc b/paddle/fluid/pybind/eager_utils.cc index 4f0b9296db..895a715c8b 100644 --- a/paddle/fluid/pybind/eager_utils.cc +++ b/paddle/fluid/pybind/eager_utils.cc @@ -761,7 +761,7 @@ PyObject* ToPyObject(const void* value) { PyObject* ToPyObject( const std::unordered_map>& value) { PyObject* dict = PyDict_New(); - for (const auto map_iter : value) { + for (const auto& map_iter : value) { // Convert Key PyObject* key_string = PyUnicode_FromString(map_iter.first.c_str()); if (!key_string) { @@ -771,7 +771,7 @@ PyObject* ToPyObject( // Convert Val PyObject* py_list = PyList_New(0); - for (const auto vector_iter : map_iter.second) { + for (const auto& vector_iter : map_iter.second) { PyObject* val_string = PyUnicode_FromString(vector_iter.c_str()); if (!val_string) { PADDLE_THROW(platform::errors::Fatal( @@ -798,7 +798,7 @@ PyObject* ToPyObject( PyObject* ToPyObject(const std::unordered_map& value) { PyObject* dict = PyDict_New(); - for (const auto map_iter : value) { + for (const auto& map_iter : value) { // Convert Key PyObject* key_string = PyUnicode_FromWideChar(map_iter.first.c_str(), map_iter.first.size()); -- GitLab