From 7a2489e6f3288a0b5b148262d8d1404a7f0af174 Mon Sep 17 00:00:00 2001 From: Wang Xin Date: Wed, 19 Oct 2022 17:02:18 +0800 Subject: [PATCH] fix clang warning of [-Wformat] (#47137) --- .../framework/details/nan_inf_utils_detail.cc | 14 +++++++------- paddle/fluid/operators/math/bloomfilter.h | 3 ++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/paddle/fluid/framework/details/nan_inf_utils_detail.cc b/paddle/fluid/framework/details/nan_inf_utils_detail.cc index bca61ddae69..f80bb94b30b 100644 --- a/paddle/fluid/framework/details/nan_inf_utils_detail.cc +++ b/paddle/fluid/framework/details/nan_inf_utils_detail.cc @@ -157,18 +157,18 @@ static void PrintNanInf(const T* value, } if (count < static_cast(print_num)) { - printf("numel:%lu index:%lu value:%f\n", - static_cast(numel), - static_cast(i), + printf("numel:%zu index:%zu value:%f\n", + numel, + i, static_cast(value[i])); } } printf( - "In cpu, there has %lu,%lu,%lu nan,inf,num. " + "In cpu, there has %zu,%zu,%zu nan,inf,num. " "And in num, min_value is %f, max_value is %f\n", - static_cast(nan_count), - static_cast(inf_count), - static_cast(num_count), + nan_count, + inf_count, + num_count, static_cast(min_value), static_cast(max_value)); if (abort) { diff --git a/paddle/fluid/operators/math/bloomfilter.h b/paddle/fluid/operators/math/bloomfilter.h index 9da9f442e00..ba907b5012b 100644 --- a/paddle/fluid/operators/math/bloomfilter.h +++ b/paddle/fluid/operators/math/bloomfilter.h @@ -20,6 +20,7 @@ limitations under the License. */ #include #include #include +#include namespace paddle { namespace operators { @@ -151,7 +152,7 @@ int bloomfilter_check(struct bloomfilter *filter) { if (filter->magic_num == BLOOMFILTER_MAGIC_NUM_NEW) { return 1; } else { - fprintf(stderr, "error magic_num %ld\n", filter->magic_num); + fprintf(stderr, "error magic_num, %" PRIu64 "\n", filter->magic_num); return 0; } } -- GitLab