Reduced some C++ compiler warnings (#6197)
* Removed some warnings * Rebase with master * Solved C++ Google Tests errors made by refactoring in order to remove warnings * Undo renaming path -> path_ * Fix style check Co-authored-by: Hyunsu Cho <chohyu01@cs.washington.edu>
This commit is contained in:
@@ -33,19 +33,19 @@ struct HostDeviceVectorImpl {
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
HostDeviceVector<T>::HostDeviceVector(size_t size, T v, int device)
|
||||
HostDeviceVector<T>::HostDeviceVector(size_t size, T v, int)
|
||||
: impl_(nullptr) {
|
||||
impl_ = new HostDeviceVectorImpl<T>(size, v);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
HostDeviceVector<T>::HostDeviceVector(std::initializer_list<T> init, int device)
|
||||
HostDeviceVector<T>::HostDeviceVector(std::initializer_list<T> init, int)
|
||||
: impl_(nullptr) {
|
||||
impl_ = new HostDeviceVectorImpl<T>(init);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
HostDeviceVector<T>::HostDeviceVector(const std::vector<T>& init, int device)
|
||||
HostDeviceVector<T>::HostDeviceVector(const std::vector<T>& init, int)
|
||||
: impl_(nullptr) {
|
||||
impl_ = new HostDeviceVectorImpl<T>(init);
|
||||
}
|
||||
@@ -166,7 +166,7 @@ bool HostDeviceVector<T>::DeviceCanWrite() const {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void HostDeviceVector<T>::SetDevice(int device) const {}
|
||||
void HostDeviceVector<T>::SetDevice(int) const {}
|
||||
|
||||
// explicit instantiations are required, as HostDeviceVector isn't header-only
|
||||
template class HostDeviceVector<bst_float>;
|
||||
|
||||
@@ -76,7 +76,7 @@ void JsonWriter::Visit(JsonInteger const* num) {
|
||||
std::memcpy(stream_->data() + ori_size, i2s_buffer_, digits);
|
||||
}
|
||||
|
||||
void JsonWriter::Visit(JsonNull const* null) {
|
||||
void JsonWriter::Visit(JsonNull const* ) {
|
||||
auto s = stream_->size();
|
||||
stream_->resize(s + 4);
|
||||
auto& buf = (*stream_);
|
||||
@@ -179,7 +179,7 @@ Json& JsonObject::operator[](std::string const & key) {
|
||||
return object_[key];
|
||||
}
|
||||
|
||||
Json& JsonObject::operator[](int ind) {
|
||||
Json& JsonObject::operator[](int ) {
|
||||
LOG(FATAL) << "Object of type "
|
||||
<< Value::TypeStr() << " can not be indexed by Integer.";
|
||||
return DummyJsonObject();
|
||||
@@ -203,13 +203,13 @@ void JsonObject::Save(JsonWriter* writer) {
|
||||
}
|
||||
|
||||
// Json String
|
||||
Json& JsonString::operator[](std::string const & key) {
|
||||
Json& JsonString::operator[](std::string const& ) {
|
||||
LOG(FATAL) << "Object of type "
|
||||
<< Value::TypeStr() << " can not be indexed by string.";
|
||||
return DummyJsonObject();
|
||||
}
|
||||
|
||||
Json& JsonString::operator[](int ind) {
|
||||
Json& JsonString::operator[](int ) {
|
||||
LOG(FATAL) << "Object of type "
|
||||
<< Value::TypeStr() << " can not be indexed by Integer."
|
||||
<< " Please try obtaining std::string first.";
|
||||
@@ -236,7 +236,7 @@ void JsonString::Save(JsonWriter* writer) {
|
||||
JsonArray::JsonArray(JsonArray && that) :
|
||||
Value(ValueKind::kArray), vec_{std::move(that.vec_)} {}
|
||||
|
||||
Json& JsonArray::operator[](std::string const & key) {
|
||||
Json& JsonArray::operator[](std::string const& ) {
|
||||
LOG(FATAL) << "Object of type "
|
||||
<< Value::TypeStr() << " can not be indexed by string.";
|
||||
return DummyJsonObject();
|
||||
@@ -263,13 +263,13 @@ void JsonArray::Save(JsonWriter* writer) {
|
||||
}
|
||||
|
||||
// Json Number
|
||||
Json& JsonNumber::operator[](std::string const & key) {
|
||||
Json& JsonNumber::operator[](std::string const& ) {
|
||||
LOG(FATAL) << "Object of type "
|
||||
<< Value::TypeStr() << " can not be indexed by string.";
|
||||
return DummyJsonObject();
|
||||
}
|
||||
|
||||
Json& JsonNumber::operator[](int ind) {
|
||||
Json& JsonNumber::operator[](int ) {
|
||||
LOG(FATAL) << "Object of type "
|
||||
<< Value::TypeStr() << " can not be indexed by Integer.";
|
||||
return DummyJsonObject();
|
||||
@@ -298,13 +298,13 @@ void JsonNumber::Save(JsonWriter* writer) {
|
||||
}
|
||||
|
||||
// Json Integer
|
||||
Json& JsonInteger::operator[](std::string const& key) {
|
||||
Json& JsonInteger::operator[](std::string const& ) {
|
||||
LOG(FATAL) << "Object of type "
|
||||
<< Value::TypeStr() << " can not be indexed by string.";
|
||||
return DummyJsonObject();
|
||||
}
|
||||
|
||||
Json& JsonInteger::operator[](int ind) {
|
||||
Json& JsonInteger::operator[](int ) {
|
||||
LOG(FATAL) << "Object of type "
|
||||
<< Value::TypeStr() << " can not be indexed by Integer.";
|
||||
return DummyJsonObject();
|
||||
@@ -326,13 +326,13 @@ void JsonInteger::Save(JsonWriter* writer) {
|
||||
}
|
||||
|
||||
// Json Null
|
||||
Json& JsonNull::operator[](std::string const & key) {
|
||||
Json& JsonNull::operator[](std::string const& ) {
|
||||
LOG(FATAL) << "Object of type "
|
||||
<< Value::TypeStr() << " can not be indexed by string.";
|
||||
return DummyJsonObject();
|
||||
}
|
||||
|
||||
Json& JsonNull::operator[](int ind) {
|
||||
Json& JsonNull::operator[](int ) {
|
||||
LOG(FATAL) << "Object of type "
|
||||
<< Value::TypeStr() << " can not be indexed by Integer.";
|
||||
return DummyJsonObject();
|
||||
@@ -353,13 +353,13 @@ void JsonNull::Save(JsonWriter* writer) {
|
||||
}
|
||||
|
||||
// Json Boolean
|
||||
Json& JsonBoolean::operator[](std::string const & key) {
|
||||
Json& JsonBoolean::operator[](std::string const& ) {
|
||||
LOG(FATAL) << "Object of type "
|
||||
<< Value::TypeStr() << " can not be indexed by string.";
|
||||
return DummyJsonObject();
|
||||
}
|
||||
|
||||
Json& JsonBoolean::operator[](int ind) {
|
||||
Json& JsonBoolean::operator[](int ) {
|
||||
LOG(FATAL) << "Object of type "
|
||||
<< Value::TypeStr() << " can not be indexed by Integer.";
|
||||
return DummyJsonObject();
|
||||
|
||||
Reference in New Issue
Block a user