Skip to content

Commit 9b2f0f9

Browse files
committed
Shift suppression to code
1 parent 60158a1 commit 9b2f0f9

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

.travis.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,6 @@ install:
186186
187187
if [ "$CLANG" = "7" ]; then
188188
export CXXFLAGS="-stdlib=libc++"
189-
# Suppress this warning b/c it's inherent to how `py::self` is used for overloads
190-
export CXXFLAGS="$CXXFLAGS -Wno-self-assign-overloaded"
191189
fi
192190
193191
export NPY_NUM_BUILD_JOBS=2

tests/test_operator_overloading.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,23 @@ namespace std {
6262
};
6363
}
6464

65+
#pragma GCC diagnostic push
66+
// clang 7.0.0 and Apple LLVM 10.0.1 introduce `-Wself-assign-overloaded` to
67+
// `-Wall`, which is used here for overloading (e.g. `py::self += py::self `).
68+
// Here, we suppress the warning using `#pragma diagnostic`.
69+
// Taken from: https://github.com/RobotLocomotion/drake/commit/aaf84b46
70+
// TODO(eric): This could be resolved using a function / functor (e.g. `py::self()`).
71+
#if (__clang__) && (__APPLE__)
72+
#if (__clang_major__ >= 10) && (__clang_minor__ >= 0) && (__clang_patchlevel__ >= 1)
73+
#pragma GCC diagnostic ignored "-Wself-assign-overloaded"
74+
#endif
75+
#elif (__clang__)
76+
#if (__clang_major__ >= 7)
77+
#pragma GCC diagnostic ignored "-Wself-assign-overloaded"
78+
#endif
79+
#endif
80+
#endif
81+
6582
TEST_SUBMODULE(operators, m) {
6683

6784
// test_operator_overloading
@@ -144,3 +161,5 @@ TEST_SUBMODULE(operators, m) {
144161
.def_readwrite("b", &NestC::b);
145162
m.def("get_NestC", [](const NestC &c) { return c.value; });
146163
}
164+
165+
#pragma GCC diagnostic pop

0 commit comments

Comments
 (0)