Re: [ccache] Bug with clang

2016-03-15 Thread Éric Chamberland



I added the option, at: https://github.com/jrosdahl/ccache/pull/74

ok, got it.  I tested it on the small example and everything is now 
fine... I'll install this version for now until an official release...



And maybe how to use ccache with clang should be better documented ?

Maybe... can't tell... I found your page as soon as I googled for "clang
ccache"... :)

Actually it should work out-of-the-box now, including the coloring.
It's also part of the test scope now, on both OS X and Linux (ELF).
Hopefully that means it'll continue to work, thanks to Travis CI.
I meant in the ccache manual, but who reads those things anyway :-)


It was only recently that the clang tests were fixed (396df7e), so it
seems like most developers are using gcc - and thus that is assumed.
I think we will see more things like this with GCC 5 (and later) too,
so some extra lines about source-level warnings are probably needed...

We use also gcc and ICC, but clang is there to help us write better
code... and documentation now... almost... :)

For now, the best workaround here is the "run_second_cpp" config.

Done! :)

And you now (soon) have a "keep_comments_cpp" config to complement it!

Excellent!


Now, wonder if ccache actually compiles with -Weverything enabled ?
Nope - that seems to take a lot of effort. Only 187 errors remaining.


Doh! :)  the quest for perfect code  Maybe -Weverything should be 
renamed -perfect ? :)


Thanks a lot for the quick implementation!  Hope it will be merged into 
the master for the next release...


Eric



/Anders
___
ccache mailing list
ccache@lists.samba.org
https://lists.samba.org/mailman/listinfo/ccache



___
ccache mailing list
ccache@lists.samba.org
https://lists.samba.org/mailman/listinfo/ccache


Re: [ccache] Bug with clang

2016-03-14 Thread Anders Björklund
Éric Chamberland wrote:
>>> How can I retrieve the documentation warnings with ccache?  Do I do
>>> something wrong?
>> Hmm, since you are using CCACHE_CPP2=1 you *should* be getting
>> source-level warnings too. However, if you cached the previous
>> result without using that setting (CCACHE_CPP2) you could still
>> get the cached results, i.e. the one without the extra warnings.
>>
>> But it is strange because CCACHE_CPP2 should be in the hash now.
>> Could be a bug with direct mode perhaps, that it never runs cpp.
>> It only looks at the (unchanged) files, and returns the cache...
>> If you clear the cache (or CCACHE_NODIRECT=1), does it remain ?
> ok, you are right.  I did many tries before writing the mail... and
> before finding your below mentioned web page, I tried without
> CCACHE_CPP2...
>
> Now, if I take care of doing a ccache -C before each configuration
> change, I can observe the warnings with ccache... So it was in fact
> cached when I tried the test and gave you the output...
>
> However, as pointed in my previous mail, the comments are not into the
> hash, then if I compile foo.cc with ccache and get the 3 warnings, then
> modify the documentation *without* changing the number of lines (ie:
> just change "\param" by "\note"), then the output is taken from the
> previous cached compilation... :/

Yeah, obviously I didn't think that one through completely :-)

For the hash to work (or rather: not work), then the preprocessor
needs to keep the comments in. Normally those don't affect the
object file, and discarding them is a feature - you get cache hits
when you only change a comment that doesn't affect the .o output.

But if you are using something like Doxygen, you do get output. Later.

And it does of course affect the .stderr output, that you were after.

>> So maybe only keeping comments is not enough, full source is needed ?
> For us, we compile with -Weverything, which is a lot more severe into
> the analysis.  We have to silent many warnings with "-Wno-*" options,
> but it is our burden to keep the code compiling "correctly", meaning
> absolutely no warnings.

Seems like both could be useful... (available as separate options)

