Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PCL_UNUSED to fix doxygen warnings #3932

Merged
merged 3 commits into from Apr 17, 2020

Conversation

aPonza
Copy link
Contributor

@aPonza aPonza commented Apr 16, 2020

Fixes warning: argument <arg> of command @param is not found in the argument list of <function>

If this seems reasonable I'll follow up with a PR aiming at using this macro instead of all the naked (void) casts.

Copy link
Member

@kunaltyagi kunaltyagi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we could make this optional (eg: for OMP thread number), that would be heaven

@kunaltyagi kunaltyagi added changelog: new feature Meta-information for changelog generation module: common needs: code review Specify why not closed/merged yet labels Apr 17, 2020
*
* Slightly better than `(void)x` as explained [here](https://stackoverflow.com/a/4030983/9926122).
*/
#define PCL_UNUSED(x) ((void)(true ? 0 : ((x), void(), 0)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My eyes are struggling to mentally compile this expression.

@SergioRAgostinho SergioRAgostinho merged commit 645fa0f into PointCloudLibrary:master Apr 17, 2020
@SergioRAgostinho SergioRAgostinho removed the needs: code review Specify why not closed/merged yet label Apr 17, 2020
@SergioRAgostinho
Copy link
Member

SergioRAgostinho commented Apr 17, 2020

By the way this PR introduced warnings in 18.04, g++ 7.5.0

[ 42%] Building CXX object tools/CMakeFiles/pcl_plane_projection.dir/plane_projection.cpp.o                                                         
In file included from /home/sergio/Development/3rdparty/pcl/filters/include/pcl/filters/normal_refinement.h:40:0,          
                 from /home/sergio/Development/3rdparty/pcl/filters/include/pcl/filters/impl/normal_refinement.hpp:44,              
                 from /home/sergio/Development/3rdparty/pcl/filters/src/normal_refinement.cpp:39:                                   
/home/sergio/Development/3rdparty/pcl/filters/include/pcl/filters/normal_refinement.h: In instantiation of ‘std::vector<float> pcl::assignNormalWeights(const pcl::PointCloud<PointT>&, int, const
 std::vector<int>&, const std::vector<float>&) [with NormalT = pcl::Normal]’:                                                                                                                     
/home/sergio/Development/3rdparty/pcl/filters/include/pcl/filters/normal_refinement.h:102:60:   required from ‘bool pcl::refineNormal(const pcl::PointCloud<PointT>&, int, const std::vector<int>&
, const std::vector<float>&, NormalT&) [with NormalT = pcl::Normal]’                                                                                                                              
/home/sergio/Development/3rdparty/pcl/filters/include/pcl/filters/impl/normal_refinement.hpp:94:24:   required from ‘void pcl::NormalRefinement<NormalT>::applyFilter(pcl::NormalRefinement<Normal
T>::PointCloud&) [with NormalT = pcl::Normal; pcl::NormalRefinement<NormalT>::PointCloud = pcl::PointCloud<pcl::Normal>]’                                                                         
/home/sergio/Development/3rdparty/pcl/filters/src/normal_refinement.cpp:45:3:   required from here                                         
/home/sergio/Development/3rdparty/pcl/common/include/pcl/pcl_macros.h:133:46: warning: left operand of comma operator has no effect [-Wunused-value]
 #define PCL_UNUSED(x) ((void)(true ? 0 : ((x), void(), 0)))                                                                                        
                                           ~~~^~~~~~~~                                                   
/home/sergio/Development/3rdparty/pcl/filters/include/pcl/filters/normal_refinement.h:60:5: note: in expansion of macro ‘PCL_UNUSED’
     PCL_UNUSED(cloud);                                                                                                             
     ^                                                                                          
/home/sergio/Development/3rdparty/pcl/common/include/pcl/pcl_macros.h:133:46: warning: left operand of comma operator has no effect [-Wunused-value]
 #define PCL_UNUSED(x) ((void)(true ? 0 : ((x), void(), 0)))
                                           ~~~^~~~~~~~
/home/sergio/Development/3rdparty/pcl/filters/include/pcl/filters/normal_refinement.h:61:5: note: in expansion of macro ‘PCL_UNUSED’
     PCL_UNUSED(index);

@aPonza
Copy link
Contributor Author

aPonza commented Apr 17, 2020

This actually didn't work for:

  • GCC (both 5.5.0, and 9.2.1)
In file included from /__w/1/s/filters/include/pcl/filters/normal_refinement.h:40:0,
                 from /__w/1/s/filters/include/pcl/filters/impl/normal_refinement.hpp:44,
                 from /__w/1/s/filters/src/normal_refinement.cpp:39:
/__w/1/s/filters/include/pcl/filters/normal_refinement.h: In instantiation of 'std::vector<float> pcl::assignNormalWeights(const pcl::PointCloud<PointT>&, int, const std::vector<int>&, const std::vector<float>&) [with NormalT = pcl::Normal]':
/__w/1/s/filters/include/pcl/filters/normal_refinement.h:102:60:   required from 'bool pcl::refineNormal(const pcl::PointCloud<PointT>&, int, const std::vector<int>&, const std::vector<float>&, NormalT&) [with NormalT = pcl::Normal]'
/__w/1/s/filters/include/pcl/filters/impl/normal_refinement.hpp:94:24:   required from 'void pcl::NormalRefinement<NormalT>::applyFilter(pcl::NormalRefinement<NormalT>::PointCloud&) [with NormalT = pcl::Normal; pcl::NormalRefinement<NormalT>::PointCloud = pcl::PointCloud<pcl::Normal>]'
/__w/1/s/filters/src/normal_refinement.cpp:45:3:   required from here
/__w/1/s/common/include/pcl/pcl_macros.h:133:46: warning: left operand of comma operator has no effect [-Wunused-value]
 #define PCL_UNUSED(x) ((void)(true ? 0 : ((x), void(), 0)))
                                              ^
/__w/1/s/filters/include/pcl/filters/normal_refinement.h:60:5: note: in expansion of macro 'PCL_UNUSED'
     PCL_UNUSED(cloud);
     ^
/__w/1/s/common/include/pcl/pcl_macros.h:133:23: warning: left operand of comma operator has no effect [-Wunused-value]
 #define PCL_UNUSED(x) ((void)(true ? 0 : ((x), void(), 0)))
                       ^
/__w/1/s/filters/include/pcl/filters/normal_refinement.h:61:5: note: in expansion of macro 'PCL_UNUSED'
     PCL_UNUSED(index);
     ^

(link)

  • XCode
In file included from /Users/runner/runners/2.166.2/work/1/s/filters/src/normal_refinement.cpp:39:
In file included from /Users/runner/runners/2.166.2/work/1/s/filters/include/pcl/filters/impl/normal_refinement.hpp:44:
/Users/runner/runners/2.166.2/work/1/s/filters/include/pcl/filters/normal_refinement.h:61:16: warning: expression result unused [-Wunused-value]
    PCL_UNUSED(index);
               ^~~~~
/Users/runner/runners/2.166.2/work/1/s/common/include/pcl/pcl_macros.h:133:44: note: expanded from macro 'PCL_UNUSED'
#define PCL_UNUSED(x) ((void)(true ? 0 : ((x), void(), 0)))
                                           ^

(link)

But it was perfect for Doxygen and MSVC. Maybe for the rest (void)x will do since it's in place everywhere else in the library. This really should've been a draft PR.

@aPonza
Copy link
Contributor Author

aPonza commented Apr 17, 2020

Didn't update the page so I didn't see your message.

Anyways coliru seems ok with clang and gcc, and godbolt likes the MSVC version. I don't have anything online to test XCode, so I'll check that Doxygen doesn't complain and push the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants