[Qt-creator] Turn off "suggest-override" clang-tidy warning?
Eike.Ziller at qt.io
Tue May 11 10:40:46 CEST 2021
> On May 11, 2021, at 02:36, Andy <asmaloney at gmail.com> wrote:
> Thanks Eike.
> The project is based on Qt 5.15.2. ClangCodeModel is on.
> I have it set in the Analyzer prefs to "Analyze open files". Both clang-tidy & clazy point to the executables in QtCreator.app.
> When I run "clang-tidy & clazy" manually through the Debug tab, it shows:
> warning: 'metaObject' overrides a member function but is not marked 'override' [suggest-override]
> warning: 'qt_metacall' overrides a member function but is not marked 'override' [suggest-override]
> warning: 'qt_metacast' overrides a member function but is not marked 'override' [suggest-override]
> And the tooltip on them has the link from my first email.
> But it doesn't show the warning inline in the editor on the Q_OBJECT line. (I'm fairly sure it was showing those when I reported it? I don't know - I'm sleep deprived.)
We suppress these warnings in the clang code model, because Qt only started suppressing these warnings in some Qt 5.x version.
> Adding "-Wno-suggest-override" to analyzer's Clang Warnings DOES fix it, so thank you! Still don't understand where it's coming from though.
It looks like Clang got this new warning (that already existed for GCC) in Clang 11 (which we ship with Qt Creator).
Q_OBJECT seems to only suppress suggest-override for GCC though:
I fail to reproduce this warning here though.
> I'm also confused why we have Clang Warning "Diagnostic Configurations" under both the "C++ -> Code Model" and "Analyzer".
So you could have a small, most important set of clang warnings for the code model, and a wider set of clang warnings when you trigger the Analyzer manually.
> Andy Maloney // https://asmaloney.com
> twitter ~ @asmaloney
> On Mon, May 10, 2021 at 2:58 AM Eike Ziller <Eike.Ziller at qt.io> wrote:
> > On May 7, 2021, at 23:26, Andy <asmaloney at gmail.com> wrote:
> > How do I turn off the "suggest-override" tidy warning? The tooltip for it points at a non-existent clang-tidy page:
> > https://releases.llvm.org/11.0.0/tools/clang/tools/extra/docs/clang-tidy/checks/suggest-override.html
> > It is triggered by every use of Q_OBJECT.
> Do you have a bit more information?
> Are you using an old Qt version? I remember Q_OBJECT triggering override related compilation warnings once upon a time.
> Does it go away if you remove all clang-tidy and clazy checks?
> I wonder if this isn’t actually a compiler warning from clang (the clang code model, -Wsuggest-override). Does adding -Wno-suggest-override to the _clang warnings_ help?
> Though I wonder how Qt Creator comes up with that URL above.
> Br, Eike
> > The only clang-tidy option I can find relating to overrides is called "modernize-use-override" which I have turned off.
> > https://releases.llvm.org/11.0.0/tools/clang/tools/extra/docs/clang-tidy/checks/modernize-use-override.html
> > Using the clang-tidy included with Qt Creator 4.15
> > macOS 10.14.6
> > ---
> > Andy Maloney // https://asmaloney.com
> > twitter ~ @asmaloney
> > _______________________________________________
> > Qt-creator mailing list
> > Qt-creator at qt-project.org
> > https://lists.qt-project.org/listinfo/qt-creator
> Eike Ziller
> Principal Software Engineer
> The Qt Company GmbH
> Erich-Thilo-Straße 10
> D-12489 Berlin
> eike.ziller at qt.io
> Geschäftsführer: Mika Pälsi,
> Juha Varelius, Jouni Lintunen
> Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B
Principal Software Engineer
The Qt Company GmbH
eike.ziller at qt.io
Geschäftsführer: Mika Pälsi,
Juha Varelius, Jouni Lintunen
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B
More information about the Qt-creator