|
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" |
59 | 62 | #elif defined(__clang__) && !defined(__apple_build_version__)
|
60 | 63 | # if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 3)
|
61 | 64 | # error pybind11 requires clang 3.3 or newer
|
|
96 | 99 | # endif
|
97 | 100 | #endif
|
98 | 101 |
|
| 102 | +// For CUDA, GCC7, GCC8 (and maybe some other platforms): |
| 103 | +// PYBIND11_NOINLINE_FORCED is incompatible with `-Wattributes -Werror`. |
| 104 | +// When defining PYBIND11_NOINLINE_FORCED, it is best to also use |
| 105 | +// `-Wno-attributes` (or not to use `-Werror` and ignore the warnings). |
| 106 | +#define PYBIND11_NOINLINE_FORCED |
| 107 | +#if !defined(PYBIND11_NOINLINE_FORCED) && \ |
| 108 | + (defined(__CUDACC__) || \ |
| 109 | + (defined(__GNUC__) && (__GNUC__ == 7 || __GNUC__ == 8))) |
| 110 | +# define PYBIND11_NOINLINE_DISABLED |
| 111 | +#endif |
| 112 | + |
99 | 113 | #if defined(PYBIND11_NOINLINE_DISABLED)
|
100 | 114 | # define PYBIND11_NOINLINE_DCL inline
|
101 | 115 | # define PYBIND11_NOINLINE_FWD inline
|
|
110 | 124 | # define PYBIND11_NOINLINE_FWD
|
111 | 125 | #endif
|
112 | 126 |
|
| 127 | +// DECISION TO BE MADE before this PR is merged: |
| 128 | +// ---------------------------------------------------------------------------- |
| 129 | +// This code and the 9 x 2 pragma blocks referring to |
| 130 | +// PYBIND11_NOINLINE_GCC_PRAGMA_ATTRIBUTES_NEEDED could be purged. |
| 131 | +// ---------------------------------------------------------------------------- |
113 | 132 | #if !defined(PYBIND11_NOINLINE_GCC_PRAGMA_ATTRIBUTES_NEEDED) && \
|
114 | 133 | !defined(PYBIND11_NOINLINE_DISABLED) && \
|
115 | 134 | (defined(__CUDACC__) || \
|
|
0 commit comments