[ccache] [PATCH] Add support for the -x GCC switch

Joel Rosdahl joel at rosdahl.net
Sat Apr 17 11:08:50 MDT 2010


On 2010-04-16 22:11, Dirk Best wrote:

> this patch adds support for the -x GCC switch that allows one to
> specify the language of the source file independently of the file
> extension.

Thanks!

I see that you reuse the extensions array to find out the language, but 
that will only handle the c and c++ cases. It would be nice to handle 
c-cpp-output and c++-cpp-output as well. Another minor problem is that 
ccache will accept things like "-x cc", while gcc will not. Also, it 
seems that GCC accepts both "-x language" and "-xlanguage" forms; we 
should handle this as well.

I think it would be better to have a separate array to map language to 
source code extension:

     c -> c
     c-cpp-output -> i
     c++ -> c++
     c++-cpp-output -> ii
     otherwise -> stats_update(STATS_UNSUPPORTED); failed();

And then we can use the extensions array to find out i_extension.

What do you think?

-- Joel


More information about the ccache mailing list