Fix compiler warnings. (#7974)

- Remove unused parameters. There are still many warnings that are not yet
addressed. Currently, the warnings in dmlc-core dominate the error log.
- Remove `distributed` parameter from metric.
- Fixes some warnings about signed comparison.
This commit is contained in:
Jiaming Yuan
2022-06-06 22:56:25 +08:00
committed by GitHub
parent d48123d23b
commit 1a33b50a0d
46 changed files with 149 additions and 189 deletions

View File

@@ -68,8 +68,8 @@ class GradientBooster : public Model, public Configurable {
* \param layer_end End of booster layer. 0 means do not limit trees.
* \param out Output gradient booster
*/
virtual void Slice(int32_t layer_begin, int32_t layer_end, int32_t step,
GradientBooster *out, bool* out_of_bound) const {
virtual void Slice(int32_t /*layer_begin*/, int32_t /*layer_end*/, int32_t /*step*/,
GradientBooster* /*out*/, bool* /*out_of_bound*/) const {
LOG(FATAL) << "Slice is not supported by current booster.";
}
/*!

View File

@@ -89,7 +89,7 @@ class JsonReader {
} else if (got == 0) {
msg += "\\0\"";
} else {
msg += (got <= 127 ? std::string{got} : std::to_string(got)) + " \""; // NOLINT
msg += (got <= static_cast<char>(127) ? std::string{got} : std::to_string(got)) + " \"";
}
Error(msg);
}

View File

@@ -317,7 +317,8 @@ class TensorView {
}
template <size_t old_dim, size_t new_dim, int32_t D, typename Index>
LINALG_HD size_t MakeSliceDim(size_t new_shape[D], size_t new_stride[D], Index i) const {
LINALG_HD size_t MakeSliceDim(DMLC_ATTRIBUTE_UNUSED size_t new_shape[D],
DMLC_ATTRIBUTE_UNUSED size_t new_stride[D], Index i) const {
static_assert(old_dim < kDim, "");
return stride_[old_dim] * i;
}

View File

@@ -57,12 +57,8 @@ class Metric : public Configurable {
* \brief evaluate a specific metric
* \param preds prediction
* \param info information, including label etc.
* \param distributed whether a call to Allreduce is needed to gather
* the average statistics across all the node,
* this is only supported by some metrics
*/
virtual double Eval(const HostDeviceVector<bst_float> &preds,
const MetaInfo &info, bool distributed) = 0;
virtual double Eval(const HostDeviceVector<bst_float>& preds, const MetaInfo& info) = 0;
/*! \return name of metric */
virtual const char* Name() const = 0;
/*! \brief virtual destructor */

View File

@@ -103,8 +103,10 @@ class ObjFunction : public Configurable {
* \param prediction Model prediction after transformation.
* \param p_tree Tree that needs to be updated.
*/
virtual void UpdateTreeLeaf(HostDeviceVector<bst_node_t> const& position, MetaInfo const& info,
HostDeviceVector<float> const& prediction, RegTree* p_tree) const {}
virtual void UpdateTreeLeaf(HostDeviceVector<bst_node_t> const& /*position*/,
MetaInfo const& /*info*/,
HostDeviceVector<float> const& /*prediction*/,
RegTree* /*p_tree*/) const {}
/*!
* \brief Create an objective function according to name.