From cfcad92f8bf06c973e9a18c4479e806a6e65d9cd Mon Sep 17 00:00:00 2001 From: greatx Date: Mon, 24 Oct 2022 21:33:19 +0800 Subject: [PATCH] fix braced-scalar-init warnings on macos --- cmake/flags.cmake | 5 +++-- paddle/fluid/eager/tests/task_tests/eager_utils_test.cc | 2 +- paddle/fluid/imperative/prepared_operator.h | 4 ++-- paddle/phi/ops/compat/concat_sig.cc | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/cmake/flags.cmake b/cmake/flags.cmake index 2ec63282ee1e4..010cb6e08ee7d 100644 --- a/cmake/flags.cmake +++ b/cmake/flags.cmake @@ -214,8 +214,9 @@ if(APPLE) CACHE STRING "Build architectures for OSX" FORCE) endif() # On Mac OS X register class specifier is deprecated and will cause warning error on latest clang 10.0 - set(COMMON_FLAGS -Wno-deprecated-register -Werror=format - -Werror=inconsistent-missing-override) + set(COMMON_FLAGS + -Wno-deprecated-register -Werror=format + -Werror=inconsistent-missing-override -Werror=braced-scalar-init) endif() if(WITH_HETERPS AND WITH_PSLIB) diff --git a/paddle/fluid/eager/tests/task_tests/eager_utils_test.cc b/paddle/fluid/eager/tests/task_tests/eager_utils_test.cc index bc4e9b1d8f3ab..86b34a6b17de2 100644 --- a/paddle/fluid/eager/tests/task_tests/eager_utils_test.cc +++ b/paddle/fluid/eager/tests/task_tests/eager_utils_test.cc @@ -82,7 +82,7 @@ TEST(EagerUtils, AutoGradMeta) { CHECK_NOTNULL(grad_node0.get()); EagerUtils::SetHistory(autograd_meta1, test_node); - EagerUtils::SetHistory({autograd_meta1}, test_node); + EagerUtils::SetHistory(autograd_meta1, test_node); std::shared_ptr grad_node1 = EagerUtils::grad_node(et1); CHECK_NOTNULL(grad_node1.get()); diff --git a/paddle/fluid/imperative/prepared_operator.h b/paddle/fluid/imperative/prepared_operator.h index dfa18814de958..a3d90939faeae 100644 --- a/paddle/fluid/imperative/prepared_operator.h +++ b/paddle/fluid/imperative/prepared_operator.h @@ -347,7 +347,7 @@ void BuildDygraphPhiKernelContext(const phi::KernelSignature& kernel_signature, auto iter = outs.find(output_names[i]); if (iter == outs.end()) { - kernel_ctx->EmplaceBackOutputWithoutSetRange({nullptr}); + kernel_ctx->EmplaceBackOutputWithoutSetRange(nullptr); kernel_ctx->AssignOutputRange(std::make_pair(start_idx, start_idx + 1), i); continue; @@ -358,7 +358,7 @@ void BuildDygraphPhiKernelContext(const phi::KernelSignature& kernel_signature, for (size_t offset = 0; offset < outs_vector.size(); ++offset) { if (outs_vector[offset] == nullptr) { - kernel_ctx->EmplaceBackOutputWithoutSetRange({nullptr}); + kernel_ctx->EmplaceBackOutputWithoutSetRange(nullptr); continue; } diff --git a/paddle/phi/ops/compat/concat_sig.cc b/paddle/phi/ops/compat/concat_sig.cc index d53bb5793bc3a..c5e6a4b020089 100644 --- a/paddle/phi/ops/compat/concat_sig.cc +++ b/paddle/phi/ops/compat/concat_sig.cc @@ -26,10 +26,10 @@ KernelSignature ConcatOpArgumentMapping(const ArgumentMappingContext& ctx) { KernelSignature ConcatGradOpArgumentMapping(const ArgumentMappingContext& ctx) { if (ctx.HasInput("AxisTensor")) { return KernelSignature( - "concat_grad", {"X", {"Out@GRAD"}}, {"AxisTensor"}, {{"X@GRAD"}}); + "concat_grad", {"X", "Out@GRAD"}, {"AxisTensor"}, {"X@GRAD"}); } return KernelSignature( - "concat_grad", {"X", {"Out@GRAD"}}, {"axis"}, {{"X@GRAD"}}); + "concat_grad", {"X", "Out@GRAD"}, {"axis"}, {"X@GRAD"}); } } // namespace phi