Skip to content

Commit 73e2192

Browse files
committed
WIP stripping back
1 parent f8129d0 commit 73e2192

File tree

9 files changed

+18
-95
lines changed

9 files changed

+18
-95
lines changed

include/pybind11/attr.h

-9
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@
1212

1313
#include "cast.h"
1414

15-
#if defined(PYBIND11_NOINLINE_GCC_PRAGMA_ATTRIBUTES_NEEDED)
16-
# pragma GCC diagnostic push
17-
# pragma GCC diagnostic ignored "-Wattributes"
18-
#endif
19-
2015
PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
2116

2217
/// \addtogroup annotations
@@ -567,7 +562,3 @@ constexpr bool expected_num_args(size_t nargs, bool has_args, bool has_kwargs) {
567562

568563
PYBIND11_NAMESPACE_END(detail)
569564
PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE)
570-
571-
#if defined(PYBIND11_NOINLINE_GCC_PRAGMA_ATTRIBUTES_NEEDED)
572-
# pragma GCC diagnostic pop
573-
#endif

include/pybind11/detail/common.h

+3-21
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@
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"
5962
#elif defined(__clang__) && !defined(__apple_build_version__)
6063
# if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 3)
6164
# error pybind11 requires clang 3.3 or newer
@@ -107,18 +110,6 @@
107110
# define PYBIND11_NOINLINE __attribute__ ((noinline)) inline
108111
#endif
109112

110-
#if !defined(PYBIND11_NOINLINE_DISABLED)
111-
# if (defined(__CUDACC__) || (defined(__GNUC__) && (__GNUC__ == 7 || __GNUC__ == 8))) \
112-
&& !defined(PYBIND11_NOINLINE_GCC_PRAGMA_ATTRIBUTES_NEEDED)
113-
// Only CUDA version known/tested (as of August 2021): CUDA 11, Ubuntu 20.04
114-
# define PYBIND11_NOINLINE_GCC_PRAGMA_ATTRIBUTES_NEEDED
115-
# elif defined(__INTEL_COMPILER)
116-
// The following pragma cannot be pop'ed:
117-
// https://community.intel.com/t5/Intel-C-Compiler/Inline-and-no-inline-warning/td-p/1216764
118-
# pragma warning disable 2196 // warning #2196: routine is both "inline" and "noinline"
119-
# endif
120-
#endif
121-
122113
#if defined(__MINGW32__)
123114
// For unknown reasons all PYBIND11_DEPRECATED member trigger a warning when declared
124115
// whether it is used or not
@@ -388,11 +379,6 @@ extern "C" {
388379
} \
389380
void PYBIND11_CONCAT(pybind11_init_, name)(::pybind11::module_ & (variable))
390381

391-
#if defined(PYBIND11_NOINLINE_GCC_PRAGMA_ATTRIBUTES_NEEDED)
392-
# pragma GCC diagnostic push
393-
# pragma GCC diagnostic ignored "-Wattributes"
394-
#endif
395-
396382
PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
397383

398384
using ssize_t = Py_ssize_t;
@@ -979,7 +965,3 @@ constexpr inline bool silence_msvc_c4127(bool cond) { return cond; }
979965

980966
PYBIND11_NAMESPACE_END(detail)
981967
PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE)
982-
983-
#if defined(PYBIND11_NOINLINE_GCC_PRAGMA_ATTRIBUTES_NEEDED)
984-
# pragma GCC diagnostic pop
985-
#endif

include/pybind11/detail/internals.h

-9
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@
1111

1212
#include "../pytypes.h"
1313

14-
#if defined(PYBIND11_NOINLINE_GCC_PRAGMA_ATTRIBUTES_NEEDED)
15-
# pragma GCC diagnostic push
16-
# pragma GCC diagnostic ignored "-Wattributes"
17-
#endif
18-
1914
PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
2015

2116
using ExceptionTranslator = void (*)(std::exception_ptr);
@@ -385,7 +380,3 @@ T &get_or_create_shared_data(const std::string &name) {
385380
}
386381

