|
56 | 56 | # elif __INTEL_COMPILER < 1900 && defined(PYBIND11_CPP14)
|
57 | 57 | # error pybind11 supports only C++11 with Intel C++ compiler v18. Use v19 or newer for C++14.
|
58 | 58 | # 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" |
62 | 59 | #elif defined(__clang__) && !defined(__apple_build_version__)
|
63 | 60 | # if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 3)
|
64 | 61 | # error pybind11 requires clang 3.3 or newer
|
|
99 | 96 | # endif
|
100 | 97 | #endif
|
101 | 98 |
|
| 99 | +#define PYBIND11_NOINLINE_DISABLED |
| 100 | + |
102 | 101 | // For CUDA, GCC7, GCC8 (and maybe some other platforms):
|
103 | 102 | // PYBIND11_NOINLINE_FORCED is incompatible with `-Wattributes -Werror`.
|
104 | 103 | // When defining PYBIND11_NOINLINE_FORCED, it is best to also use
|
|
109 | 108 | # define PYBIND11_NOINLINE_DISABLED
|
110 | 109 | #endif
|
111 | 110 |
|
112 |
| -// Note: Forward declaration should never be `inline`: |
| 111 | +// Note: Forward declarations should never be `inline`: |
113 | 112 | // https://stackoverflow.com/questions/9317473/forward-declaration-of-inline-functions
|
114 | 113 | #if defined(PYBIND11_NOINLINE_DISABLED)
|
115 | 114 | # define PYBIND11_NOINLINE inline
|
|
124 | 123 | // This code and the 9 x 2 pragma blocks referring to
|
125 | 124 | // PYBIND11_NOINLINE_GCC_PRAGMA_ATTRIBUTES_NEEDED could be purged.
|
126 | 125 | // ----------------------------------------------------------------------------
|
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 |
132 | 135 | #endif
|
133 | 136 |
|
134 | 137 | #if defined(__MINGW32__)
|
|
0 commit comments