From 7c04096ecbeb3f7846fa2b9b5724706be7fb54a9 Mon Sep 17 00:00:00 2001 From: Yu Yang Date: Fri, 3 Feb 2017 10:32:58 +0800 Subject: [PATCH] Remove compile warning on clang 8.0 in BufferArg.h * CHECK_XX in glog need the left and right values are both signed or unsigned integer. So we could use integer literal syntax in C/C++ to make literal unsigned or signed. Add suffix 'UL' means unsigned long. --- paddle/function/BufferArg.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/paddle/function/BufferArg.h b/paddle/function/BufferArg.h index 177d20005b5..349b21e7e64 100644 --- a/paddle/function/BufferArg.h +++ b/paddle/function/BufferArg.h @@ -189,8 +189,8 @@ public: SequenceIdArg(const TensorShape& shape, ArgType argType = UNSPECIFIED) : BufferArg(VALUE_TYPE_INT32, shape, argType) { bufferType_ = TENSOR_SEQUENCE_ID; - CHECK_EQ(shape_.ndims(), (size_t)1); - CHECK_GT(shape_[0], 1); + CHECK_EQ(shape_.ndims(), 1UL); + CHECK_GT(shape_[0], 1UL); numSeqs_ = shape_[0] - 1; } @@ -199,7 +199,7 @@ public: ArgType argType = UNSPECIFIED) : BufferArg(buf, VALUE_TYPE_INT32, shape, argType) { bufferType_ = TENSOR_SEQUENCE_ID; - CHECK_EQ(shape_.ndims(), (size_t)1); + CHECK_EQ(shape_.ndims(), 1UL); numSeqs_ = shape_[0] - 1; } @@ -280,9 +280,9 @@ public: type_(static_cast(type)) { bufferType_ = TENSOR_SPARSE; CHECK((valueType == VALUE_TYPE_FLOAT) || (valueType == VALUE_TYPE_DOUBLE)); - CHECK_EQ(shape_.ndims(), (size_t)2); - CHECK_EQ(row_.shape().ndims(), (size_t)1); - CHECK_EQ(col_.shape().ndims(), (size_t)1); + CHECK_EQ(shape_.ndims(), 2UL); + CHECK_EQ(row_.shape().ndims(), 1UL); + CHECK_EQ(col_.shape().ndims(), 1UL); if (format_ == T_SPARSE_CSR) { CHECK_EQ(nnz, col.shape()[0]); } else if (format_ == T_SPARSE_CSC) { @@ -304,7 +304,7 @@ public: type_(static_cast(type)) { bufferType_ = TENSOR_SPARSE; CHECK((valueType == VALUE_TYPE_FLOAT) || (valueType == VALUE_TYPE_DOUBLE)); - CHECK_EQ(shape_.ndims(), (size_t)2); + CHECK_EQ(shape_.ndims(), 2UL); /// len of row_ : height + 1 (CSR) or nnz (CSC), buf_ == nullptr row_ = (format_ == T_SPARSE_CSR @@ -325,7 +325,7 @@ public: CHECK(buf_); CHECK(valueType_ == DataType::value); // CHECK(deviceType_ == DType); - CHECK_EQ(2, shape_.ndims()); + CHECK_EQ(2UL, shape_.ndims()); return typename Tensor::SparseMatrix( reinterpret_cast(buf_), reinterpret_cast(row_.data()), -- GitLab