Skip to content

Commit

Permalink
Suppress self-assign-overloaded warning in symbolic_py.cc
Browse files Browse the repository at this point in the history
  • Loading branch information
soonho-tri committed Mar 28, 2019
1 parent 8da61a4 commit aaf84b4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions bindings/pydrake/symbolic_py.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@
#include "drake/bindings/pydrake/pydrake_pybind.h"
#include "drake/bindings/pydrake/symbolic_types_pybind.h"

#pragma GCC diagnostic push
// Apple LLVM version 10.0.1 (clang-1001.0.46.3) adds `-Wself-assign-overloaded`
// to `-Wall`, which generates warnings on Pybind11's operator-overloading idiom
// that is using py::self (example: `def(py::self + py::self)`).
// Here, we suppress the warning using `#pragma diagnostic`.
#if (__APPLE__) && (__clang__) && (__clang_major__ >= 10) && \
(__clang_minor__ >= 0) && (__clang_patchlevel__ >= 1)
#pragma GCC diagnostic ignored "-Wself-assign-overloaded"
#endif

namespace drake {
namespace pydrake {

Expand Down Expand Up @@ -594,3 +604,5 @@ PYBIND11_MODULE(symbolic, m) {

} // namespace pydrake
} // namespace drake

#pragma GCC diagnostic pop

0 comments on commit aaf84b4

Please sign in to comment.