From 9d89e28f1cc5e75c9c75ec108b0dac922f23aaf8 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 17 Jun 2024 07:26:51 +0200 Subject: [PATCH] tst_moc: fix -Wvolatile Suppress the warning. Found that moc doesn't like QT_WARNING macros in Q_SIGNALS section and filed QTBUG-126395 to track the issue. Amends the start of the public history, but not picking back far, since older GCC could reject the suppression, and it's such a long-standing issue that fixing it in LTS branches is not worth the risk of breaking compilation. Task-number: QTBUG-119042 Task-number: QTBUG-126395 Change-Id: I15ba9ed3b83cce0f4c2a1536317e5167d56f3a57 Reviewed-by: Fabian Kosmale (cherry picked from commit 4111059b2ee3818ab68033198fb1dd057e6d09eb) Reviewed-by: Qt Cherry-pick Bot --- tests/auto/tools/moc/tst_moc.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index d24dfa11f7c..e1446cfe1ca 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -878,7 +878,14 @@ signals: void sigWithUnsignedArg(unsigned foo); void sigWithSignedArg(signed foo); void sigWithConstSignedArg(const signed foo); +#ifndef Q_MOC_RUN // QTBUG-126395 + QT_WARNING_PUSH + QT_WARNING_DISABLE_GCC("-Wvolatile") +#endif void sigWithVolatileConstSignedArg(volatile const signed foo); +#ifndef Q_MOC_RUN // QTBUG-126395 + QT_WARNING_POP +#endif void sigWithCustomType(const MyStruct); void constSignal1() const; void constSignal2(int arg) const; @@ -4710,4 +4717,7 @@ QTEST_MAIN(tst_Moc) #undef slots #undef emit +QT_WARNING_PUSH +QT_WARNING_DISABLE_GCC("-Wvolatile") // should moc itself add this in generated code? #include "tst_moc.moc" +QT_WARNING_POP