Skip to content

Commit

Permalink
Remove compiler warnings which make build output noisy (#3366)
Browse files Browse the repository at this point in the history
Remove compiler warnings which make build output noisy
  • Loading branch information
taketwo committed Sep 26, 2019
2 parents 00cd8b7 + 70ff91e commit 8ab5ae4
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 9 deletions.
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions common/src/print.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion filters/include/pcl/filters/impl/crop_hull.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ pcl::CropHull<PointT>::isPointIn2DPolyWithVertIndices (
bool in_poly = false;
double x1, x2, y1, y2;

const int nr_poly_points = static_cast<const int>(verts.vertices.size ());
const int nr_poly_points = static_cast<int>(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++)
Expand Down
4 changes: 2 additions & 2 deletions filters/src/crop_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ pcl::CropBox<pcl::PCLPointCloud2>::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 ()) ||
Expand Down Expand Up @@ -170,7 +170,7 @@ pcl::CropBox<pcl::PCLPointCloud2>::applyFilter (std::vector<int> &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)
Expand Down
2 changes: 1 addition & 1 deletion io/src/hdl_grabber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions octree/include/pcl/octree/impl/octree_pointcloud.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ pcl::octree::OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT>
float norm = direction.norm ();
direction.normalize ();

const float step_size = static_cast<const float> (resolution_) * precision;
const float step_size = static_cast<float> (resolution_) * precision;
// Ensure we get at least one step for the first voxel.
const int nsteps = std::max (1, static_cast<int> (norm / step_size));

Expand All @@ -232,7 +232,7 @@ pcl::octree::OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT>
// Walk along the line segment with small steps.
for (int i = 0; i < nsteps; ++i)
{
Eigen::Vector3f p = origin + (direction * step_size * static_cast<const float> (i));
Eigen::Vector3f p = origin + (direction * step_size * static_cast<float> (i));

PointT octree_p;
octree_p.x = p.x ();
Expand Down
2 changes: 2 additions & 0 deletions octree/include/pcl/octree/octree_key.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
* */
Expand Down

0 comments on commit 8ab5ae4

Please sign in to comment.