未验证 提交 7a2489e6 编写于 作者: W Wang Xin 提交者: GitHub

fix clang warning of [-Wformat] (#47137)

上级 6f7e768c
...@@ -157,18 +157,18 @@ static void PrintNanInf(const T* value, ...@@ -157,18 +157,18 @@ static void PrintNanInf(const T* value,
} }
if (count < static_cast<size_t>(print_num)) { if (count < static_cast<size_t>(print_num)) {
printf("numel:%lu index:%lu value:%f\n", printf("numel:%zu index:%zu value:%f\n",
static_cast<uint64_t>(numel), numel,
static_cast<uint64_t>(i), i,
static_cast<float>(value[i])); static_cast<float>(value[i]));
} }
} }
printf( 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", "And in num, min_value is %f, max_value is %f\n",
static_cast<uint64_t>(nan_count), nan_count,
static_cast<uint64_t>(inf_count), inf_count,
static_cast<uint64_t>(num_count), num_count,
static_cast<double>(min_value), static_cast<double>(min_value),
static_cast<double>(max_value)); static_cast<double>(max_value));
if (abort) { if (abort) {
......
...@@ -20,6 +20,7 @@ limitations under the License. */ ...@@ -20,6 +20,7 @@ limitations under the License. */
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <cinttypes>
namespace paddle { namespace paddle {
namespace operators { namespace operators {
...@@ -151,7 +152,7 @@ int bloomfilter_check(struct bloomfilter *filter) { ...@@ -151,7 +152,7 @@ int bloomfilter_check(struct bloomfilter *filter) {
if (filter->magic_num == BLOOMFILTER_MAGIC_NUM_NEW) { if (filter->magic_num == BLOOMFILTER_MAGIC_NUM_NEW) {
return 1; return 1;
} else { } else {
fprintf(stderr, "error magic_num %ld\n", filter->magic_num); fprintf(stderr, "error magic_num, %" PRIu64 "\n", filter->magic_num);
return 0; return 0;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册