From f68df05a77afd58d60a80b16bd062d0e9e6d42a3 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 13 Jan 2025 04:31:02 -0800 Subject: [PATCH] QCoreApplicationPrivate: use NSDMI to initialize the members MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This removes the need for #if in the initialization list and the ugly whitespace-before-punctuation syntax. Pick-to: 6.9 Change-Id: Id33ec83e574360f65c9bfffd22b8cb450156477b Reviewed-by: MÃ¥rten Nordheim --- src/corelib/kernel/qcoreapplication.cpp | 19 +------------------ src/corelib/kernel/qcoreapplication_p.h | 14 +++++++------- 2 files changed, 8 insertions(+), 25 deletions(-) diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index a8665df7334..79a9aac4247 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -424,24 +424,7 @@ static inline bool contains(int argc, char **argv, const char *needle) #endif // Q_OS_WIN QCoreApplicationPrivate::QCoreApplicationPrivate(int &aargc, char **aargv) - : -#ifndef QT_NO_QOBJECT - QObjectPrivate(), -#endif - argc(aargc) - , argv(aargv) -#if defined(Q_OS_WIN) - , origArgc(0) - , origArgv(nullptr) -#endif - , application_type(QCoreApplicationPrivate::Tty) -#ifndef QT_NO_QOBJECT - , in_exec(false) - , aboutToQuitEmitted(false) - , threadData_clean(false) -#else - , q_ptr(nullptr) -#endif + : argc(aargc), argv(aargv) { static const char *const empty = ""; if (argc == 0 || argv == nullptr) { diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h index 8881206d77a..d7223ffeb1d 100644 --- a/src/corelib/kernel/qcoreapplication_p.h +++ b/src/corelib/kernel/qcoreapplication_p.h @@ -125,8 +125,8 @@ public: int &argc; char **argv; #if defined(Q_OS_WIN) - int origArgc; - char **origArgv; // store unmodified arguments for QCoreApplication::arguments() + int origArgc = 0; + char **origArgv = nullptr; // store unmodified arguments for QCoreApplication::arguments() bool consoleAllocated = false; #endif void appendApplicationPathToLibraryPaths(void); @@ -137,7 +137,7 @@ public: static bool isTranslatorInstalled(QTranslator *translator); #endif - QCoreApplicationPrivate::Type application_type; + Type application_type = Tty; QString cachedApplicationDirPath; static QString *cachedApplicationFilePath; @@ -147,9 +147,9 @@ public: #ifndef QT_NO_QOBJECT void execCleanup(); - bool in_exec; - bool aboutToQuitEmitted; - bool threadData_clean; + bool in_exec = false; + bool aboutToQuitEmitted = false; + bool threadData_clean = false; static QAbstractEventDispatcher *eventDispatcher; static bool is_app_running; @@ -165,7 +165,7 @@ public: inline QString qmljsDebugArgumentsString() const { return qmljs_debug_arguments; } #ifdef QT_NO_QOBJECT - QCoreApplication *q_ptr; + QCoreApplication *q_ptr = nullptr; #endif };