From 22c540a66dbb849bf6b8bf49027cfaf8510ef066 Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Fri, 7 Jul 2023 19:54:39 +0300 Subject: [PATCH] QProcess: make UnixProcessFlag an enum class See: https://lists.qt-project.org/pipermail/development/2023-May/043804.html Not being an enum class looks more of an oversight, in most places usage of the enumerators was already prefixed with QProcess::UnixProcessFlag. Change-Id: Ie37d74e0039d3f65f90af560cb85bb11b77ae20c Pick-to: 6.6 Reviewed-by: Thiago Macieira --- src/corelib/io/qprocess.h | 2 +- src/corelib/io/qprocess_unix.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/corelib/io/qprocess.h b/src/corelib/io/qprocess.h index 4839aa42b3..770be0cbf0 100644 --- a/src/corelib/io/qprocess.h +++ b/src/corelib/io/qprocess.h @@ -176,7 +176,7 @@ public: void setChildProcessModifier(const std::function &modifier); Q_NORETURN void failChildProcessModifier(const char *description, int error = 0) noexcept; - enum UnixProcessFlag : quint32 { + enum class UnixProcessFlag : quint32 { ResetSignalHandlers = 0x0001, // like POSIX_SPAWN_SETSIGDEF IgnoreSigPipe = 0x0002, // some room if we want to add IgnoreSigHup or so diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index 0e081884e1..64f48accb2 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -860,8 +860,9 @@ void QChildProcess::startProcess() const noexcept applyProcessParameters(d->unixExtras->processParameters); auto flags = d->unixExtras->processParameters.flags; - sigpipeHandled = flags.testAnyFlags(QProcess::ResetSignalHandlers | QProcess::IgnoreSigPipe); - sigmaskHandled = flags.testFlag(QProcess::ResetSignalHandlers); + using P = QProcess::UnixProcessFlag; + sigpipeHandled = flags.testAnyFlags(P::ResetSignalHandlers | P::IgnoreSigPipe); + sigmaskHandled = flags.testFlag(P::ResetSignalHandlers); } if (!sigpipeHandled) { // reset the signal that we ignored