[ccache] cache hides compiler warnings about comments

Akim Demaille akim at lrde.epita.fr
Tue Oct 22 07:59:55 MDT 2013


Hi!

Since the comments are removed by the preprocessor, they
don't make it to the compiler, which in turn cannot make
warnings about comments.

This source file has issues in genuine code, and in comments:

    $ cat foo.cc
    /// \param foo
    static int i;
    int main() {}

The compiler complains about both (-Wdocumentation is really
all about comments):

    $ clang++-mp-3.4 -Wdocumentation -Wunused -c foo.cc
    foo.cc:1:6: warning: '\param' command used in a comment that is not attached to a function declaration [-Wdocumentation]
    /// \param foo
         ^~~~~
    foo.cc:1:14: warning: empty paragraph passed to '\param' command [-Wdocumentation]
    /// \param foo
        ~~~~~~~~~^
    foo.cc:2:12: warning: unused variable 'i' [-Wunused-variable]
    static int i;
               ^
    3 warnings generated.

But ccache shows just one kind of issue:

    $ ccache clang++-mp-3.4 -Wdocumentation -Wunused -c foo.cc
    foo.cc:2:12: warning: unused variable 'i' [-Wunused-variable]
    static int i;
               ^
    1 warning generated.

Compilers such as gcc/clang support -C/-CC to leave comments
in the preprocessed output.  Wouldn't it make sense to use it
in ccache?  That would keep such warnings alive:

    $ ccache clang++-mp-3.4 -Wdocumentation -Wunused -c -C foo.cc
    clang: warning: argument unused during compilation: '-C'
    foo.cc:1:6: warning: '\param' command used in a comment that is not attached to a function declaration [-Wdocumentation]
    /// \param foo
         ^~~~~
    foo.cc:1:14: warning: empty paragraph passed to '\param' command [-Wdocumentation]
    /// \param foo
        ~~~~~~~~~^
    foo.cc:2:12: warning: unused variable 'i' [-Wunused-variable]
    static int i;
               ^
    3 warnings generated.

Thanks!


More information about the ccache mailing list