Skip to content

Commit

Permalink
Add ignore function to remove Doxygen warnings for unused arguments (
Browse files Browse the repository at this point in the history
…#3942)

* remove PCL_UNUSED(x) in favour of ignore()
* remove PCL_UNUSED from codebase
  • Loading branch information
aPonza authored Apr 20, 2020
1 parent d4ee172 commit 9e599c1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
10 changes: 8 additions & 2 deletions common/include/pcl/common/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,11 @@ namespace pcl
{
return (std::fabs (val1 - val2) < eps);
}
}
}

/** \brief Utility function to eliminate unused variable warnings. */
template<typename T> void
ignore(const T&)
{
}
} // namespace utils
} // namespace pcl
9 changes: 0 additions & 9 deletions common/include/pcl/pcl_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,6 @@
PCL_DEPRECATED_MODIFY_MSG(Major, Minor, Message)), \
major_version_mismatch)

/**
* \brief Utility macro to eliminate unused variable warnings.
*
* \param x A parameter which will be used without being evaluated.
*
* Slightly better than `(void)x` as explained [here](https://stackoverflow.com/a/4030983/9926122).
*/
#define PCL_UNUSED(x) ((void)(true ? 0 : ((x), void(), 0)))

#if defined _WIN32
// Define math constants, without including math.h, to prevent polluting global namespace with old math methods
// Copied from math.h
Expand Down
5 changes: 3 additions & 2 deletions filters/include/pcl/filters/normal_refinement.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#pragma once

#include <pcl/pcl_macros.h>
#include <pcl/common/utils.h>
#include <pcl/filters/filter.h>

namespace pcl
Expand All @@ -57,8 +58,8 @@ namespace pcl
const std::vector<int>& k_indices,
const std::vector<float>& k_sqr_distances)
{
PCL_UNUSED(cloud);
PCL_UNUSED(index);
pcl::utils::ignore(cloud);
pcl::utils::ignore(index);
// Check inputs
if (k_indices.size () != k_sqr_distances.size ())
PCL_ERROR("[pcl::assignNormalWeights] inequal size of neighbor indices and distances!\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include <pcl/pcl_base.h>
#include <pcl/pcl_macros.h>
#include <pcl/common/angles.h>
#include <pcl/common/utils.h>
#include <pcl/PointIndices.h>
#include <pcl/ModelCoefficients.h>
#include <pcl/segmentation/plane_coefficient_comparator.h>
Expand Down Expand Up @@ -294,8 +295,8 @@ namespace pcl
PointCloudLPtr& labels,
std::vector<pcl::PointIndices>& label_indices)
{
PCL_UNUSED(centroids);
PCL_UNUSED(covariances);
pcl::utils::ignore(centroids);
pcl::utils::ignore(covariances);
refine(model_coefficients, inlier_indices, labels, label_indices);
}

Expand Down

0 comments on commit 9e599c1

Please sign in to comment.