From 66b62f12b8be4024a5d1feaf2ee7a3cedd2a5c6e Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Mon, 9 Aug 2021 12:03:27 -0700 Subject: [PATCH 01/17] 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. --- include/pybind11/detail/common.h | 8 ++++++++ include/pybind11/pybind11.h | 9 --------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/include/pybind11/detail/common.h b/include/pybind11/detail/common.h index cc24a52fd3..ab9834cdfc 100644 --- a/include/pybind11/detail/common.h +++ b/include/pybind11/detail/common.h @@ -99,6 +99,14 @@ # endif #endif +// For CUDA, GCC7, GCC8: +// PYBIND11_NOINLINE_FORCED is incompatible with `-Wattributes -Werror`. +// When defining PYBIND11_NOINLINE_FORCED, it is best to also use `-Wno-attributes`. +#if !defined(PYBIND11_NOINLINE_FORCED) && \ + (defined(__CUDACC__) || (defined(__GNUC__) && (__GNUC__ == 7 || __GNUC__ == 8))) +# define PYBIND11_NOINLINE_DISABLED +#endif + // The PYBIND11_NOINLINE macro is for function DEFINITIONS. // In contrast, FORWARD DECLARATIONS should never use this macro: // https://stackoverflow.com/questions/9317473/forward-declaration-of-inline-functions diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index 20df6a01fd..7b7b3ca71f 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -10,11 +10,6 @@ #pragma once -#if defined(__CUDACC__) || (defined(__GNUC__) && (__GNUC__ == 7 || __GNUC__ == 8)) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wattributes" -#endif - #include "attr.h" #include "gil.h" #include "options.h" @@ -2383,7 +2378,3 @@ PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE) #if defined(__GNUC__) && __GNUC__ == 7 # pragma GCC diagnostic pop // -Wnoexcept-type #endif - -#if defined(__CUDACC__) || (defined(__GNUC__) && (__GNUC__ == 7 || __GNUC__ == 8)) -# pragma GCC diagnostic pop -#endif From c75c325d4b26c28bf2441b328c9fcd0dc733a3d6 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 11 Aug 2021 15:39:09 -0700 Subject: [PATCH 02/17] Unique SOSIZE prefix to make it easier to extract the sosizes from the GitHub logs. --- tests/test_class.py | 6 ++++++ tools/libsize.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/test_class.py b/tests/test_class.py index 1ff60fe214..42eff5e0f8 100644 --- a/tests/test_class.py +++ b/tests/test_class.py @@ -11,6 +11,12 @@ def test_repr(): # In Python 3.3+, repr() accesses __qualname__ assert "pybind11_type" in repr(type(UserType)) assert "UserType" in repr(UserType) + import weakref + u = UserType(0) + w = weakref.ref(u) + assert w() is not None + del u + assert w() is None def test_instance(msg): diff --git a/tools/libsize.py b/tools/libsize.py index 589c317f0d..6e15266c64 100644 --- a/tools/libsize.py +++ b/tools/libsize.py @@ -19,7 +19,7 @@ libsize = os.path.getsize(lib) -print("------", os.path.basename(lib), "file size:", libsize, end="") +print("SOSIZE:", os.path.basename(lib), libsize, end="") if os.path.exists(save): with open(save) as sf: From 5a7bd10d119cba59f2fa4ceee767d4d279f3aa69 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 11 Aug 2021 15:43:17 -0700 Subject: [PATCH 03/17] Commenting out PYBIND11_WERROR block, for noinline testing. --- tests/CMakeLists.txt | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index d71a51e6a0..2570b07177 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -298,22 +298,22 @@ function(pybind11_enable_warnings target_name) -Wnon-virtual-dtor) endif() - if(PYBIND11_WERROR) - if(MSVC) - target_compile_options(${target_name} PRIVATE /WX) - elseif(PYBIND11_CUDA_TESTS) - target_compile_options(${target_name} PRIVATE "SHELL:-Werror all-warnings") - elseif(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang|IntelLLVM)") - target_compile_options(${target_name} PRIVATE -Werror) - elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - target_compile_options( - ${target_name} - PRIVATE - -Werror-all - # "Inlining inhibited by limit max-size", "Inlining inhibited by limit max-total-size" - -diag-disable 11074,11076) - endif() - endif() + #if(PYBIND11_WERROR) + # if(MSVC) + # target_compile_options(${target_name} PRIVATE /WX) + # elseif(PYBIND11_CUDA_TESTS) + # target_compile_options(${target_name} PRIVATE "SHELL:-Werror all-warnings") + # elseif(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang|IntelLLVM)") + # target_compile_options(${target_name} PRIVATE -Werror) + # elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + # target_compile_options( + # ${target_name} + # PRIVATE + # -Werror-all + # # "Inlining inhibited by limit max-size", "Inlining inhibited by limit max-total-size" + # -diag-disable 11074,11076) + # endif() + #endif() # Needs to be re-added since the ordering requires these to be after the ones above if(CMAKE_CXX_STANDARD From aca0e20c5991b9d85ea91835367b91e3fb86c627 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 11 Aug 2021 15:57:55 -0700 Subject: [PATCH 04/17] Undoing accidental change. --- tests/test_class.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/test_class.py b/tests/test_class.py index 42eff5e0f8..1ff60fe214 100644 --- a/tests/test_class.py +++ b/tests/test_class.py @@ -11,12 +11,6 @@ def test_repr(): # In Python 3.3+, repr() accesses __qualname__ assert "pybind11_type" in repr(type(UserType)) assert "UserType" in repr(UserType) - import weakref - u = UserType(0) - w = weakref.ref(u) - assert w() is not None - del u - assert w() is None def test_instance(msg): From d7606467daa4039af6a361c24ea0608cb5612d9f Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 11 Aug 2021 16:08:39 -0700 Subject: [PATCH 05/17] `#define PYBIND11_NOINLINE_FORCED` --- include/pybind11/detail/common.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/pybind11/detail/common.h b/include/pybind11/detail/common.h index ab9834cdfc..065daa8536 100644 --- a/include/pybind11/detail/common.h +++ b/include/pybind11/detail/common.h @@ -99,6 +99,7 @@ # endif #endif +#define PYBIND11_NOINLINE_FORCED // For CUDA, GCC7, GCC8: // PYBIND11_NOINLINE_FORCED is incompatible with `-Wattributes -Werror`. // When defining PYBIND11_NOINLINE_FORCED, it is best to also use `-Wno-attributes`. From 4e57e6acd712828850ef7b5050d45797bd9ab994 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 11 Aug 2021 22:45:10 +0000 Subject: [PATCH 06/17] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/test_class.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/test_class.py b/tests/test_class.py index 1ff60fe214..931d50210b 100644 --- a/tests/test_class.py +++ b/tests/test_class.py @@ -11,6 +11,13 @@ def test_repr(): # In Python 3.3+, repr() accesses __qualname__ assert "pybind11_type" in repr(type(UserType)) assert "UserType" in repr(UserType) + import weakref + + u = UserType(0) + w = weakref.ref(u) + assert w() is not None + del u + assert w() is None def test_instance(msg): From bfa47b31f2cec604b0d852dcbba4c25d32dddf54 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 11 Aug 2021 16:46:42 -0700 Subject: [PATCH 07/17] `#define PYBIND11_NOINLINE_DISABLED` --- include/pybind11/detail/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/pybind11/detail/common.h b/include/pybind11/detail/common.h index 065daa8536..5f55a50888 100644 --- a/include/pybind11/detail/common.h +++ b/include/pybind11/detail/common.h @@ -99,7 +99,7 @@ # endif #endif -#define PYBIND11_NOINLINE_FORCED +#define PYBIND11_NOINLINE_DISABLED // For CUDA, GCC7, GCC8: // PYBIND11_NOINLINE_FORCED is incompatible with `-Wattributes -Werror`. // When defining PYBIND11_NOINLINE_FORCED, it is best to also use `-Wno-attributes`. From 114cf66e079a2207c17d2037f1e4a6498d6d10cc Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Thu, 12 Aug 2021 06:29:40 -0700 Subject: [PATCH 08/17] Going back to default (removing `#define PYBIND11_NOINLINE_DISABLED`). --- include/pybind11/detail/common.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/pybind11/detail/common.h b/include/pybind11/detail/common.h index 5f55a50888..ab9834cdfc 100644 --- a/include/pybind11/detail/common.h +++ b/include/pybind11/detail/common.h @@ -99,7 +99,6 @@ # endif #endif -#define PYBIND11_NOINLINE_DISABLED // For CUDA, GCC7, GCC8: // PYBIND11_NOINLINE_FORCED is incompatible with `-Wattributes -Werror`. // When defining PYBIND11_NOINLINE_FORCED, it is best to also use `-Wno-attributes`. From e043cca38eba7b7f03cdf773108142349ce392c3 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Thu, 12 Aug 2021 08:31:55 -0700 Subject: [PATCH 09/17] `#define PYBIND11_NOINLINE_FORCED` --- include/pybind11/detail/common.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/pybind11/detail/common.h b/include/pybind11/detail/common.h index ab9834cdfc..065daa8536 100644 --- a/include/pybind11/detail/common.h +++ b/include/pybind11/detail/common.h @@ -99,6 +99,7 @@ # endif #endif +#define PYBIND11_NOINLINE_FORCED // For CUDA, GCC7, GCC8: // PYBIND11_NOINLINE_FORCED is incompatible with `-Wattributes -Werror`. // When defining PYBIND11_NOINLINE_FORCED, it is best to also use `-Wno-attributes`. From 12600e81c70189b08bc53ac4bdc1fbc7f15e46d8 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Thu, 12 Aug 2021 09:00:35 -0700 Subject: [PATCH 10/17] Undoing all changes releated to measuring sosizes. --- .github/workflows/ci.yml | 2 +- include/pybind11/detail/common.h | 1 - tests/CMakeLists.txt | 32 ++++++++++++++++---------------- tools/libsize.py | 2 +- 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e1c32b96f0..362cfe9259 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -600,7 +600,7 @@ jobs: # apparently when the gcc version changed from 8.3 to 8.4. - name: VAR_BUILD_TYPE 8 if: matrix.centos == 8 - run: echo Release > VAR_BUILD_TYPE + run: echo Debug > VAR_BUILD_TYPE - name: Configure shell: bash diff --git a/include/pybind11/detail/common.h b/include/pybind11/detail/common.h index 065daa8536..ab9834cdfc 100644 --- a/include/pybind11/detail/common.h +++ b/include/pybind11/detail/common.h @@ -99,7 +99,6 @@ # endif #endif -#define PYBIND11_NOINLINE_FORCED // For CUDA, GCC7, GCC8: // PYBIND11_NOINLINE_FORCED is incompatible with `-Wattributes -Werror`. // When defining PYBIND11_NOINLINE_FORCED, it is best to also use `-Wno-attributes`. diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 2570b07177..d71a51e6a0 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -298,22 +298,22 @@ function(pybind11_enable_warnings target_name) -Wnon-virtual-dtor) endif() - #if(PYBIND11_WERROR) - # if(MSVC) - # target_compile_options(${target_name} PRIVATE /WX) - # elseif(PYBIND11_CUDA_TESTS) - # target_compile_options(${target_name} PRIVATE "SHELL:-Werror all-warnings") - # elseif(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang|IntelLLVM)") - # target_compile_options(${target_name} PRIVATE -Werror) - # elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - # target_compile_options( - # ${target_name} - # PRIVATE - # -Werror-all - # # "Inlining inhibited by limit max-size", "Inlining inhibited by limit max-total-size" - # -diag-disable 11074,11076) - # endif() - #endif() + if(PYBIND11_WERROR) + if(MSVC) + target_compile_options(${target_name} PRIVATE /WX) + elseif(PYBIND11_CUDA_TESTS) + target_compile_options(${target_name} PRIVATE "SHELL:-Werror all-warnings") + elseif(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang|IntelLLVM)") + target_compile_options(${target_name} PRIVATE -Werror) + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + target_compile_options( + ${target_name} + PRIVATE + -Werror-all + # "Inlining inhibited by limit max-size", "Inlining inhibited by limit max-total-size" + -diag-disable 11074,11076) + endif() + endif() # Needs to be re-added since the ordering requires these to be after the ones above if(CMAKE_CXX_STANDARD diff --git a/tools/libsize.py b/tools/libsize.py index 6e15266c64..589c317f0d 100644 --- a/tools/libsize.py +++ b/tools/libsize.py @@ -19,7 +19,7 @@ libsize = os.path.getsize(lib) -print("SOSIZE:", os.path.basename(lib), libsize, end="") +print("------", os.path.basename(lib), "file size:", libsize, end="") if os.path.exists(save): with open(save) as sf: From 86bb2a877457dfaec270a692fd552fa7307e9dd1 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Thu, 12 Aug 2021 09:03:12 -0700 Subject: [PATCH 11/17] Rollback of PR #3030 (Working around Centos 8 failure). --- .github/workflows/ci.yml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 362cfe9259..2cecc3e0cb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -592,21 +592,10 @@ jobs: - name: Install dependencies run: python3 -m pip install cmake -r tests/requirements.txt --prefer-binary - - name: VAR_BUILD_TYPE 7 - if: matrix.centos == 7 - run: echo MinSizeRel > VAR_BUILD_TYPE - - # Using Release to avoid segfault that appeared around 2021-06-04, - # apparently when the gcc version changed from 8.3 to 8.4. - - name: VAR_BUILD_TYPE 8 - if: matrix.centos == 8 - run: echo Debug > VAR_BUILD_TYPE - - name: Configure shell: bash run: > cmake -S . -B build - -DCMAKE_BUILD_TYPE=$(cat VAR_BUILD_TYPE) -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=ON -DDOWNLOAD_EIGEN=ON From 4927293e4316c8fa9c332471d081d50b8844f3ce Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Thu, 12 Aug 2021 10:05:14 -0700 Subject: [PATCH 12/17] Disabling -Werror for GNU (experiment). --- tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index d71a51e6a0..d1e1fc6a47 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -303,7 +303,7 @@ function(pybind11_enable_warnings target_name) target_compile_options(${target_name} PRIVATE /WX) elseif(PYBIND11_CUDA_TESTS) target_compile_options(${target_name} PRIVATE "SHELL:-Werror all-warnings") - elseif(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang|IntelLLVM)") + elseif(CMAKE_CXX_COMPILER_ID MATCHES "(XNU|Clang|IntelLLVM)") target_compile_options(${target_name} PRIVATE -Werror) elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") target_compile_options( From 4bd03f2efd15e3cf2506d43ed20b4f328b86a740 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Thu, 12 Aug 2021 10:19:05 -0700 Subject: [PATCH 13/17] Commenting out the entire `if(PYBIND11_WERROR)` again (although that is not expected to make a difference, but who knows what I am overlooking). --- tests/CMakeLists.txt | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index d1e1fc6a47..2570b07177 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -298,22 +298,22 @@ function(pybind11_enable_warnings target_name) -Wnon-virtual-dtor) endif() - if(PYBIND11_WERROR) - if(MSVC) - target_compile_options(${target_name} PRIVATE /WX) - elseif(PYBIND11_CUDA_TESTS) - target_compile_options(${target_name} PRIVATE "SHELL:-Werror all-warnings") - elseif(CMAKE_CXX_COMPILER_ID MATCHES "(XNU|Clang|IntelLLVM)") - target_compile_options(${target_name} PRIVATE -Werror) - elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - target_compile_options( - ${target_name} - PRIVATE - -Werror-all - # "Inlining inhibited by limit max-size", "Inlining inhibited by limit max-total-size" - -diag-disable 11074,11076) - endif() - endif() + #if(PYBIND11_WERROR) + # if(MSVC) + # target_compile_options(${target_name} PRIVATE /WX) + # elseif(PYBIND11_CUDA_TESTS) + # target_compile_options(${target_name} PRIVATE "SHELL:-Werror all-warnings") + # elseif(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang|IntelLLVM)") + # target_compile_options(${target_name} PRIVATE -Werror) + # elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + # target_compile_options( + # ${target_name} + # PRIVATE + # -Werror-all + # # "Inlining inhibited by limit max-size", "Inlining inhibited by limit max-total-size" + # -diag-disable 11074,11076) + # endif() + #endif() # Needs to be re-added since the ordering requires these to be after the ones above if(CMAKE_CXX_STANDARD From 027aa9f9c02c81003c1e267c8e4b5077da8af261 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Thu, 12 Aug 2021 10:34:31 -0700 Subject: [PATCH 14/17] Adding `-DCMAKE_BUILD_TYPE=Release` --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2cecc3e0cb..0f3526ba87 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -596,6 +596,7 @@ jobs: shell: bash run: > cmake -S . -B build + -DCMAKE_BUILD_TYPE=Release -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=ON -DDOWNLOAD_EIGEN=ON From a4dbe3c0ab7858e72dc865b7a7b8173592cc3ae2 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Thu, 12 Aug 2021 10:47:51 -0700 Subject: [PATCH 15/17] Undoing change to tests/CMakeLists.txt (uncommenting `if(PYBIND11_WERROR)` block). --- tests/CMakeLists.txt | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 2570b07177..d71a51e6a0 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -298,22 +298,22 @@ function(pybind11_enable_warnings target_name) -Wnon-virtual-dtor) endif() - #if(PYBIND11_WERROR) - # if(MSVC) - # target_compile_options(${target_name} PRIVATE /WX) - # elseif(PYBIND11_CUDA_TESTS) - # target_compile_options(${target_name} PRIVATE "SHELL:-Werror all-warnings") - # elseif(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang|IntelLLVM)") - # target_compile_options(${target_name} PRIVATE -Werror) - # elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - # target_compile_options( - # ${target_name} - # PRIVATE - # -Werror-all - # # "Inlining inhibited by limit max-size", "Inlining inhibited by limit max-total-size" - # -diag-disable 11074,11076) - # endif() - #endif() + if(PYBIND11_WERROR) + if(MSVC) + target_compile_options(${target_name} PRIVATE /WX) + elseif(PYBIND11_CUDA_TESTS) + target_compile_options(${target_name} PRIVATE "SHELL:-Werror all-warnings") + elseif(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang|IntelLLVM)") + target_compile_options(${target_name} PRIVATE -Werror) + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + target_compile_options( + ${target_name} + PRIVATE + -Werror-all + # "Inlining inhibited by limit max-size", "Inlining inhibited by limit max-total-size" + -diag-disable 11074,11076) + endif() + endif() # Needs to be re-added since the ordering requires these to be after the ones above if(CMAKE_CXX_STANDARD From 34571859207d3926b6ff88e5a0442d78bc86c892 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Thu, 12 Aug 2021 13:40:09 -0700 Subject: [PATCH 16/17] post `git rebase master -X theirs` fixups. --- .github/workflows/ci.yml | 12 +++++++++++- tests/test_class.py | 7 ------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0f3526ba87..e1c32b96f0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -592,11 +592,21 @@ jobs: - name: Install dependencies run: python3 -m pip install cmake -r tests/requirements.txt --prefer-binary + - name: VAR_BUILD_TYPE 7 + if: matrix.centos == 7 + run: echo MinSizeRel > VAR_BUILD_TYPE + + # Using Release to avoid segfault that appeared around 2021-06-04, + # apparently when the gcc version changed from 8.3 to 8.4. + - name: VAR_BUILD_TYPE 8 + if: matrix.centos == 8 + run: echo Release > VAR_BUILD_TYPE + - name: Configure shell: bash run: > cmake -S . -B build - -DCMAKE_BUILD_TYPE=Release + -DCMAKE_BUILD_TYPE=$(cat VAR_BUILD_TYPE) -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=ON -DDOWNLOAD_EIGEN=ON diff --git a/tests/test_class.py b/tests/test_class.py index 931d50210b..1ff60fe214 100644 --- a/tests/test_class.py +++ b/tests/test_class.py @@ -11,13 +11,6 @@ def test_repr(): # In Python 3.3+, repr() accesses __qualname__ assert "pybind11_type" in repr(type(UserType)) assert "UserType" in repr(UserType) - import weakref - - u = UserType(0) - w = weakref.ref(u) - assert w() is not None - del u - assert w() is None def test_instance(msg): From fa53ba5ad219a088def9d257f62825bddafb20c8 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Thu, 12 Aug 2021 15:43:55 -0700 Subject: [PATCH 17/17] Adding measurements to comment for `PYBIND11_NOINLINE_FORCED`. --- include/pybind11/detail/common.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/pybind11/detail/common.h b/include/pybind11/detail/common.h index ab9834cdfc..8daa33903e 100644 --- a/include/pybind11/detail/common.h +++ b/include/pybind11/detail/common.h @@ -102,6 +102,9 @@ // For CUDA, GCC7, GCC8: // PYBIND11_NOINLINE_FORCED is incompatible with `-Wattributes -Werror`. // When defining PYBIND11_NOINLINE_FORCED, it is best to also use `-Wno-attributes`. +// However, the measured shared-library size saving when using noinline are only +// 1.7% for CUDA, -0.2% for GCC7, and 0.0% for GCC8 (using -DCMAKE_BUILD_TYPE=MinSizeRel, +// the default under pybind11/tests). #if !defined(PYBIND11_NOINLINE_FORCED) && \ (defined(__CUDACC__) || (defined(__GNUC__) && (__GNUC__ == 7 || __GNUC__ == 8))) # define PYBIND11_NOINLINE_DISABLED