diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e8ea146e64..9d49eef2632 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -110,7 +110,12 @@ endif() # ---[ Unix/Darwin/Windows specific flags if(CMAKE_COMPILER_IS_GNUCXX) if("${CMAKE_CXX_FLAGS}" STREQUAL "${CMAKE_CXX_FLAGS_DEFAULT}") - set(CMAKE_CXX_FLAGS "-Wabi -Wall -Wextra -Wno-unknown-pragmas -fno-strict-aliasing -Wno-format-extra-args -Wno-sign-compare -Wno-invalid-offsetof -Wno-conversion ${SSE_FLAGS_STR}") + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wabi=11") + else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wabi") + endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unknown-pragmas -fno-strict-aliasing -Wno-format-extra-args -Wno-sign-compare -Wno-invalid-offsetof -Wno-conversion ${SSE_FLAGS_STR}") endif() if("${CMAKE_SHARED_LINKER_FLAGS}" STREQUAL "" AND NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin") diff --git a/common/src/print.cpp b/common/src/print.cpp index 8f7946b661a..24fcdeff792 100644 --- a/common/src/print.cpp +++ b/common/src/print.cpp @@ -126,7 +126,7 @@ pcl::console::change_text_color (FILE *stream, int attribute, int fg, int bg) HANDLE h = GetStdHandle ((stream == stdout) ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE); SetConsoleTextAttribute (h, convertAttributesColor (attribute, fg, bg)); #else - char command[13]; + char command[40]; // Command is the control command to the terminal sprintf (command, "%c[%d;%d;%dm", 0x1B, attribute, fg + 30, bg + 40); fprintf (stream, "%s", command); @@ -143,7 +143,7 @@ pcl::console::change_text_color (FILE *stream, int attribute, int fg) HANDLE h = GetStdHandle ((stream == stdout) ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE); SetConsoleTextAttribute (h, convertAttributesColor (attribute, fg)); #else - char command[13]; + char command[17]; // Command is the control command to the terminal sprintf (command, "%c[%d;%dm", 0x1B, attribute, fg + 30); fprintf (stream, "%s", command); diff --git a/filters/include/pcl/filters/impl/crop_hull.hpp b/filters/include/pcl/filters/impl/crop_hull.hpp index 63d8c0a902c..8a2ed36351a 100644 --- a/filters/include/pcl/filters/impl/crop_hull.hpp +++ b/filters/include/pcl/filters/impl/crop_hull.hpp @@ -241,7 +241,7 @@ pcl::CropHull::isPointIn2DPolyWithVertIndices ( bool in_poly = false; double x1, x2, y1, y2; - const int nr_poly_points = static_cast(verts.vertices.size ()); + const int nr_poly_points = static_cast(verts.vertices.size ()); double xold = cloud[verts.vertices[nr_poly_points - 1]].getVector3fMap ()[PlaneDim1]; double yold = cloud[verts.vertices[nr_poly_points - 1]].getVector3fMap ()[PlaneDim2]; for (int i = 0; i < nr_poly_points; i++) diff --git a/filters/src/crop_box.cpp b/filters/src/crop_box.cpp index 8588c8341e8..a473cdffa03 100644 --- a/filters/src/crop_box.cpp +++ b/filters/src/crop_box.cpp @@ -80,7 +80,7 @@ pcl::CropBox::applyFilter (PCLPointCloud2 &output) // Get local point int point_offset = ((*indices_)[index] * input_->point_step); int offset = point_offset + input_->fields[x_idx_].offset; - memcpy (&local_pt, &input_->data[offset], sizeof (float)*3); + memcpy (local_pt.data (), &input_->data[offset], sizeof (float)*3); // Check if the point is invalid if (!std::isfinite (local_pt.x ()) || @@ -170,7 +170,7 @@ pcl::CropBox::applyFilter (std::vector &indices) // Get local point int point_offset = ((*indices_)[index] * input_->point_step); int offset = point_offset + input_->fields[x_idx_].offset; - memcpy (&local_pt, &input_->data[offset], sizeof (float)*3); + memcpy (local_pt.data (), &input_->data[offset], sizeof (float)*3); // Transform point to world space if (!transform_matrix_is_identity) diff --git a/io/src/hdl_grabber.cpp b/io/src/hdl_grabber.cpp index 69708c227c6..75304ce3f6f 100644 --- a/io/src/hdl_grabber.cpp +++ b/io/src/hdl_grabber.cpp @@ -691,7 +691,7 @@ pcl::HDLGrabber::readPacketsFromPcap () struct timeval lasttime; - lasttime.tv_sec = 0; + lasttime.tv_sec = lasttime.tv_usec = 0; int32_t returnValue = pcap_next_ex (pcap, &header, &data); diff --git a/octree/include/pcl/octree/impl/octree_pointcloud.hpp b/octree/include/pcl/octree/impl/octree_pointcloud.hpp index f6bfdf4c15a..95c0dc2ba44 100644 --- a/octree/include/pcl/octree/impl/octree_pointcloud.hpp +++ b/octree/include/pcl/octree/impl/octree_pointcloud.hpp @@ -221,7 +221,7 @@ pcl::octree::OctreePointCloud float norm = direction.norm (); direction.normalize (); - const float step_size = static_cast (resolution_) * precision; + const float step_size = static_cast (resolution_) * precision; // Ensure we get at least one step for the first voxel. const int nsteps = std::max (1, static_cast (norm / step_size)); @@ -232,7 +232,7 @@ pcl::octree::OctreePointCloud // Walk along the line segment with small steps. for (int i = 0; i < nsteps; ++i) { - Eigen::Vector3f p = origin + (direction * step_size * static_cast (i)); + Eigen::Vector3f p = origin + (direction * step_size * static_cast (i)); PointT octree_p; octree_p.x = p.x (); diff --git a/octree/include/pcl/octree/octree_key.h b/octree/include/pcl/octree/octree_key.h index 85c85872de3..11562494854 100644 --- a/octree/include/pcl/octree/octree_key.h +++ b/octree/include/pcl/octree/octree_key.h @@ -69,6 +69,8 @@ namespace pcl memcpy(key_, source.key_, sizeof(key_)); } + OctreeKey& operator=(const OctreeKey&) = default; + /** \brief Operator== for comparing octree keys with each other. * \return "true" if leaf node indices are identical; "false" otherwise. * */