From 2ef4ea3319fbccdc15954399337c9256f67932c4 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 14 May 2025 22:34:46 -0700 Subject: [PATCH] QTest::CrashHandler: reorganize Unix header blocks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ib45e7e913fcc2e00f198fffdcc216e9f74c97e15 Reviewed-by: Tor Arne Vestbø Reviewed-by: Edward Welbourne --- src/testlib/qtestcrashhandler_unix.cpp | 37 +++++++++++++------------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/src/testlib/qtestcrashhandler_unix.cpp b/src/testlib/qtestcrashhandler_unix.cpp index 23ba8287d81..92ad16ceb97 100644 --- a/src/testlib/qtestcrashhandler_unix.cpp +++ b/src/testlib/qtestcrashhandler_unix.cpp @@ -21,12 +21,6 @@ #include #include -#if defined(Q_OS_LINUX) -#include -#include -#include -#endif - #include #if __has_include() # include @@ -41,16 +35,6 @@ # include # endif -# ifndef _PATH_DEFPATH -# define _PATH_DEFPATH "/usr/bin:/bin" -# endif -# ifndef SIGSTKSZ -# define SIGSTKSZ 0 /* we have code to set the minimum */ -# endif -# ifndef SA_RESETHAND -# define SA_RESETHAND 0 -# endif - #if defined(Q_OS_MACOS) #include #include @@ -59,12 +43,30 @@ #include #include #include + +#define CSR_ALLOW_UNRESTRICTED_FS (1 << 1) +#endif + +#if defined(Q_OS_LINUX) +#include +#include +#include #endif #if defined(Q_OS_WASM) #include #endif +#ifndef _PATH_DEFPATH +# define _PATH_DEFPATH "/usr/bin:/bin" +#endif +#ifndef SIGSTKSZ +# define SIGSTKSZ 0 /* we have code to set the minimum */ +#endif +#ifndef SA_RESETHAND +# define SA_RESETHAND 0 +#endif + QT_BEGIN_NAMESPACE using namespace Qt::StringLiterals; @@ -285,8 +287,7 @@ void prepareStackTrace() // where LLDB will hang and fail to provide a valid stack trace. # if defined(Q_PROCESSOR_ARM) return; - #else - #define CSR_ALLOW_UNRESTRICTED_FS (1 << 1) +# else std::optional sipConfiguration = qt_mac_sipConfiguration(); if (!sipConfiguration || !(*sipConfiguration & CSR_ALLOW_UNRESTRICTED_FS)) return;