mirror of
https://github.com/pybind/pybind11.git
synced 2026-05-05 22:23:21 +00:00
Removing MSVC C4127 from pragma block at the top of pybind11.h (#3152)
* Removing pragma for 4127 (to see what is still broken with the latest code). * Using new constexpr_bool() to suppress warning C4127. * One missed case, Python 2 only. * PYBIND11_SILENCE_MSVC_C4127 (more similar to the approach for C4100).
This commit is contained in:
committed by
GitHub
parent
e2573dc961
commit
dcbda8d7ff
@@ -10,10 +10,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable: 4127) // warning C4127: Conditional expression is constant
|
||||
#elif defined(__GNUG__) && !defined(__clang__) && !defined(__INTEL_COMPILER)
|
||||
#if defined(__GNUG__) && !defined(__clang__) && !defined(__INTEL_COMPILER)
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
|
||||
# pragma GCC diagnostic ignored "-Wattributes"
|
||||
@@ -166,7 +163,7 @@ protected:
|
||||
auto rec = unique_rec.get();
|
||||
|
||||
/* Store the capture object directly in the function record if there is enough space */
|
||||
if (sizeof(capture) <= sizeof(rec->data)) {
|
||||
if (PYBIND11_SILENCE_MSVC_C4127(sizeof(capture) <= sizeof(rec->data))) {
|
||||
/* 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. */
|
||||
@@ -2388,8 +2385,6 @@ PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE)
|
||||
# pragma GCC diagnostic pop // -Wnoexcept-type
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
|
||||
# pragma warning(pop)
|
||||
#elif defined(__GNUG__) && !defined(__clang__) && !defined(__INTEL_COMPILER)
|
||||
#if defined(__GNUG__) && !defined(__clang__) && !defined(__INTEL_COMPILER)
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user