> We have recently moved to use clang to check for documentation warnings
> too, to keep us from inserting new "bad" documentation... but we are
> used to compile with ccache+icecream or ccache alone (in our nightly
> tests and continuous integration) and don't want to work without
> ccache... it is unthinkable :)
>
> So, for me, the "keep comments" option, automated or not, is something I
> would try for sure, even if I have to compile a specific branch/sha of
> ccache... :)

I added the option, at: https://github.com/jrosdahl/ccache/pull/74

>> And maybe how to use ccache with clang should be better documented ?
> Maybe... can't tell... I found your page as soon as I googled for "clang
> ccache"... :)

Actually it should work out-of-the-box now, including the coloring.
It's also part of the test scope now, on both OS X and Linux (ELF).
Hopefully that means it'll continue to work, thanks to Travis CI.
I meant in the ccache manual, but who reads those things anyway :-)

>> It was only recently that the clang tests were fixed (396df7e), so it
>> seems like most developers are using gcc - and thus that is assumed.
>> I think we will see more things like this with GCC 5 (and later) too,
>> so some extra lines about source-level warnings are probably needed...
> We use also gcc and ICC, but clang is there to help us write better
> code... and documentation now... almost... :)
>> For now, the best workaround here is the "run_second_cpp" config.
> Done! :)

And you now (soon) have a "keep_comments_cpp" config to complement it!

Now, wonder if ccache actually compiles with -Weverything enabled ?
Nope - that seems to take a lot of effort. Only 187 errors remaining.

/Anders
___
ccache mailing list
ccache@lists.samba.org
https://lists.samba.org/mailman/listinfo/ccache


Re: [ccache] Bug with clang

2016-03-13 Thread Eric Chamberland

Just for fun...

I modified ccache.c with:

+   args_add(args, "-C");
args_add(args, "-E");

and it seems to work nicely... ;)

I will keep this small modification at work until an official release 
can support it...


Thanks,

Eric


___
ccache mailing list
ccache@lists.samba.org
https://lists.samba.org/mailman/listinfo/ccache


Re: [ccache] Bug with clang

2016-03-12 Thread Éric Chamberland



Le 16-03-12 12:15, Anders Björklund a écrit :

Eric Chamberland wrote:


We are happy using ccache with clang but I just discovered today that
ccache hides documentation warnings!

[...]

My CC* environment variables:

CCACHE_SLOPPINESS=include_file_mtime
CCACHE_DIR=/home/ccache/cmpbib/ccache
CCACHE_CPP2=yes
CCACHE_HARDLINK=1
CCACHE_HASHDIR=

How can I retrieve the documentation warnings with ccache?  Do I do
something wrong?

Hmm, since you are using CCACHE_CPP2=1 you *should* be getting
source-level warnings too. However, if you cached the previous
result without using that setting (CCACHE_CPP2) you could still
get the cached results, i.e. the one without the extra warnings.

But it is strange because CCACHE_CPP2 should be in the hash now.
Could be a bug with direct mode perhaps, that it never runs cpp.
It only looks at the (unchanged) files, and returns the cache...
If you clear the cache (or CCACHE_NODIRECT=1), does it remain ?
ok, you are right.  I did many tries before writing the mail... and 
before finding your below mentioned web page, I tried without CCACHE_CPP2...


Now, if I take care of doing a ccache -C before each configuration 
change, I can observe the warnings with ccache... So it was in fact 
cached when I tried the test and gave you the output...


However, as pointed in my previous mail, the comments are not into the 
hash, then if I compile foo.cc with ccache and get the 3 warnings, then 
modify the documentation *without* changing the number of lines (ie: 
just change "\param" by "\note"), then the output is taken from the 
previous cached compilation... :/




I can reproduce your problem without CCACHE_CPP2 (due to the .ii)
but I cannot reproduce it with CCACHE_CPP2 (when using the .cc) ?
Your suggestion to use -C with the -E is interesting, though you
would still get your macros expanded in warnings - and such*.

* http://peter.eisentraut.org/blog/2014/12/01/ccache-and-clang-part-3/

So maybe only keeping comments is not enough, full source is needed ?
For us, we compile with -Weverything, which is a lot more severe into 
the analysis.  We have to silent many warnings with "-Wno-*" options, 
but it is our burden to keep the code compiling "correctly", meaning 
absolutely no warnings.


We have recently moved to use clang to check for documentation warnings 
too, to keep us from inserting new "bad" documentation... but we are 
used to compile with ccache+icecream or ccache alone (in our nightly 
tests and continuous integration) and don't want to work without 
ccache... it is unthinkable :)


So, for me, the "keep comments" option, automated or not, is something I 
would try for sure, even if I have to compile a specific branch/sha of 
ccache... :)


And maybe how to use ccache with clang should be better documented ?
Maybe... can't tell... I found your page as soon as I googled for "clang 
ccache"... :)

It was only recently that the clang tests were fixed (396df7e), so it
seems like most developers are using gcc - and thus that is assumed.
I think we will see more things like this with GCC 5 (and later) too,
so some extra lines about source-level warnings are probably needed...
We use also gcc and ICC, but clang is there to help us write better 
code... and documentation now... almost... :)

For now, the best workaround here is the "run_second_cpp" config.

Done! :)

Thanks!

Eric



/Anders
___
ccache mailing list
ccache@lists.samba.org
https://lists.samba.org/mailman/listinfo/ccache



___
ccache mailing list
ccache@lists.samba.org
https://lists.samba.org/mailman/listinfo/ccache


Re: [ccache] Bug with clang

2016-03-12 Thread Anders Björklund
Eric Chamberland wrote:

> We are happy using ccache with clang but I just discovered today that
> ccache hides documentation warnings!
[...]
> My CC* environment variables:
>
> CCACHE_SLOPPINESS=include_file_mtime
> CCACHE_DIR=/home/ccache/cmpbib/ccache
> CCACHE_CPP2=yes
> CCACHE_HARDLINK=1
> CCACHE_HASHDIR=
>
> How can I retrieve the documentation warnings with ccache?  Do I do
> something wrong?

Hmm, since you are using CCACHE_CPP2=1 you *should* be getting
source-level warnings too. However, if you cached the previous
result without using that setting (CCACHE_CPP2) you could still
get the cached results, i.e. the one without the extra warnings.

But it is strange because CCACHE_CPP2 should be in the hash now.
Could be a bug with direct mode perhaps, that it never runs cpp.
It only looks at the (unchanged) files, and returns the cache...
If you clear the cache (or CCACHE_NODIRECT=1), does it remain ?


I can reproduce your problem without CCACHE_CPP2 (due to the .ii)
but I cannot reproduce it with CCACHE_CPP2 (when using the .cc) ?
Your suggestion to use -C with the -E is interesting, though you
would still get your macros expanded in warnings - and such*.

* http://peter.eisentraut.org/blog/2014/12/01/ccache-and-clang-part-3/

So maybe only keeping comments is not enough, full source is needed ?


And maybe how to use ccache with clang should be better documented ?

It was only recently that the clang tests were fixed (396df7e), so it
seems like most developers are using gcc - and thus that is assumed.
I think we will see more things like this with GCC 5 (and later) too,
so some extra lines about source-level warnings are probably needed...

For now, the best workaround here is the "run_second_cpp" config.

/Anders
___
ccache mailing list
ccache@lists.samba.org
https://lists.samba.org/mailman/listinfo/ccache


Re: [ccache] Bug with clang

2016-03-11 Thread Éric Chamberland

Hi,

to have documentation warnings working properly, I think it will be 
necessary to add "-C" to the preprocessor directives to keep the 
documentation into the preprocessed headers, so that if someone change 
only the documentation of the file, ccache will see the difference into 
the preprocessed file?


Can this be automatically added when clang -Wdocumentation or 
-Weverything is used?  Or may it be added by a ccache configuration 
variable?


Thanks,

Eric


Le 16-03-11 19:12, Eric Chamberland a écrit :

Hi,

We are happy using ccache with clang but I just discovered today that 
ccache hides documentation warnings!


I am using clang 3.7.1, ccache 3.2.4.

/opt/clang-3.7/bin/clang++ --version
clang version 3.7.1 (tags/RELEASE_371/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix

ccache --version
ccache version 3.2.4


Here is a small function file (foo.cc) with wrong doxygen documentation.

If I compile directly with clang++ I have 3 warnings:

===
/opt/clang-3.7/bin/clang++ -Weverything -c foo.cc
foo.cc:7:5: warning: '\return' command used in a comment that is 
attached to a function returning void [-Wdocumentation]

 * \return true there is no return value... 2nd warning
   ~^~~
foo.cc:5:11: warning: parameter 'pThis' not found in the function 
declaration [-Wdocumentation]

 * \param pThis there is no such param... 1st warning...
  ^
foo.cc:10:6: warning: no previous prototype for function 'foo' 
[-Wmissing-prototypes]

void foo(){}
 ^
===

ok, so far so good...


But if I compile it with ccache, the 2 warnings about documentation 
are disappearing:


ccache /opt/clang-3.7/bin/clang++ -Weverything -c foo.cc
foo.cc:10:6: warning: no previous prototype for function 'foo' 
[-Wmissing-prototypes]

void foo(){}

My CC* environment variables:

CCACHE_SLOPPINESS=include_file_mtime
CCACHE_DIR=/home/ccache/cmpbib/ccache
CCACHE_CPP2=yes
CCACHE_HARDLINK=1
CCACHE_HASHDIR=

How can I retrieve the documentation warnings with ccache?  Do I do 
something wrong?


Thanks,

Eric




___
ccache mailing list
ccache@lists.samba.org
https://lists.samba.org/mailman/listinfo/ccache


[ccache] Bug with clang

2016-03-11 Thread Eric Chamberland

Hi,

We are happy using ccache with clang but I just discovered today that 
ccache hides documentation warnings!


I am using clang 3.7.1, ccache 3.2.4.

/opt/clang-3.7/bin/clang++ --version
clang version 3.7.1 (tags/RELEASE_371/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix

ccache --version
ccache version 3.2.4


Here is a small function file (foo.cc) with wrong doxygen documentation.

If I compile directly with clang++ I have 3 warnings:

===
/opt/clang-3.7/bin/clang++ -Weverything -c foo.cc
foo.cc:7:5: warning: '\return' command used in a comment that is 
attached to a function returning void [-Wdocumentation]

 * \return true there is no return value... 2nd warning
   ~^~~
foo.cc:5:11: warning: parameter 'pThis' not found in the function 
declaration [-Wdocumentation]

 * \param pThis there is no such param... 1st warning...
  ^
foo.cc:10:6: warning: no previous prototype for function 'foo' 
[-Wmissing-prototypes]

void foo(){}
 ^
===

ok, so far so good...


But if I compile it with ccache, the 2 warnings about documentation are 
disappearing:


ccache /opt/clang-3.7/bin/clang++ -Weverything -c foo.cc
foo.cc:10:6: warning: no previous prototype for function 'foo' 
[-Wmissing-prototypes]

void foo(){}

My CC* environment variables:

CCACHE_SLOPPINESS=include_file_mtime
CCACHE_DIR=/home/ccache/cmpbib/ccache
CCACHE_CPP2=yes
CCACHE_HARDLINK=1
CCACHE_HASHDIR=

How can I retrieve the documentation warnings with ccache?  Do I do 
something wrong?


Thanks,

Eric

/*!
 *
 * A simple example of wring doxygen documentation that clang must warn about..
 *
 * \param pThis there is no such param... 1st warning...
 *
 * \return true there is no return value... 2nd warning
 *
 */
void foo(){}

___
ccache mailing list
ccache@lists.samba.org
https://lists.samba.org/mailman/listinfo/ccache