some clang plugins report bogus warnings (was: Re: GSoC Refactor god objects weekly report)

Michael Stahl mstahl at redhat.com
Tue Jul 29 02:59:23 PDT 2014


On 29/07/14 01:39, V wrote:
> This week I refactored IDocumentFieldsAccess and 
> IDocumentLineNumberAccess. To have something more in here for a change, 
> a few weeks ago I started using Clang instead of gcc and I like it much 
> better. I remember the time where I got an error message longer than my 
> terminal's scroll buffer because I forgot a closing "}" with gcc ;) .

yep clang's diagnostics are nice... though i hear that gcc 4.9 has
similar colourful error messages as clang, and that feature is
backported to Fedora's gcc 4.8 package too.

https://gcc.gnu.org/wiki/Better_Diagnostics

> The only thing bugging me is that the extern-and-not-defined plugin is 
> not really werror compatible because it seems to warn in a lot of 
> places. To disable it I moved into a "disabled" folder and told git to 
> ignore it so I dont commit that changed, but it seems to reappear 
> everytime I pull.

interesting ... i've had the same problem with 2 of the clang plugins;
at least with the clang packages on Fedora 20, they report warnings in
_header_ files despite the plugins having a check that the offending
statement "isInMainFile()" - perhaps it's some clang bug that does not
occur with the clang versions the authors of the plugins used?  well
there is macro expansion involved in the problems i saw, argh...

attached is the hack that i use to disable them :)

> After some googling I found a 
> good way to do this faster while still looking at every line I change: 
> grep "FROM" -rl --include="*.cxx" sw/ | parallel -j1 --tty vim -c 
> '"%s/FROM/TO/gc"' -c '"wq"' {}
> This uses gnu parallel and  launches vim for every occurences which 
> shows me the surrounding code and asks for confirmation for every replace.

yep that looks like a nice way to do that :)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang_plugin_disable.patch
Type: text/x-patch
Size: 688 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20140729/241ea7fe/attachment.bin>


More information about the LibreOffice mailing list