Clean up C++ warnings (#6213)

This commit is contained in:
Igor Moura
2020-10-19 12:02:33 -03:00
committed by GitHub
parent ddf37cca30
commit d1254808d5
20 changed files with 78 additions and 89 deletions

View File

@@ -43,7 +43,7 @@ class Column {
BinIdxType GetFeatureBinIdx(size_t idx) const { return index_[idx]; }
const uint32_t GetBaseIdx() const { return index_base_; }
uint32_t GetBaseIdx() const { return index_base_; }
common::Span<const BinIdxType> GetFeatureBinIdxPtr() const { return index_; }
@@ -179,12 +179,12 @@ class ColumnMatrix {
but for ColumnMatrix we still have a chance to reduce the memory consumption */
} else {
if (bins_type_size_ == kUint8BinsTypeSize) {
SetIndex<uint8_t>(gmat.index.data<uint32_t>(), gmat, nrow, nfeature);
SetIndex<uint8_t>(gmat.index.data<uint32_t>(), gmat, nfeature);
} else if (bins_type_size_ == kUint16BinsTypeSize) {
SetIndex<uint16_t>(gmat.index.data<uint32_t>(), gmat, nrow, nfeature);
SetIndex<uint16_t>(gmat.index.data<uint32_t>(), gmat, nfeature);
} else {
CHECK_EQ(bins_type_size_, kUint32BinsTypeSize);
SetIndex<uint32_t>(gmat.index.data<uint32_t>(), gmat, nrow, nfeature);
SetIndex<uint32_t>(gmat.index.data<uint32_t>(), gmat, nfeature);
}
}
}
@@ -271,7 +271,7 @@ class ColumnMatrix {
template<typename T>
inline void SetIndex(uint32_t* index, const GHistIndexMatrix& gmat,
const size_t nrow, const size_t nfeature) {
const size_t nfeature) {
std::vector<size_t> num_nonzeros;
num_nonzeros.resize(nfeature);
std::fill(num_nonzeros.begin(), num_nonzeros.end(), 0);
@@ -311,18 +311,18 @@ class ColumnMatrix {
rbegin += batch.Size();
}
}
const BinTypeSize GetTypeSize() const {
BinTypeSize GetTypeSize() const {
return bins_type_size_;
}
// This is just an utility function
const bool NoMissingValues(const size_t n_elements,
bool NoMissingValues(const size_t n_elements,
const size_t n_row, const size_t n_features) {
return n_elements == n_features * n_row;
}
// And this returns part of state
const bool AnyMissing() const {
bool AnyMissing() const {
return any_missing_;
}

View File

@@ -29,8 +29,7 @@
namespace xgboost {
namespace common {
void GHistIndexMatrix::ResizeIndex(const size_t rbegin, const SparsePage& batch,
const size_t n_offsets, const size_t n_index,
void GHistIndexMatrix::ResizeIndex(const size_t n_index,
const bool isDense) {
if ((max_num_bins - 1 <= static_cast<int>(std::numeric_limits<uint8_t>::max())) && isDense) {
index.SetBinTypeSize(kUint8BinsTypeSize);
@@ -119,7 +118,7 @@ void GHistIndexMatrix::Init(DMatrix* p_fmat, int max_bins) {
const size_t n_offsets = cut.Ptrs().size() - 1;
const size_t n_index = row_ptr[rbegin + batch.Size()];
ResizeIndex(rbegin, batch, n_offsets, n_index, isDense);
ResizeIndex(n_index, isDense);
CHECK_GT(cut.Values().size(), 0U);

View File

@@ -273,8 +273,7 @@ struct GHistIndexMatrix {
}
}
void ResizeIndex(const size_t rbegin, const SparsePage& batch,
const size_t n_offsets, const size_t n_index,
void ResizeIndex(const size_t n_index,
const bool isDense);
inline void GetFeatureCounts(size_t* counts) const {

View File

@@ -32,7 +32,7 @@ class PeekableInStream : public dmlc::Stream {
size_t Read(void* dptr, size_t size) override;
virtual size_t PeekRead(void* dptr, size_t size);
void Write(const void* dptr, size_t size) override {
void Write(const void*, size_t) override {
LOG(FATAL) << "Not implemented";
}
@@ -60,7 +60,7 @@ class FixedSizeStream : public PeekableInStream {
size_t Tell() const { return pointer_; }
void Seek(size_t pos);
void Write(const void* dptr, size_t size) override {
void Write(const void*, size_t) override {
LOG(FATAL) << "Not implemented";
}