Skip to content

Commit f8129d0

Browse files
committed
Removing PYBIND11_NOINLINE_FORCED and enhancing comments for PYBIND11_NOINLINE.
1 parent b85972e commit f8129d0

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

include/pybind11/detail/common.h

+4-17
Original file line numberDiff line numberDiff line change
@@ -96,34 +96,21 @@
9696
# endif
9797
#endif
9898

99-
// For CUDA, GCC7, GCC8 (and maybe some other platforms):
100-
// PYBIND11_NOINLINE_FORCED is incompatible with `-Wattributes -Werror`.
101-
// When defining PYBIND11_NOINLINE_FORCED, it is best to also use
102-
// `-Wno-attributes` (or not to use `-Werror` and ignore the warnings).
103-
#if !defined(PYBIND11_NOINLINE_FORCED) && \
104-
(defined(__CUDACC__) || \
105-
(defined(__GNUC__) && (__GNUC__ == 7 || __GNUC__ == 8)))
106-
# define PYBIND11_NOINLINE_DISABLED
107-
#endif
108-
109-
// Note: Forward declarations should never be `inline`:
99+
// The PYBIND11_NOINLINE macro is for function DEFINITIONS.
100+
// In contrast, FORWARD DECLARATIONS should never use this macro:
110101
// https://stackoverflow.com/questions/9317473/forward-declaration-of-inline-functions
111-
#if defined(PYBIND11_NOINLINE_DISABLED)
102+
#if defined(PYBIND11_NOINLINE_DISABLED) // Option for maximum portability and experimentation.
112103
# define PYBIND11_NOINLINE inline
113104
#elif defined(_MSC_VER)
114105
# define PYBIND11_NOINLINE __declspec(noinline) inline
115106
#else
116107
# define PYBIND11_NOINLINE __attribute__ ((noinline)) inline
117108
#endif
118109

119-
// DECISION TO BE MADE before this PR is merged:
120-
// ----------------------------------------------------------------------------
121-
// This code and the 9 x 2 pragma blocks referring to
122-
// PYBIND11_NOINLINE_GCC_PRAGMA_ATTRIBUTES_NEEDED could be purged.
123-
// ----------------------------------------------------------------------------
124110
#if !defined(PYBIND11_NOINLINE_DISABLED)
125111
# if (defined(__CUDACC__) || (defined(__GNUC__) && (__GNUC__ == 7 || __GNUC__ == 8))) \
126112
&& !defined(PYBIND11_NOINLINE_GCC_PRAGMA_ATTRIBUTES_NEEDED)
113+
// Only CUDA version known/tested (as of August 2021): CUDA 11, Ubuntu 20.04
127114
# define PYBIND11_NOINLINE_GCC_PRAGMA_ATTRIBUTES_NEEDED
128115
# elif defined(__INTEL_COMPILER)
129116
// The following pragma cannot be pop'ed:

0 commit comments

Comments
 (0)