Skip to content

Commit 8bc4f6b

Browse files
Fix clang
1 parent c01f282 commit 8bc4f6b

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

include/pybind11/detail/common.h

+6
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@
5151
# define PYBIND11_DISABLE_WARNING_MSVC(name)
5252
#endif
5353

54+
#ifdef PYBIND11_COMPILER_CLANG
55+
# define PYBIND11_DISABLE_WARNING_CLANG(name) PYBIND11_PRAGMA(clang diagnostic push # name)
56+
#else
57+
# define PYBIND11_DISABLE_WARNING_CLANG(name)
58+
#endif
59+
5460
#ifdef PYBIND11_COMPILER_GCC
5561
# define PYBIND11_DISABLE_WARNING_GCC(name) PYBIND11_PRAGMA(GCC diagnostic ignored # name)
5662
#else

tests/test_constants_and_functions.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ int f2(int x) noexcept(true) { return x + 2; }
5454
int f3(int x) noexcept(false) { return x + 3; }
5555
PYBIND11_WARNING_PUSH
5656
PYBIND11_DISABLE_WARNING_GCC(-Wdeprecated)
57+
PYBIND11_DISABLE_WARNING_CLANG(-Wdeprecated)
5758
// NOLINTNEXTLINE(modernize-use-noexcept)
5859
int f4(int x) throw() { return x + 4; } // Deprecated equivalent to noexcept(true)
5960
PYBIND11_WARNING_POP
@@ -66,6 +67,7 @@ struct C {
6667
int m6(int x) const noexcept(false) { return x - 6; }
6768
PYBIND11_WARNING_PUSH
6869
PYBIND11_DISABLE_WARNING_GCC(-Wdeprecated)
70+
PYBIND11_DISABLE_WARNING_CLANG(-Wdeprecated)
6971
// NOLINTNEXTLINE(modernize-use-noexcept)
7072
int m7(int x) throw() { return x - 7; }
7173
// NOLINTNEXTLINE(modernize-use-noexcept)

0 commit comments

Comments
 (0)