From: Debian Qt/KDE Maintainers Date: Mon, 13 Jun 2022 18:00:47 +0000 (+0100) Subject: handle even more include in enum cases X-Git-Tag: archive/raspbian/5.15.4+dfsg-3+rpi1^2~13 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=2a45344a028c2ef98e5a39fcc5e2309795ccbac9;p=qtbase-opensource-src.git handle even more include in enum cases Origin: upstream, https://code.qt.io/cgit/qt/qtbase.git/commit/?id=87973325f1b99f2b Last-Update: 2022-04-07 The solution in d3ed7dac8aa2f4ede0c409254b9dd44842086be0 was needlessly complicated, and broke a valid use case. The issue of no identifier being available to parse after the include has been processed can instead be solved by moving the test for the closing brace after the include processing. Gbp-Pq: Name moc_handle_include.diff --- diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index 738991991..28c7a43cb 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -305,10 +305,9 @@ bool Moc::parseEnum(EnumDef *def) return IncludeState::NoInclude; }; do { + handleInclude(); if (lookup() == RBRACE) // accept trailing comma break; - if ( handleInclude() == IncludeState::IncludeEnd) - continue; next(IDENTIFIER); def->values += lexem(); handleInclude(); diff --git a/tests/auto/tools/moc/enum_with_include.h b/tests/auto/tools/moc/enum_with_include.h index b8abf77f1..cd53ba6a2 100644 --- a/tests/auto/tools/moc/enum_with_include.h +++ b/tests/auto/tools/moc/enum_with_include.h @@ -34,6 +34,11 @@ class Foo : public QObject { enum en { #include }; + + enum class en2 { + #include + reference = 42 + }; Q_OBJECT }; #endif