disabling compiler warnings in Creator editor?
-
wrote on 31 Jul 2018, 21:21 last edited by
Hi -
Is there a way to disable (selectively or otherwise) the compiler warnings that show up in Creator? I'm aware that I can eliminate the text of the warning by turning off line annotations, but I'm wondering whether I can eliminate them entirely.
The warning in question is about the use of old-style casting. I can eliminate this at compile time with -Wno-old-style-cast, but I don't know how to apply that to the editor.
Thanks...
-
Hi,
Not in the editor (it's unrelated to it), but you can disable that in your .pro file by setting the appropriate compiler flag.
-
Hi,
Not in the editor (it's unrelated to it), but you can disable that in your .pro file by setting the appropriate compiler flag.
-
AFAIK, if you eliminate it at compile time, it should not appear in the list either.
-
wrote on 31 Jul 2018, 21:32 last edited by
Hmm...did I not properly form this line in my .pro file?
QMAKE_CXXFLAGS += "-Wno-old-style-cast"
-
-
wrote on 31 Jul 2018, 22:02 last edited by
-
@mzimmers
Ok it looks clangcode model but not 100% sure
Try Help->Plugins
Disable it and restart Creator and see.
-
wrote on 31 Jul 2018, 22:20 last edited by
Mrjj: that was it. Thanks very much...I'd never really had reason to look at code model options before, so I never would have found that.
-
Mrjj: that was it. Thanks very much...I'd never really had reason to look at code model options before, so I never would have found that.
@mzimmers If it is your own code you should rather fix these warnings instead of ignoring them.
-
Lifetime Qt Championwrote on 1 Aug 2018, 05:38 last edited by aha_1980 8 Jan 2018, 05:38
Hi @mzimmers,
As already said, better is fixing that issues - but sometimes you cannot do it for legacy projects.
Solution in that case is not to disable the Clang plugin, but to configure it:
Tools > Options > C++ > Code Model > Clang Code Model > Manage
There you can create your own config and apply either global or for a single project.
Regards
PS: The config switch you are looking for should be
-Wno-old-style-cast
-
wrote on 1 Aug 2018, 14:19 last edited by
Thanks, aha. In this case, the warnings come header files supplied by a third party and intended for use with C (which I don't believe has the modern casts yet, and in any event, needs to be retroactively compatible with older compilers), so fixing them is out.
Thanks for the lesson on managing the code model...another part of Creator I'd never used, so that was a good thing to get exposed to.
-
Thanks, aha. In this case, the warnings come header files supplied by a third party and intended for use with C (which I don't believe has the modern casts yet, and in any event, needs to be retroactively compatible with older compilers), so fixing them is out.
Thanks for the lesson on managing the code model...another part of Creator I'd never used, so that was a good thing to get exposed to.
wrote on 1 Aug 2018, 14:48 last edited byYou may also tune the clang code model and ignore single warnings to be displayed in the editor.
You may want to check out last of post here
Possibly you can switch off the macros before and on after the include. I would expect that the clang code model will be able to pick it up. As said by many before, it is not a good idea to ignore warnings. As a matter of fact I start to love the warnings shown directly in the code editor. Even though it is a bit confusing the first time ;)
1/13