Skip to content

Commit 2164c2e

Browse files
authored
Removing __INTEL_COMPILER section from pragma block at the top of pybind11.h (#3135)
* Fixing `pragma warning pop` for `__INTEL_COMPILER`. * Adding push/pop to 3 tests. Removing #878 from top of pybind11.h (it was/is only needed for 1 test). * Trying again after CI failure, moving the push to the top of 2 tests. * Trying more after CI failure, adding push/pop to pybind11_tests.h, constructor_stats.h. * Moving ICC #2196 suppression to CMakeLists.txt * Fixing condition for `pragma GCC diagnostic push` in pybind11.h * Moving `pragma warning disable 2196` to common.h * Revising #ifdef to be more conservative. * Undoing insertion of notes that will hopefully soon be completely obsolete anyway.
1 parent 9beaa92 commit 2164c2e

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

include/pybind11/detail/common.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@
5656
# elif __INTEL_COMPILER < 1900 && defined(PYBIND11_CPP14)
5757
# error pybind11 supports only C++11 with Intel C++ compiler v18. Use v19 or newer for C++14.
5858
# endif
59+
/* The following pragma cannot be pop'ed:
60+
https://community.intel.com/t5/Intel-C-Compiler/Inline-and-no-inline-warning/td-p/1216764 */
61+
# pragma warning disable 2196 // warning #2196: routine is both "inline" and "noinline"
5962
#elif defined(__clang__) && !defined(__apple_build_version__)
6063
# if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 3)
6164
# error pybind11 requires clang 3.3 or newer

include/pybind11/pybind11.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,12 @@
1010

1111
#pragma once
1212

13-
#if defined(__INTEL_COMPILER)
14-
# pragma warning push
15-
# pragma warning disable 878 // incompatible exception specifications
16-
# pragma warning disable 2196 // warning #2196: routine is both "inline" and "noinline"
17-
#elif defined(_MSC_VER)
13+
#if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
1814
# pragma warning(push)
1915
# pragma warning(disable: 4100) // warning C4100: Unreferenced formal parameter
2016
# pragma warning(disable: 4127) // warning C4127: Conditional expression is constant
2117
# pragma warning(disable: 4505) // warning C4505: 'PySlice_GetIndicesEx': unreferenced local function has been removed (PyPy only)
22-
#elif defined(__GNUG__) && !defined(__clang__)
18+
#elif defined(__GNUG__) && !defined(__clang__) && !defined(__INTEL_COMPILER)
2319
# pragma GCC diagnostic push
2420
# pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
2521
# pragma GCC diagnostic ignored "-Wattributes"

tests/test_constants_and_functions.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,14 @@ TEST_SUBMODULE(constants_and_functions, m) {
133133
;
134134
m.def("f1", f1);
135135
m.def("f2", f2);
136+
#if defined(__INTEL_COMPILER)
137+
# pragma warning push
138+
# pragma warning disable 878 // incompatible exception specifications
139+
#endif
136140
m.def("f3", f3);
141+
#if defined(__INTEL_COMPILER)
142+
# pragma warning pop
143+
#endif
137144
m.def("f4", f4);
138145

139146
// test_function_record_leaks

0 commit comments

Comments
 (0)