Skip to content

Commit

Permalink
Added PCL_FALLTHROUGH
Browse files Browse the repository at this point in the history
  • Loading branch information
kunaltyagi committed Sep 2, 2019
1 parent 762f6cc commit 0dc8288
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
11 changes: 11 additions & 0 deletions common/include/pcl/pcl_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -344,3 +344,14 @@ aligned_free (void* ptr)
#define PCL_MAKE_ALIGNED_OPERATOR_NEW \
EIGEN_MAKE_ALIGNED_OPERATOR_NEW \
using _custom_allocator_type_trait = void;

/**
* \brief Macro to add a no-op or a fallthrough attribute based on compiler feature
*
* \ingroup common
*/
#if __has_cpp_attribute(fallthrough) \
#define PCL_FALLTHROUGH [[fallthrough]];
#else
#define PCL_FALLTHROUGH
#endif
5 changes: 3 additions & 2 deletions common/src/PCLPointCloud2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include <vector>

#include <pcl/common/io.h>
#include <pcl/pcl_macros.h>
#include <pcl/exceptions.h>
#include <pcl/PCLPointCloud2.h>

Expand All @@ -62,9 +63,9 @@ pcl::PCLPointCloud2::concatenate (pcl::PCLPointCloud2 &cloud1,
{
case 1:
cloud1 = cloud2;
// C++17 [[fallthrough]];
PCL_FALLTHROUGH;
case 0:
// C++17 [[fallthrough]];
PCL_FALLTHROUGH;
case 2:
cloud1.header.stamp = std::max(cloud1.header.stamp, cloud2.header.stamp);
return (true);
Expand Down

0 comments on commit 0dc8288

Please sign in to comment.