diff --git a/src/testlib/3rdparty/cycle/cycle_include_p.h b/src/testlib/3rdparty/cycle/cycle_include_p.h new file mode 100644 index 00000000000..2427c9f6e37 --- /dev/null +++ b/src/testlib/3rdparty/cycle/cycle_include_p.h @@ -0,0 +1,19 @@ +// Copyright (C) 2025 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QBENCHLIB_CYCLE_INCLUDE_H +#define QBENCHLIB_CYCLE_INCLUDE_H + +#include + +// This file suppresses compilation warnings coming from cycle_p.h. +// Include this file instead of cycle_p.h directly. + +#define QBENCHLIB_INCLUDING_CYCLE_P +QT_WARNING_PUSH +QT_WARNING_DISABLE_CLANG("-Wundef") +QT_WARNING_DISABLE_GCC("-Wundef") +#include "cycle_p.h" +QT_WARNING_POP + +#endif // QBENCHLIB_CYCLE_INCLUDE_H diff --git a/src/testlib/3rdparty/cycle/cycle_p.h b/src/testlib/3rdparty/cycle/cycle_p.h index f281c55d48f..db1e31444a2 100644 --- a/src/testlib/3rdparty/cycle/cycle_p.h +++ b/src/testlib/3rdparty/cycle/cycle_p.h @@ -80,6 +80,10 @@ #define QBENCHLIB_CYCLE_H #define ticks CycleCounterTicks +#ifndef QBENCHLIB_INCLUDING_CYCLE_P +#error Include cycle_include_p.h instead of this file +#endif + /***************************************************************************/ #if TIME_WITH_SYS_TIME diff --git a/src/testlib/CMakeLists.txt b/src/testlib/CMakeLists.txt index bfd2b44104c..aa9597f9c4f 100644 --- a/src/testlib/CMakeLists.txt +++ b/src/testlib/CMakeLists.txt @@ -15,6 +15,7 @@ qt_internal_add_module(Test EXCEPTIONS SOURCES 3rdparty/cycle/cycle_p.h # Needed by tests, so visible to syncqt. + 3rdparty/cycle/cycle_include_p.h # Also needed by tests. 3rdparty/catch2/catch_p.h # Also needed by tests. removed_api.cpp # keep first qabstracttestlogger.cpp qabstracttestlogger_p.h diff --git a/src/testlib/qbenchmarktimemeasurers_p.h b/src/testlib/qbenchmarktimemeasurers_p.h index ce11a7dc6e8..9fda1c963b9 100644 --- a/src/testlib/qbenchmarktimemeasurers_p.h +++ b/src/testlib/qbenchmarktimemeasurers_p.h @@ -17,7 +17,7 @@ #include #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 8b7f7479751..d0f0e6b5638 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -37,7 +37,7 @@ #if QT_CONFIG(batch_test_support) #include #endif // QT_CONFIG(batch_test_support) -#include +#include #include #include #if defined(HAVE_XCTEST) diff --git a/src/testlib/qtestcrashhandler.cpp b/src/testlib/qtestcrashhandler.cpp index bc4e1629dd9..c2a10dedf64 100644 --- a/src/testlib/qtestcrashhandler.cpp +++ b/src/testlib/qtestcrashhandler.cpp @@ -37,7 +37,7 @@ #if QT_CONFIG(batch_test_support) #include #endif // QT_CONFIG(batch_test_support) -#include +#include #include #if defined(HAVE_XCTEST) #include diff --git a/tests/auto/testlib/selftests/benchlibtickcounter/tst_benchlibtickcounter.cpp b/tests/auto/testlib/selftests/benchlibtickcounter/tst_benchlibtickcounter.cpp index 204a28599ef..04371d30182 100644 --- a/tests/auto/testlib/selftests/benchlibtickcounter/tst_benchlibtickcounter.cpp +++ b/tests/auto/testlib/selftests/benchlibtickcounter/tst_benchlibtickcounter.cpp @@ -5,7 +5,7 @@ #include #include -#include +#include class tst_BenchlibTickCounter: public QObject { diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp index 82324e06bf9..a8dd8c6fc5a 100644 --- a/tests/auto/testlib/selftests/tst_selftests.cpp +++ b/tests/auto/testlib/selftests/tst_selftests.cpp @@ -21,7 +21,7 @@ QT_REQUIRE_CONFIG(process); #include -#include +#include #include