[PATCH] Introducing compiler plugin support
Lubos Lunak
l.lunak at suse.cz
Tue Oct 9 08:26:18 PDT 2012
On Friday 05 of October 2012, Lubos Lunak wrote:
> Hello,
>
> attached is my implementation of basic build support for using Clang
> compiler plugin during building LO. I'm posting it here first in case our
> build system people have different ideas to how I have integrated it in the
> build system, if there are no comments, I will push it.
Pushed. There is a README included, but some highlights:
- is enabled automatically by --enable-dbgutil if Clang headers are found or
manually using --enable-compiler-plugins
- I'll enable it for the Clang tinderbox soon
- for the time being, -Werror does not affect these warnings, just in case
somebody builds with --enable-dbgutil --enable-werror, for obvious reasons
below
- there is a warning about unused variables of types marked SAL_WARN_UNUSED
plus some C++ std classes ; quite a number of hits. Feel free to tag all
those Point, Rectangle, etc. classes with it too, as long as it's certain for
the class that a mere presence of a variable of that type does nothing in
practice.
- there is a warning about
if( a != 0 )
b = 2;
c = 3;
which triggers a lot of warnings, many of them about code like
if( a == 1 )
foo();
else
if( a == 2 )
bar();
whatever();
This is a valid warning, because it may appear that the whatever() call is
part of the else block. I consider this to be poorly formatted code and find
moving the second if up to the else line a much better solution than trying
to detect this case in the compiler check.
There may be possibly some problems that I haven't noticed, so feel free to
point out whatever you thing the plugin detects wrong. I'll eventually
make -Werror have an effect on these too for the --enable-werror crowd.
On Monday 08 of October 2012, Michael Stahl wrote:
> On 05/10/12 18:22, Lubos Lunak wrote:
> > +$(CLANGOUTDIR)/compileplugin.so: $(2)
> > +$(CLANGOUTDIR)/compileplugin.so: CLANGOBJS += $(2)
> > +
> > +$(CLANGOUTDIR)/compileplugin.so: $(CLANGOBJS)
>
> there's a bit of redundancy there.
That actually seems to be needed for whatever reason.
--
Lubos Lunak
l.lunak at suse.cz
More information about the LibreOffice
mailing list