mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 13:15:12 +00:00
fix: using -Werror-all for Intel (#2948)
* correcting Werror for Intel * adding ward for Intel * adding wards for intel * another ward for Intel * missed one intel ward * exact match for intel compiler * removing inline limits * disable warnings about inline limits * formatter suggestion * more indent * hopefully make formatter happy * addressed review * fix && * Update tests/CMakeLists.txt Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com> Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
This commit is contained in:
parent
6709abba93
commit
62976cfcb8
@ -143,12 +143,12 @@ protected:
|
|||||||
/* Without these pragmas, GCC warns that there might not be
|
/* Without these pragmas, GCC warns that there might not be
|
||||||
enough space to use the placement new operator. However, the
|
enough space to use the placement new operator. However, the
|
||||||
'if' statement above ensures that this is the case. */
|
'if' statement above ensures that this is the case. */
|
||||||
#if defined(__GNUG__) && !defined(__clang__) && __GNUC__ >= 6
|
#if defined(__GNUG__) && __GNUC__ >= 6 && !defined(__clang__) && !defined(__INTEL_COMPILER)
|
||||||
# pragma GCC diagnostic push
|
# pragma GCC diagnostic push
|
||||||
# pragma GCC diagnostic ignored "-Wplacement-new"
|
# pragma GCC diagnostic ignored "-Wplacement-new"
|
||||||
#endif
|
#endif
|
||||||
new ((capture *) &rec->data) capture { std::forward<Func>(f) };
|
new ((capture *) &rec->data) capture { std::forward<Func>(f) };
|
||||||
#if defined(__GNUG__) && !defined(__clang__) && __GNUC__ >= 6
|
#if defined(__GNUG__) && __GNUC__ >= 6 && !defined(__clang__) && !defined(__INTEL_COMPILER)
|
||||||
# pragma GCC diagnostic pop
|
# pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
if (!std::is_trivially_destructible<Func>::value)
|
if (!std::is_trivially_destructible<Func>::value)
|
||||||
@ -2283,6 +2283,6 @@ PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE)
|
|||||||
|
|
||||||
#if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
|
#if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
|
||||||
# pragma warning(pop)
|
# pragma warning(pop)
|
||||||
#elif defined(__GNUG__) && !defined(__clang__)
|
#elif defined(__GNUG__) && !defined(__clang__) && !defined(__INTEL_COMPILER)
|
||||||
# pragma GCC diagnostic pop
|
# pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
@ -268,8 +268,15 @@ function(pybind11_enable_warnings target_name)
|
|||||||
target_compile_options(${target_name} PRIVATE /WX)
|
target_compile_options(${target_name} PRIVATE /WX)
|
||||||
elseif(PYBIND11_CUDA_TESTS)
|
elseif(PYBIND11_CUDA_TESTS)
|
||||||
target_compile_options(${target_name} PRIVATE "SHELL:-Werror all-warnings")
|
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|IntelLLVM)")
|
||||||
target_compile_options(${target_name} PRIVATE -Werror)
|
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()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -56,12 +56,12 @@ int f1(int x) noexcept { return x+1; }
|
|||||||
#endif
|
#endif
|
||||||
int f2(int x) noexcept(true) { return x+2; }
|
int f2(int x) noexcept(true) { return x+2; }
|
||||||
int f3(int x) noexcept(false) { return x+3; }
|
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 push
|
||||||
# pragma GCC diagnostic ignored "-Wdeprecated"
|
# pragma GCC diagnostic ignored "-Wdeprecated"
|
||||||
#endif
|
#endif
|
||||||
int f4(int x) throw() { return x+4; } // Deprecated equivalent to noexcept(true)
|
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
|
# pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
struct C {
|
struct C {
|
||||||
@ -71,13 +71,13 @@ struct C {
|
|||||||
int m4(int x) const noexcept(true) { return x-4; }
|
int m4(int x) const noexcept(true) { return x-4; }
|
||||||
int m5(int x) noexcept(false) { return x-5; }
|
int m5(int x) noexcept(false) { return x-5; }
|
||||||
int m6(int x) const noexcept(false) { return x-6; }
|
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 push
|
||||||
# pragma GCC diagnostic ignored "-Wdeprecated"
|
# pragma GCC diagnostic ignored "-Wdeprecated"
|
||||||
#endif
|
#endif
|
||||||
int m7(int x) throw() { return x-7; }
|
int m7(int x) throw() { return x-7; }
|
||||||
int m8(int x) const throw() { return x-8; }
|
int m8(int x) const throw() { return x-8; }
|
||||||
#if defined(__GNUG__)
|
#if defined(__GNUG__) && !defined(__INTEL_COMPILER)
|
||||||
# pragma GCC diagnostic pop
|
# pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
@ -80,8 +80,8 @@ std::string abs(const Vector2&) {
|
|||||||
return "abs(Vector2)";
|
return "abs(Vector2)";
|
||||||
}
|
}
|
||||||
|
|
||||||
// MSVC warns about unknown pragmas, and warnings are errors.
|
// MSVC & Intel warns about unknown pragmas, and warnings are errors.
|
||||||
#ifndef _MSC_VER
|
#if !defined(_MSC_VER) && !defined(__INTEL_COMPILER)
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
// clang 7.0.0 and Apple LLVM 10.0.1 introduce `-Wself-assign-overloaded` to
|
// 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 `).
|
// `-Wall`, which is used here for overloading (e.g. `py::self += py::self `).
|
||||||
@ -221,6 +221,6 @@ TEST_SUBMODULE(operators, m) {
|
|||||||
.def(py::self == py::self);
|
.def(py::self == py::self);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
#if !defined(_MSC_VER) && !defined(__INTEL_COMPILER)
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user