From 769456822e0773846be9cb5eac33facfd4a3a771 Mon Sep 17 00:00:00 2001 From: Philipp Bucher Date: Tue, 13 Apr 2021 16:13:49 +0200 Subject: [PATCH 01/14] correcting Werror for Intel --- tests/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 9ff6c0dd9a..ddc70da793 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -268,8 +268,10 @@ 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|Intel|Clang)") + elseif(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)") target_compile_options(${target_name} PRIVATE -Werror) + elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel") + target_compile_options(${target_name} PRIVATE -Werror-all) endif() endif() From 4bf349bd64959dc16cd0ab52b46f90d3a540654c Mon Sep 17 00:00:00 2001 From: Philipp Bucher Date: Tue, 13 Apr 2021 16:22:37 +0200 Subject: [PATCH 02/14] adding ward for Intel --- include/pybind11/pybind11.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index eff40a8495..6b17a38720 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -143,12 +143,12 @@ class cpp_function : public function { /* Without these pragmas, GCC warns that there might not be enough space to use the placement new operator. However, the 'if' statement above ensures that this is the case. */ -#if defined(__GNUG__) && !defined(__clang__) && __GNUC__ >= 6 +#if defined(__GNUG__) && !defined(__clang__) && __GNUC__ >= 6 && !defined(__INTEL_COMPILER) # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wplacement-new" #endif new ((capture *) &rec->data) capture { std::forward(f) }; -#if defined(__GNUG__) && !defined(__clang__) && __GNUC__ >= 6 +#if defined(__GNUG__) && !defined(__clang__) && __GNUC__ >= 6 && !defined(__INTEL_COMPILER) # pragma GCC diagnostic pop #endif if (!std::is_trivially_destructible::value) @@ -2283,6 +2283,6 @@ PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE) #if defined(_MSC_VER) && !defined(__INTEL_COMPILER) # pragma warning(pop) -#elif defined(__GNUG__) && !defined(__clang__) +#elif defined(__GNUG__) && !defined(__clang__) && !defined(__INTEL_COMPILER) # pragma GCC diagnostic pop #endif From 9b0d18456362c9f9869d6acdb1aad1e8242ab89e Mon Sep 17 00:00:00 2001 From: Philipp Bucher Date: Tue, 13 Apr 2021 16:27:59 +0200 Subject: [PATCH 03/14] adding wards for intel --- tests/test_constants_and_functions.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_constants_and_functions.cpp b/tests/test_constants_and_functions.cpp index 8855dd7d7c..5bbbd0c70b 100644 --- a/tests/test_constants_and_functions.cpp +++ b/tests/test_constants_and_functions.cpp @@ -56,12 +56,12 @@ int f1(int x) noexcept { return x+1; } #endif int f2(int x) noexcept(true) { return x+2; } int f3(int x) noexcept(false) { return x+3; } -#if defined(__GNUG__) +#if defined(__GNUG__) && !defined(__INTEL_COMPILER) # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wdeprecated" #endif int f4(int x) throw() { return x+4; } // Deprecated equivalent to noexcept(true) -#if defined(__GNUG__) +#if defined(__GNUG__) && !defined(__INTEL_COMPILER) # pragma GCC diagnostic pop #endif struct C { @@ -71,13 +71,13 @@ struct C { int m4(int x) const noexcept(true) { return x-4; } int m5(int x) noexcept(false) { return x-5; } int m6(int x) const noexcept(false) { return x-6; } -#if defined(__GNUG__) +#if defined(__GNUG__) && !defined(__INTEL_COMPILER) # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wdeprecated" #endif int m7(int x) throw() { return x-7; } int m8(int x) const throw() { return x-8; } -#if defined(__GNUG__) +#if defined(__GNUG__) && !defined(__INTEL_COMPILER) # pragma GCC diagnostic pop #endif }; From 440e65132d20f07799ccbb2c9d6e7d131f627d1e Mon Sep 17 00:00:00 2001 From: Philipp Bucher Date: Tue, 13 Apr 2021 16:33:50 +0200 Subject: [PATCH 04/14] another ward for Intel --- tests/test_operator_overloading.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_operator_overloading.cpp b/tests/test_operator_overloading.cpp index 0a27bfd57b..a26acca373 100644 --- a/tests/test_operator_overloading.cpp +++ b/tests/test_operator_overloading.cpp @@ -80,8 +80,8 @@ std::string abs(const Vector2&) { return "abs(Vector2)"; } -// MSVC warns about unknown pragmas, and warnings are errors. -#ifndef _MSC_VER +// MSVC & Intel warns about unknown pragmas, and warnings are errors. +#if !defined(_MSC_VER) && !defined(__INTEL_COMPILER) #pragma GCC diagnostic push // clang 7.0.0 and Apple LLVM 10.0.1 introduce `-Wself-assign-overloaded` to // `-Wall`, which is used here for overloading (e.g. `py::self += py::self `). From 70ff84c1d30a3f8a3173114ebdbb7aa45961af50 Mon Sep 17 00:00:00 2001 From: Philipp Bucher Date: Tue, 13 Apr 2021 16:53:32 +0200 Subject: [PATCH 05/14] missed one intel ward --- tests/test_operator_overloading.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_operator_overloading.cpp b/tests/test_operator_overloading.cpp index a26acca373..eb3167dc08 100644 --- a/tests/test_operator_overloading.cpp +++ b/tests/test_operator_overloading.cpp @@ -221,6 +221,6 @@ TEST_SUBMODULE(operators, m) { .def(py::self == py::self); } -#ifndef _MSC_VER +#if !defined(_MSC_VER) && !defined(__INTEL_COMPILER) #pragma GCC diagnostic pop #endif From f8eaec686221671191aa531df42aceb5a35bd6f1 Mon Sep 17 00:00:00 2001 From: Philipp Date: Wed, 14 Apr 2021 09:09:45 +0200 Subject: [PATCH 06/14] exact match for intel compiler --- tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index ddc70da793..f1b8c2c5d6 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -270,7 +270,7 @@ function(pybind11_enable_warnings target_name) target_compile_options(${target_name} PRIVATE "SHELL:-Werror all-warnings") elseif(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)") target_compile_options(${target_name} PRIVATE -Werror) - elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel") + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") target_compile_options(${target_name} PRIVATE -Werror-all) endif() endif() From baf6f41e3e5a46097ea4f07675f73870541e0114 Mon Sep 17 00:00:00 2001 From: Philipp Date: Wed, 14 Apr 2021 09:27:00 +0200 Subject: [PATCH 07/14] removing inline limits --- tests/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f1b8c2c5d6..6043f50153 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -271,7 +271,9 @@ function(pybind11_enable_warnings target_name) elseif(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)") target_compile_options(${target_name} PRIVATE -Werror) elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - target_compile_options(${target_name} PRIVATE -Werror-all) + target_compile_options(${target_name} PRIVATE -Werror-all + -no-inline-max-size + -no-inline-max-total-size) endif() endif() From fedf30bf350de6dcf993762094f4d2260f0586fb Mon Sep 17 00:00:00 2001 From: Philipp Date: Wed, 14 Apr 2021 09:37:40 +0200 Subject: [PATCH 08/14] disable warnings about inline limits --- tests/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 6043f50153..e37207ee3f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -272,8 +272,8 @@ function(pybind11_enable_warnings target_name) target_compile_options(${target_name} PRIVATE -Werror) elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") target_compile_options(${target_name} PRIVATE -Werror-all - -no-inline-max-size - -no-inline-max-total-size) + # "Inlining inhibited by limit max-size", "Inlining inhibited by limit max-total-size" + -diag-disable 11074,11076) endif() endif() From 9e7b923ecfe184c7d21508614cdd4b654cae6836 Mon Sep 17 00:00:00 2001 From: Philipp Date: Wed, 14 Apr 2021 09:45:23 +0200 Subject: [PATCH 09/14] formatter suggestion --- tests/CMakeLists.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index e37207ee3f..ae08fdadb3 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -271,9 +271,12 @@ function(pybind11_enable_warnings target_name) elseif(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)") 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) + 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() From 69c56011760a42bfeee6d3f0740cd2de6f88a93e Mon Sep 17 00:00:00 2001 From: Philipp Date: Wed, 14 Apr 2021 09:47:10 +0200 Subject: [PATCH 10/14] more indent --- tests/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index ae08fdadb3..5edc436823 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -273,10 +273,10 @@ function(pybind11_enable_warnings target_name) 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) + PRIVATE + -Werror-all + # "Inlining inhibited by limit max-size", "Inlining inhibited by limit max-total-size" + -diag-disable 11074,11076) endif() endif() From 4f0235522f99c898c76502449f81315b68f46718 Mon Sep 17 00:00:00 2001 From: Philipp Date: Wed, 14 Apr 2021 09:50:56 +0200 Subject: [PATCH 11/14] hopefully make formatter happy --- tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 5edc436823..3910484640 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -273,7 +273,7 @@ function(pybind11_enable_warnings target_name) elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") target_compile_options( ${target_name} - PRIVATE + PRIVATE -Werror-all # "Inlining inhibited by limit max-size", "Inlining inhibited by limit max-total-size" -diag-disable 11074,11076) From 7b596ea8407486cfa743353e5648729f5a7c2e3b Mon Sep 17 00:00:00 2001 From: Philipp Date: Wed, 14 Apr 2021 16:34:16 +0200 Subject: [PATCH 12/14] addressed review --- include/pybind11/pybind11.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index 6b17a38720..e9a29a027e 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -143,12 +143,12 @@ class cpp_function : public function { /* Without these pragmas, GCC warns that there might not be enough space to use the placement new operator. However, the 'if' statement above ensures that this is the case. */ -#if defined(__GNUG__) && !defined(__clang__) && __GNUC__ >= 6 && !defined(__INTEL_COMPILER) +#if defined(__GNUG__) && && __GNUC__ >= 6 && !defined(__clang__) !defined(__INTEL_COMPILER) # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wplacement-new" #endif new ((capture *) &rec->data) capture { std::forward(f) }; -#if defined(__GNUG__) && !defined(__clang__) && __GNUC__ >= 6 && !defined(__INTEL_COMPILER) +#if defined(__GNUG__) && && __GNUC__ >= 6 && !defined(__clang__) !defined(__INTEL_COMPILER) # pragma GCC diagnostic pop #endif if (!std::is_trivially_destructible::value) From fbed50a8d9fc9ca9335e26ea17e2bb4ad5ad19e2 Mon Sep 17 00:00:00 2001 From: Philipp Date: Wed, 14 Apr 2021 16:37:25 +0200 Subject: [PATCH 13/14] fix && --- include/pybind11/pybind11.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index e9a29a027e..754c875cda 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -143,12 +143,12 @@ class cpp_function : public function { /* Without these pragmas, GCC warns that there might not be enough space to use the placement new operator. However, the 'if' statement above ensures that this is the case. */ -#if defined(__GNUG__) && && __GNUC__ >= 6 && !defined(__clang__) !defined(__INTEL_COMPILER) +#if defined(__GNUG__) && __GNUC__ >= 6 && !defined(__clang__) && !defined(__INTEL_COMPILER) # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wplacement-new" #endif new ((capture *) &rec->data) capture { std::forward(f) }; -#if defined(__GNUG__) && && __GNUC__ >= 6 && !defined(__clang__) !defined(__INTEL_COMPILER) +#if defined(__GNUG__) && __GNUC__ >= 6 && !defined(__clang__) && !defined(__INTEL_COMPILER) # pragma GCC diagnostic pop #endif if (!std::is_trivially_destructible::value) From 9ec6559f0c3f659f5862be5f3f71858751cfeb1f Mon Sep 17 00:00:00 2001 From: Philipp Bucher Date: Wed, 14 Apr 2021 16:38:33 +0200 Subject: [PATCH 14/14] Update tests/CMakeLists.txt Co-authored-by: Henry Schreiner --- tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 3910484640..3d89404911 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -268,7 +268,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)") + 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(