387382
PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE)
388-
389-
#if defined(PYBIND11_NOINLINE_GCC_PRAGMA_ATTRIBUTES_NEEDED)
390-
# pragma GCC diagnostic pop
391-
#endif

include/pybind11/detail/type_caster_base.h

-9
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@
2525
#include <utility>
2626
#include <vector>
2727

28-
#if defined(PYBIND11_NOINLINE_GCC_PRAGMA_ATTRIBUTES_NEEDED)
29-
# pragma GCC diagnostic push
30-
# pragma GCC diagnostic ignored "-Wattributes"
31-
#endif
32-
3328
PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
3429
PYBIND11_NAMESPACE_BEGIN(detail)
3530

@@ -954,7 +949,3 @@ template <typename type> class type_caster_base : public type_caster_generic {
954949

955950
PYBIND11_NAMESPACE_END(detail)
956951
PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE)
957-
958-
#if defined(PYBIND11_NOINLINE_GCC_PRAGMA_ATTRIBUTES_NEEDED)
959-
# pragma GCC diagnostic pop
960-
#endif

include/pybind11/detail/typeid.h

-9
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@
1818

1919
#include "common.h"
2020

21-
#if defined(PYBIND11_NOINLINE_GCC_PRAGMA_ATTRIBUTES_NEEDED)
22-
# pragma GCC diagnostic push
23-
# pragma GCC diagnostic ignored "-Wattributes"
24-
#endif
25-
2621
PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
2722
PYBIND11_NAMESPACE_BEGIN(detail)
2823
/// Erase all occurrences of a substring
@@ -58,7 +53,3 @@ template <typename T> static std::string type_id() {
5853
}
5954

6055
PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE)
61-
62-
#if defined(PYBIND11_NOINLINE_GCC_PRAGMA_ATTRIBUTES_NEEDED)
63-
# pragma GCC diagnostic pop
64-
#endif

include/pybind11/gil.h

+1-9
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,9 @@
1212
#include "detail/common.h"
1313
#include "detail/internals.h"
1414

15-
#if defined(PYBIND11_NOINLINE_GCC_PRAGMA_ATTRIBUTES_NEEDED)
16-
# pragma GCC diagnostic push
17-
# pragma GCC diagnostic ignored "-Wattributes"
18-
#endif
19-
2015
PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
2116

17+
2218
PYBIND11_NAMESPACE_BEGIN(detail)
2319

2420
// forward declarations
@@ -195,7 +191,3 @@ class gil_scoped_release {
195191
#endif
196192

197193
PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE)
198-
199-
#if defined(PYBIND11_NOINLINE_GCC_PRAGMA_ATTRIBUTES_NEEDED)
200-
# pragma GCC diagnostic pop
201-
#endif

include/pybind11/numpy.h

-9
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@
3030
# pragma warning(disable: 4127) // warning C4127: Conditional expression is constant
3131
#endif
3232

