Skip to content

Commit 4b9e352

Browse files
committed
Testing with PYBIND11_NOINLINE_DISABLED. Minor non-functional enhancements.
1 parent cbbf839 commit 4b9e352

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

include/pybind11/detail/common.h

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@
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"
6259
#elif defined(__clang__) && !defined(__apple_build_version__)
6360
# if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 3)
6461
# error pybind11 requires clang 3.3 or newer
@@ -99,6 +96,8 @@
9996
# endif
10097
#endif
10198

99+
#define PYBIND11_NOINLINE_DISABLED
100+
102101
// For CUDA, GCC7, GCC8 (and maybe some other platforms):
103102
// PYBIND11_NOINLINE_FORCED is incompatible with `-Wattributes -Werror`.
104103
// When defining PYBIND11_NOINLINE_FORCED, it is best to also use
@@ -109,7 +108,7 @@
109108
# define PYBIND11_NOINLINE_DISABLED
110109
#endif
111110

112-
// Note: Forward declaration should never be `inline`:
111+
// Note: Forward declarations should never be `inline`:
113112
// https://stackoverflow.com/questions/9317473/forward-declaration-of-inline-functions
114113
#if defined(PYBIND11_NOINLINE_DISABLED)
115114
# define PYBIND11_NOINLINE inline
@@ -124,11 +123,15 @@
124123
// This code and the 9 x 2 pragma blocks referring to
125124
// PYBIND11_NOINLINE_GCC_PRAGMA_ATTRIBUTES_NEEDED could be purged.
126125
// ----------------------------------------------------------------------------
127-
#if !defined(PYBIND11_NOINLINE_GCC_PRAGMA_ATTRIBUTES_NEEDED) && \
128-
!defined(PYBIND11_NOINLINE_DISABLED) && \
129-
(defined(__CUDACC__) || \
130-
(defined(__GNUC__) && (__GNUC__ == 7 || __GNUC__ == 8)))
131-
# define PYBIND11_NOINLINE_GCC_PRAGMA_ATTRIBUTES_NEEDED
126+
#if !defined(PYBIND11_NOINLINE_DISABLED)
127+
# if (defined(__CUDACC__) || (defined(__GNUC__) && (__GNUC__ == 7 || __GNUC__ == 8))) \
128+
&& !defined(PYBIND11_NOINLINE_GCC_PRAGMA_ATTRIBUTES_NEEDED)
129+
# define PYBIND11_NOINLINE_GCC_PRAGMA_ATTRIBUTES_NEEDED
130+
# elif defined(__INTEL_COMPILER)
131+
// The following pragma cannot be pop'ed:
132+
// https://community.intel.com/t5/Intel-C-Compiler/Inline-and-no-inline-warning/td-p/1216764
133+
# pragma warning disable 2196 // warning #2196: routine is both "inline" and "noinline"
134+
# endif
132135
#endif
133136

134137
#if defined(__MINGW32__)

0 commit comments

Comments
 (0)