Skip to content

Commit 5e720a2

Browse files
authored
Merge pull request #3523 from roystgnr/warnings_fixes
Warnings fixes
2 parents 42d5d79 + 1d36528 commit 5e720a2

6 files changed

Lines changed: 22 additions & 3 deletions

File tree

contrib/metaphysicl

include/utils/ignore_warnings.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545
#pragma clang diagnostic ignored "-Woverloaded-virtual"
4646
#pragma clang diagnostic ignored "-Wmacro-redefined"
4747
#pragma clang diagnostic ignored "-Winconsistent-missing-override"
48+
#pragma clang diagnostic ignored "-Wunused-but-set-variable"
49+
#pragma clang diagnostic ignored "-Winvalid-utf8"
4850
// Ignore warnings from code that does "if (foo) bar();"
4951
#pragma clang diagnostic ignored "-Wmisleading-indentation"
5052
#pragma clang diagnostic ignored "-Wint-in-bool-context"
@@ -79,6 +81,7 @@
7981
// And these are for Eigen
8082
#pragma GCC diagnostic ignored "-Wconversion"
8183
#pragma GCC diagnostic ignored "-Wstack-protector"
84+
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
8285
// And this for VTK
8386
#pragma GCC diagnostic ignored "-Wlogical-op"
8487
// Ignore warnings from code that uses deprecated members of std, like std::auto_ptr.

src/mesh/poly2tri_triangulator.C

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@
3535
#include "libmesh/utility.h"
3636

3737
// poly2tri includes
38+
#include "libmesh/ignore_warnings.h" // utf-8 comments should be fine...
3839
#include "poly2tri/poly2tri.h"
40+
#include "libmesh/restore_warnings.h"
3941

4042
// Anonymous namespace - poly2tri doesn't define operator<(Point,Point)
4143
namespace

src/mesh/xdr_io.C

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,9 @@ void XdrIO::write_serialized_nodes (Xdr & io, const dof_id_type max_node_id,
698698
std::vector<std::vector<dof_id_type>> recv_ids (this->n_processors());
699699
std::vector<std::vector<Real>> recv_coords(this->n_processors());
700700

701+
#ifndef NDEBUG
701702
std::size_t n_written=0;
703+
#endif
702704

703705
// Note: do not be tempted to replace the node loops below with
704706
// range-based iterators, these iterators must be defined outside
@@ -837,7 +839,9 @@ void XdrIO::write_serialized_nodes (Xdr & io, const dof_id_type max_node_id,
837839
coords[3*local_idx+2] = 0.;
838840
#endif
839841

842+
#ifndef NDEBUG
840843
n_written++;
844+
#endif
841845
}
842846

843847
io.data_stream (coords.empty() ? nullptr : coords.data(),
@@ -864,8 +868,10 @@ void XdrIO::write_serialized_nodes (Xdr & io, const dof_id_type max_node_id,
864868
std::vector<xdr_id_type> & unique_ids=xfer_unique_ids;
865869
std::vector<std::vector<xdr_id_type>> recv_unique_ids (this->n_processors());
866870

871+
#ifndef NDEBUG
867872
// Reset write counter
868873
n_written = 0;
874+
#endif
869875

870876
// Return node iterator to the beginning
871877
node_iter = mesh.local_nodes_begin();
@@ -976,7 +982,9 @@ void XdrIO::write_serialized_nodes (Xdr & io, const dof_id_type max_node_id,
976982

977983
unique_ids[local_idx] = recv_unique_ids[pid][idx];
978984

985+
#ifndef NDEBUG
979986
n_written++;
987+
#endif
980988
}
981989

982990
io.data_stream (unique_ids.empty() ? nullptr : unique_ids.data(),
@@ -992,8 +1000,10 @@ void XdrIO::write_serialized_nodes (Xdr & io, const dof_id_type max_node_id,
9921000
// Next: do "block"-based I/O for the extra node integers (if necessary)
9931001
if (n_node_integers)
9941002
{
1003+
#ifndef NDEBUG
9951004
// Reset write counter
9961005
n_written = 0;
1006+
#endif
9971007

9981008
// Return node iterator to the beginning
9991009
node_iter = mesh.local_nodes_begin();
@@ -1127,7 +1137,9 @@ void XdrIO::write_serialized_nodes (Xdr & io, const dof_id_type max_node_id,
11271137
for (unsigned int i=0; i != n_node_integers; ++i)
11281138
node_integers[n_node_integers*local_idx + i] = recv_node_integers[pid][n_node_integers*idx + i];
11291139

1140+
#ifndef NDEBUG
11301141
n_written++;
1142+
#endif
11311143
}
11321144

11331145
io.data_stream (node_integers.empty() ? nullptr : node_integers.data(),

src/utils/point_locator_nanoflann.C

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ PointLocatorNanoflann::operator() (const Point & p,
319319
candidate_elements.clear();
320320

321321
// Keep track of the number of elements checked in detail
322-
unsigned int n_elems_checked = 0;
322+
// unsigned int n_elems_checked = 0;
323323

324324
// Do the KD-Tree search
325325
auto result_set = this->kd_tree_find_neighbors(p, _num_results);
@@ -350,7 +350,7 @@ PointLocatorNanoflann::operator() (const Point & p,
350350
candidate_elem->contains_point(p);
351351

352352
// Increment the number of elements checked
353-
n_elems_checked++;
353+
// n_elems_checked++;
354354

355355
// If the point is contained in/close to an Elem from an
356356
// allowed subdomain, add it to the list.

tests/mesh/libmesh_poly2tri.C

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
#include "libmesh_cppunit.h"
33

44
#ifdef LIBMESH_HAVE_POLY2TRI
5+
# include "libmesh/ignore_warnings.h" // utf-8 comments should be fine...
56
# include "poly2tri/poly2tri.h"
7+
# include "libmesh/restore_warnings.h"
68
#endif
79

810
#include <numeric>

0 commit comments

Comments
 (0)