From 2babf1e3b102d4c71e2b00f08b495764a8ff7223 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 18 Dec 2024 09:48:20 +0100 Subject: [PATCH] Protect QT_ENABLE_STRICT_MODE_UP_TO against predefined individual opt-outs [6.8] Since some of the Qt opt-outs are defined project-wide by the buildsystem these days (e.g. QT_NO_FOREACH, QT_NO_JAVA_STYLE_ITERATOR, ...), a module that attempts to use QT_ENABLE_STRICT_MODE_UP_TO will hit warnings regarding re-definition of these macros (definition on the compiler command line, redefinition by qtconfigmacros.h). To fix, guard the #define QT_NO_FOO's with #ifndef QT_NO_FOO. Amends 3a6c8e02b6d1b0574da52b0087092d0c74aa92c1. Change-Id: I457457d1e60dbd9362b987157ba089adc67d1d6b Reviewed-by: Ivan Solovev (cherry picked from commit 0f416cbaaba46ddb039bbf33e1d70dbe80821d57) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit d328e8eaaf96b7a4337169e385bd8c58623028df) --- src/corelib/global/qtconfigmacros.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/corelib/global/qtconfigmacros.h b/src/corelib/global/qtconfigmacros.h index c2001efac3e..665ae9f5711 100644 --- a/src/corelib/global/qtconfigmacros.h +++ b/src/corelib/global/qtconfigmacros.h @@ -182,25 +182,45 @@ namespace QT_NAMESPACE {} #endif #if QT_ENABLE_STRICT_MODE_UP_TO >= QT_VERSION_CHECK(6, 0, 0) +# ifndef QT_NO_FOREACH # define QT_NO_FOREACH +# endif +# ifndef QT_NO_CAST_FROM_ASCII # define QT_NO_CAST_FROM_ASCII +#endif +# ifndef QT_NO_CAST_TO_ASCII # define QT_NO_CAST_TO_ASCII +# endif +# ifndef QT_NO_CAST_FROM_BYTEARRAY # define QT_NO_CAST_FROM_BYTEARRAY +# endif +# ifndef QT_NO_URL_CAST_FROM_STRING # define QT_NO_URL_CAST_FROM_STRING +# endif +# ifndef QT_NO_NARROWING_CONVERSIONS_IN_CONNECT # define QT_NO_NARROWING_CONVERSIONS_IN_CONNECT +# endif +# ifndef QT_NO_JAVA_STYLE_ITERATORS # define QT_NO_JAVA_STYLE_ITERATORS +# endif #endif // 6.0.0 #if QT_ENABLE_STRICT_MODE_UP_TO >= QT_VERSION_CHECK(6, 6, 0) +# ifndef QT_NO_QEXCHANGE # define QT_NO_QEXCHANGE +# endif #endif // 6.6.0 #if QT_ENABLE_STRICT_MODE_UP_TO >= QT_VERSION_CHECK(6, 7, 0) +# ifndef QT_NO_CONTEXTLESS_CONNECT # define QT_NO_CONTEXTLESS_CONNECT +# endif #endif // 6.7.0 #if QT_ENABLE_STRICT_MODE_UP_TO >= QT_VERSION_CHECK(6, 8, 0) +# ifndef QT_NO_QASCONST # define QT_NO_QASCONST +# endif # if !defined(QT_USE_NODISCARD_FILE_OPEN) && !defined(QT_NO_USE_NODISCARD_FILE_OPEN) # define QT_USE_NODISCARD_FILE_OPEN # endif