Skip to content

Commit 2bb63d0

Browse files
committed
Moving large pragma warning block from pybind11.h to detail/common.h (fixes MSVC and GCC failures after iwyu cleanup under PR #2672).
1 parent 74a767d commit 2bb63d0

File tree

2 files changed

+32
-32
lines changed

2 files changed

+32
-32
lines changed

include/pybind11/detail/common.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,38 @@
1313
#define PYBIND11_VERSION_MINOR 6
1414
#define PYBIND11_VERSION_PATCH 3.dev1
1515

16+
#if defined(__INTEL_COMPILER)
17+
# pragma warning push
18+
# pragma warning disable 68 // integer conversion resulted in a change of sign
19+
# pragma warning disable 186 // pointless comparison of unsigned integer with zero
20+
# pragma warning disable 878 // incompatible exception specifications
21+
# pragma warning disable 1334 // the "template" keyword used for syntactic disambiguation may only be used within a template
22+
# pragma warning disable 1682 // implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
23+
# pragma warning disable 1786 // function "strdup" was declared deprecated
24+
# pragma warning disable 1875 // offsetof applied to non-POD (Plain Old Data) types is nonstandard
25+
# pragma warning disable 2196 // warning #2196: routine is both "inline" and "noinline"
26+
#elif defined(_MSC_VER)
27+
# pragma warning(push)
28+
# pragma warning(disable: 4100) // warning C4100: Unreferenced formal parameter
29+
# pragma warning(disable: 4127) // warning C4127: Conditional expression is constant
30+
# pragma warning(disable: 4512) // warning C4512: Assignment operator was implicitly defined as deleted
31+
# pragma warning(disable: 4800) // warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning)
32+
# pragma warning(disable: 4996) // warning C4996: The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name
33+
# pragma warning(disable: 4702) // warning C4702: unreachable code
34+
# pragma warning(disable: 4522) // warning C4522: multiple assignment operators specified
35+
# pragma warning(disable: 4505) // warning C4505: 'PySlice_GetIndicesEx': unreferenced local function has been removed (PyPy only)
36+
#elif defined(__GNUG__) && !defined(__clang__)
37+
# pragma GCC diagnostic push
38+
# pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
39+
# pragma GCC diagnostic ignored "-Wunused-but-set-variable"
40+
# pragma GCC diagnostic ignored "-Wmissing-field-initializers"
41+
# pragma GCC diagnostic ignored "-Wstrict-aliasing"
42+
# pragma GCC diagnostic ignored "-Wattributes"
43+
# if __GNUC__ >= 7
44+
# pragma GCC diagnostic ignored "-Wnoexcept-type"
45+
# endif
46+
#endif
47+
1648
#define PYBIND11_NAMESPACE_BEGIN(name) namespace name {
1749
#define PYBIND11_NAMESPACE_END(name) }
1850

include/pybind11/pybind11.h

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -10,38 +10,6 @@
1010

1111
#pragma once
1212

13-
#if defined(__INTEL_COMPILER)
14-
# pragma warning push
15-
# pragma warning disable 68 // integer conversion resulted in a change of sign
16-
# pragma warning disable 186 // pointless comparison of unsigned integer with zero
17-
# pragma warning disable 878 // incompatible exception specifications
18-
# pragma warning disable 1334 // the "template" keyword used for syntactic disambiguation may only be used within a template
19-
# pragma warning disable 1682 // implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
20-
# pragma warning disable 1786 // function "strdup" was declared deprecated
21-
# pragma warning disable 1875 // offsetof applied to non-POD (Plain Old Data) types is nonstandard
22-
# pragma warning disable 2196 // warning #2196: routine is both "inline" and "noinline"
23-
#elif defined(_MSC_VER)
24-
# pragma warning(push)
25-
# pragma warning(disable: 4100) // warning C4100: Unreferenced formal parameter
26-
# pragma warning(disable: 4127) // warning C4127: Conditional expression is constant
27-
# pragma warning(disable: 4512) // warning C4512: Assignment operator was implicitly defined as deleted
28-
# pragma warning(disable: 4800) // warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning)
29-
# pragma warning(disable: 4996) // warning C4996: The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name
30-
# pragma warning(disable: 4702) // warning C4702: unreachable code
31-
# pragma warning(disable: 4522) // warning C4522: multiple assignment operators specified
32-
# pragma warning(disable: 4505) // warning C4505: 'PySlice_GetIndicesEx': unreferenced local function has been removed (PyPy only)
33-
#elif defined(__GNUG__) && !defined(__clang__)
34-
# pragma GCC diagnostic push
35-
# pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
36-
# pragma GCC diagnostic ignored "-Wunused-but-set-variable"
37-
# pragma GCC diagnostic ignored "-Wmissing-field-initializers"
38-
# pragma GCC diagnostic ignored "-Wstrict-aliasing"
39-
# pragma GCC diagnostic ignored "-Wattributes"
40-
# if __GNUC__ >= 7
41-
# pragma GCC diagnostic ignored "-Wnoexcept-type"
42-
# endif
43-
#endif
44-
4513
#include "attr.h"
4614
#include "gil.h"
4715
#include "options.h"

0 commit comments

Comments
 (0)