diff --git a/common/include/pcl/common/utils.h b/common/include/pcl/common/utils.h index 6c91b001cf2..2390ffeb21f 100644 --- a/common/include/pcl/common/utils.h +++ b/common/include/pcl/common/utils.h @@ -56,5 +56,11 @@ namespace pcl { return (std::fabs (val1 - val2) < eps); } - } -} + + /** \brief Utility function to eliminate unused variable warnings. */ + template void + ignore(const T&) + { + } + } // namespace utils +} // namespace pcl diff --git a/common/include/pcl/pcl_macros.h b/common/include/pcl/pcl_macros.h index c47c6bd76d4..696ac07cad6 100644 --- a/common/include/pcl/pcl_macros.h +++ b/common/include/pcl/pcl_macros.h @@ -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 diff --git a/filters/include/pcl/filters/normal_refinement.h b/filters/include/pcl/filters/normal_refinement.h index d0861120d04..027e7cd102b 100644 --- a/filters/include/pcl/filters/normal_refinement.h +++ b/filters/include/pcl/filters/normal_refinement.h @@ -38,6 +38,7 @@ #pragma once #include +#include #include namespace pcl @@ -57,8 +58,8 @@ namespace pcl const std::vector& k_indices, const std::vector& 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"); diff --git a/segmentation/include/pcl/segmentation/organized_multi_plane_segmentation.h b/segmentation/include/pcl/segmentation/organized_multi_plane_segmentation.h index 336ee2a735b..26edba5c33c 100644 --- a/segmentation/include/pcl/segmentation/organized_multi_plane_segmentation.h +++ b/segmentation/include/pcl/segmentation/organized_multi_plane_segmentation.h @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -294,8 +295,8 @@ namespace pcl PointCloudLPtr& labels, std::vector& label_indices) { - PCL_UNUSED(centroids); - PCL_UNUSED(covariances); + pcl::utils::ignore(centroids); + pcl::utils::ignore(covariances); refine(model_coefficients, inlier_indices, labels, label_indices); }