Skip to content

Commit

Permalink
Fix build on gcc-11
Browse files Browse the repository at this point in the history
  * Add missing <cstddef>
  * Fix some iterator type
  * Currently use host protobuf to bypass build failure
  • Loading branch information
lileding committed Oct 11, 2022
1 parent d8b4ca9 commit 05ef0d1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions paddle/fluid/memory/allocation/memory_block.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. */
#pragma once

#include <cstddef>
#include <cstdint>
#include <unordered_map>

Expand Down
6 changes: 3 additions & 3 deletions paddle/fluid/pybind/eager_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ PyObject* ToPyObject(const void* value) {
PyObject* ToPyObject(
const std::unordered_map<std::string, std::vector<std::string>>& 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) {
Expand All @@ -773,7 +773,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(
Expand All @@ -800,7 +800,7 @@ PyObject* ToPyObject(

PyObject* ToPyObject(const std::unordered_map<std::wstring, int>& 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());
Expand Down

0 comments on commit 05ef0d1

Please sign in to comment.