From 3df23b1fe446fbbbc915b7eb5f90e851564bc419 Mon Sep 17 00:00:00 2001 From: Mikolaj Boc Date: Thu, 2 Jun 2022 13:20:05 +0200 Subject: Define out unused functions on WASM build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The struct iovec conversion functions that are needed on Unix are unused on WASM build. This makes the build fail with -Werror on Mac since the WASM build is treated as a variant of Unix. Cross-compilation with clang: Apple clang version 13.0.0 (clang-1300.0.27.3) Target: arm64-apple-darwin21.3.0 Fixes: QTBUG-103974 Pick-to: 6.3 6.4 Change-Id: I34c65a18832ceedb9064a98f5729e45667749461 Reviewed-by: Tor Arne Vestbø Reviewed-by: Thiago Macieira --- src/testlib/qtestcase.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/testlib/qtestcase.cpp') diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index d69bd9d3d1..c702ab125b 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -123,7 +123,7 @@ using QtMiscUtils::fromHex; namespace { enum DebuggerProgram { None, Gdb, Lldb }; -#ifdef Q_OS_UNIX +#if defined(Q_OS_UNIX) && (!defined(Q_OS_WASM) || QT_CONFIG(thread)) static struct iovec IoVec(struct iovec vec) { return vec; @@ -210,7 +210,7 @@ static std::string asyncSafeToString(int n) { return std::to_string(n); } -#endif // Q_OS_UNIX +#endif // defined(Q_OS_UNIX) } // unnamed namespace static bool alreadyDebugging() @@ -353,6 +353,7 @@ static void prepareStackTrace() #endif // Q_OS_UNIX } +#if !defined(Q_OS_WASM) || QT_CONFIG(thread) static void printTestRunTime() { const int msecsFunctionTime = qRound(QTestLog::msecsFunctionTime()); @@ -366,7 +367,7 @@ static void generateStackTrace() if (debugger == None || alreadyDebugging()) return; -#if defined(Q_OS_UNIX) && !defined(Q_OS_WASM) && !defined(Q_OS_INTEGRITY) +# if defined(Q_OS_UNIX) && !defined(Q_OS_WASM) && !defined(Q_OS_INTEGRITY) writeToStderr("\n=== Stack trace ===\n"); // execlp() requires null-termination, so call the default constructor @@ -403,8 +404,9 @@ static void generateStackTrace() } writeToStderr("=== End of stack trace ===\n"); -#endif // Q_OS_UNIX && !Q_OS_WASM +# endif // Q_OS_UNIX && !Q_OS_WASM } +#endif // !defined(Q_OS_WASM) || QT_CONFIG(thread) static bool installCoverageTool(const char * appname, const char * testname) { @@ -1287,7 +1289,7 @@ public: void testFinished() {}; }; -#endif +#endif // QT_CONFIG(thread) /*! -- cgit v1.2.3