Skip to content

Commit 42db2f7

Browse files
committed
Removing last remnants of pragma block at the top of pybind11.h, defaulting CUDA, GCC7, GCC8 to PYBIND11_NOINLINE_DISABLED, with the option to define PYBIND11_NOINLINE_FORCED.
1 parent 4c7e509 commit 42db2f7

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

include/pybind11/detail/common.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,14 @@
9999
# endif
100100
#endif
101101

102+
// For CUDA, GCC7, GCC8:
103+
// PYBIND11_NOINLINE_FORCED is incompatible with `-Wattributes -Werror`.
104+
// When defining PYBIND11_NOINLINE_FORCED, it is best to also use `-Wno-attributes`.
105+
#if !defined(PYBIND11_NOINLINE_FORCED) && \
106+
(defined(__CUDACC__) || (defined(__GNUC__) && (__GNUC__ == 7 || __GNUC__ == 8)))
107+
# define PYBIND11_NOINLINE_DISABLED
108+
#endif
109+
102110
// The PYBIND11_NOINLINE macro is for function DEFINITIONS.
103111
// In contrast, FORWARD DECLARATIONS should never use this macro:
104112
// https://stackoverflow.com/questions/9317473/forward-declaration-of-inline-functions

include/pybind11/pybind11.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@
1010

1111
#pragma once
1212

13-
#if defined(__CUDACC__) || (defined(__GNUC__) && (__GNUC__ == 7 || __GNUC__ == 8))
14-
# pragma GCC diagnostic push
15-
# pragma GCC diagnostic ignored "-Wattributes"
16-
#endif
17-
1813
#include "attr.h"
1914
#include "gil.h"
2015
#include "options.h"
@@ -2383,7 +2378,3 @@ PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE)
23832378
#if defined(__GNUC__) && __GNUC__ == 7
23842379
# pragma GCC diagnostic pop // -Wnoexcept-type
23852380
#endif
2386-
2387-
#if defined(__CUDACC__) || (defined(__GNUC__) && (__GNUC__ == 7 || __GNUC__ == 8))
2388-
# pragma GCC diagnostic pop
2389-
#endif

0 commit comments

Comments
 (0)