From dc72617cf236dff76c57dd8694b62849c1323ae2 Mon Sep 17 00:00:00 2001 From: Amir Masoud Abdol Date: Tue, 23 May 2023 15:04:17 +0200 Subject: [PATCH] Remove the manual undef of the min/max macros, or def NOMINMAX We now add NOMINMAX to PlatformCommonInternal target which will be linked to everything else, so min/max will not be defined upon the inclusion of `windows.h`, or other headers. Change-Id: I10016720dac7ce015e929885b7368ee86d8b6918 Reviewed-by: Alexandru Croitor (cherry picked from commit 1dfa922606e497918e57a6a06f96ee63b7fb163e) --- src/network/socket/qnativesocketengine_win.cpp | 3 --- src/plugins/sqldrivers/oci/qsql_oci.cpp | 7 ------- src/plugins/tls/openssl/qdtls_openssl.cpp | 4 ---- src/testlib/qjunittestlogger.cpp | 7 ------- src/testlib/qplaintestlogger.cpp | 7 ------- tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp | 3 --- tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp | 2 -- tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp | 2 -- 8 files changed, 35 deletions(-) diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp index d578e5230fd..16d974a68be 100644 --- a/src/network/socket/qnativesocketengine_win.cpp +++ b/src/network/socket/qnativesocketengine_win.cpp @@ -2,9 +2,6 @@ // Copyright (C) 2016 Intel Corporation. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only -// Prevent windows system header files from defining min/max as macros. -#define NOMINMAX 1 - #include #include diff --git a/src/plugins/sqldrivers/oci/qsql_oci.cpp b/src/plugins/sqldrivers/oci/qsql_oci.cpp index b670efc15be..1a9eb041b30 100644 --- a/src/plugins/sqldrivers/oci/qsql_oci.cpp +++ b/src/plugins/sqldrivers/oci/qsql_oci.cpp @@ -30,14 +30,7 @@ #define _int64 __int64 #endif - #include -#ifdef max -#undef max -#endif -#ifdef min -#undef min -#endif #include diff --git a/src/plugins/tls/openssl/qdtls_openssl.cpp b/src/plugins/tls/openssl/qdtls_openssl.cpp index 78288d8dd1b..fc07a29ec86 100644 --- a/src/plugins/tls/openssl/qdtls_openssl.cpp +++ b/src/plugins/tls/openssl/qdtls_openssl.cpp @@ -1,10 +1,6 @@ // Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only -#ifndef NOMINMAX -#define NOMINMAX -#endif // NOMINMAX - #include #include "qsslsocket_openssl_symbols_p.h" diff --git a/src/testlib/qjunittestlogger.cpp b/src/testlib/qjunittestlogger.cpp index 8e2b917055c..4ee5788beea 100644 --- a/src/testlib/qjunittestlogger.cpp +++ b/src/testlib/qjunittestlogger.cpp @@ -9,13 +9,6 @@ #include #include -#ifdef min // windows.h without NOMINMAX is included by the benchmark headers. -# undef min -#endif -#ifdef max -# undef max -#endif - #include #include diff --git a/src/testlib/qplaintestlogger.cpp b/src/testlib/qplaintestlogger.cpp index 9f61004c2ce..4bafacb10fa 100644 --- a/src/testlib/qplaintestlogger.cpp +++ b/src/testlib/qplaintestlogger.cpp @@ -16,13 +16,6 @@ #include #include -#ifdef min // windows.h without NOMINMAX is included by the benchmark headers. -# undef min -#endif -#ifdef max -# undef max -#endif - #include #include #include diff --git a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp index 273bf3a0357..e6704c36236 100644 --- a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp +++ b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp @@ -7,9 +7,6 @@ // (except qglobal.h), or else you'll get tons of compile errors #include -// To prevent windows system header files from re-defining min/max -#define NOMINMAX 1 - #if defined(Q_OS_WIN) # include # include diff --git a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp index 90e6f3da8e4..f42d0497fef 100644 --- a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp +++ b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp @@ -2,8 +2,6 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include -// To prevent windows system header files from re-defining min/max -#define NOMINMAX 1 #if defined(_WIN32) #include #else diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp index 5dc12b924fb..c16717e95a7 100644 --- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp @@ -4,8 +4,6 @@ #include -// To prevent windows system header files from re-defining min/max -#define NOMINMAX 1 #if defined(_WIN32) #include #else