33-
#if defined(PYBIND11_NOINLINE_GCC_PRAGMA_ATTRIBUTES_NEEDED)
34-
# pragma GCC diagnostic push
35-
# pragma GCC diagnostic ignored "-Wattributes"
36-
#endif
37-
3833
/* This will be true on all flat address space platforms and allows us to reduce the
3934
whole npy_intp / ssize_t / Py_intptr_t business down to just ssize_t for all size
4035
and dimension types (e.g. shape, strides, indexing), instead of inflicting this
@@ -1711,10 +1706,6 @@ Helper vectorize(Return (Class::*f)(Args...) const) {
17111706

17121707
PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE)
17131708

1714-
#if defined(PYBIND11_NOINLINE_GCC_PRAGMA_ATTRIBUTES_NEEDED)
1715-
# pragma GCC diagnostic pop
1716-
#endif
1717-
17181709
#if defined(_MSC_VER)
17191710
#pragma warning(pop)
17201711
#endif

include/pybind11/pybind11.h

+10-9
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010

1111
#pragma once
1212

13+
#if defined(__GNUG__) && !defined(__clang__) && !defined(__INTEL_COMPILER)
14+
# pragma GCC diagnostic push
15+
# pragma GCC diagnostic ignored "-Wattributes"
16+
#endif
17+
1318
#include "attr.h"
1419
#include "gil.h"
1520
#include "options.h"
@@ -47,11 +52,6 @@
4752
# pragma GCC diagnostic ignored "-Wnoexcept-type"
4853
#endif
4954

50-
#if defined(PYBIND11_NOINLINE_GCC_PRAGMA_ATTRIBUTES_NEEDED)
51-
# pragma GCC diagnostic push
52-
# pragma GCC diagnostic ignored "-Wattributes"
53-
#endif
54-
5555
PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
5656

5757
PYBIND11_NAMESPACE_BEGIN(detail)
@@ -1874,6 +1874,7 @@ template <typename Type> class enum_ : public class_<Type> {
18741874

18751875
PYBIND11_NAMESPACE_BEGIN(detail)
18761876

1877+
18771878
PYBIND11_NOINLINE void keep_alive_impl(handle nurse, handle patient) {
18781879
if (!nurse || !patient)
18791880
pybind11_fail("Could not activate keep_alive!");
@@ -2379,10 +2380,10 @@ inline function get_overload(const T *this_ptr, const char *name) {
23792380

23802381
PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE)
23812382

2382-
#if defined(PYBIND11_NOINLINE_GCC_PRAGMA_ATTRIBUTES_NEEDED)
2383-
# pragma GCC diagnostic pop
2384-
#endif
2385-
23862383
#if defined(__GNUC__) && __GNUC__ == 7
23872384
# pragma GCC diagnostic pop // -Wnoexcept-type
23882385
#endif
2386+
2387+
#if defined(__GNUG__) && !defined(__clang__) && !defined(__INTEL_COMPILER)
2388+
# pragma GCC diagnostic pop
2389+
#endif

include/pybind11/pytypes.h

+4-11
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@
1414
#include <utility>
1515
#include <type_traits>
1616

17-
#if defined(PYBIND11_NOINLINE_GCC_PRAGMA_ATTRIBUTES_NEEDED)
18-
# pragma GCC diagnostic push
19-
# pragma GCC diagnostic ignored "-Wattributes"
20-
#endif
21-
2217
PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
2318

2419
/* A few forward declarations */
@@ -28,10 +23,8 @@ class type;
2823
struct arg; struct arg_v;
2924

3025
PYBIND11_NAMESPACE_BEGIN(detail)
31-
3226
class args_proxy;
3327
bool isinstance_generic(handle obj, const std::type_info &tp);
34-
std::string error_string();
3528

3629
// Accessor forward declarations
3730
template <typename Policy> class accessor;
@@ -322,6 +315,10 @@ template <typename T> T reinterpret_borrow(handle h) { return {h, object::borrow
322315
\endrst */
323316
template <typename T> T reinterpret_steal(handle h) { return {h, object::stolen_t{}}; }
324317

318+
PYBIND11_NAMESPACE_BEGIN(detail)
319+
std::string error_string();
320+
PYBIND11_NAMESPACE_END(detail)
321+
325322
#if defined(_MSC_VER)
326323
# pragma warning(push)
327324
# pragma warning(disable: 4275 4251) // warning C4275: An exported class was derived from a class that wasn't exported. Can be ignored when derived from a STL class.
@@ -1766,7 +1763,3 @@ PYBIND11_MATH_OPERATOR_BINARY(operator>>=, PyNumber_InPlaceRshift)
17661763

17671764
PYBIND11_NAMESPACE_END(detail)
17681765
PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE)
1769-
1770-
#if defined(PYBIND11_NOINLINE_GCC_PRAGMA_ATTRIBUTES_NEEDED)
1771-
# pragma GCC diagnostic pop
1772-
#endif

0 commit comments

Comments
 (0)