Skip to content

Commit 81da988

Browse files
Baljakwjakob
authored andcommitted
Fix Intel C++ compiler warning on Windows (#1608)
1 parent 6420514 commit 81da988

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

include/pybind11/pybind11.h

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,17 @@
1010

1111
#pragma once
1212

13-
#if defined(_MSC_VER)
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)
1424
# pragma warning(push)
1525
# pragma warning(disable: 4100) // warning C4100: Unreferenced formal parameter
1626
# pragma warning(disable: 4127) // warning C4127: Conditional expression is constant
@@ -19,15 +29,6 @@
1929
# pragma warning(disable: 4996) // warning C4996: The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name
2030
# pragma warning(disable: 4702) // warning C4702: unreachable code
2131
# pragma warning(disable: 4522) // warning C4522: multiple assignment operators specified
22-
#elif defined(__INTEL_COMPILER)
23-
# pragma warning(push)
24-
# pragma warning(disable: 68) // integer conversion resulted in a change of sign
25-
# pragma warning(disable: 186) // pointless comparison of unsigned integer with zero
26-
# pragma warning(disable: 878) // incompatible exception specifications
27-
# pragma warning(disable: 1334) // the "template" keyword used for syntactic disambiguation may only be used within a template
28-
# pragma warning(disable: 1682) // implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
29-
# pragma warning(disable: 1875) // offsetof applied to non-POD (Plain Old Data) types is nonstandard
30-
# pragma warning(disable: 2196) // warning #2196: routine is both "inline" and "noinline"
3132
#elif defined(__GNUG__) && !defined(__clang__)
3233
# pragma GCC diagnostic push
3334
# pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
@@ -2077,10 +2078,8 @@ template <class T> function get_overload(const T *this_ptr, const char *name) {
20772078

20782079
NAMESPACE_END(PYBIND11_NAMESPACE)
20792080

2080-
#if defined(_MSC_VER)
2081+
#if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
20812082
# pragma warning(pop)
2082-
#elif defined(__INTEL_COMPILER)
2083-
/* Leave ignored warnings on */
20842083
#elif defined(__GNUG__) && !defined(__clang__)
20852084
# pragma GCC diagnostic pop
20862085
#endif

0 commit comments

Comments
 (0)