From: Joel Rosdahl Date: Wed, 27 Jul 2016 09:05:38 +0000 (+0200) Subject: Bail out on too hard compiler option -P X-Git-Tag: v3.3~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3f41319d8e457010106b2f87b123fe3beb302183;p=thirdparty%2Fccache.git Bail out on too hard compiler option -P --- diff --git a/NEWS.txt b/NEWS.txt index 46d2a3343..d7930c89e 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -72,6 +72,8 @@ New features and improvements Bug fixes ~~~~~~~~~ +- Bail out on too hard compiler option `-P`. + - Fixed clang test suite when running on Linux. - Fixed build and test for MinGW32 and Windows. diff --git a/compopt.c b/compopt.c index 74ad990aa..e5bee2348 100644 --- a/compopt.c +++ b/compopt.c @@ -46,6 +46,7 @@ static const struct compopt compopts[] = { {"-MM", TOO_HARD}, {"-MQ", TAKES_ARG}, {"-MT", TAKES_ARG}, + {"-P", TOO_HARD}, {"-U", AFFECTS_CPP | TAKES_ARG | TAKES_CONCAT_ARG}, {"-V", TAKES_ARG}, {"-Xassembler", TAKES_ARG}, diff --git a/test.sh b/test.sh index 0f1426195..abfa000ed 100755 --- a/test.sh +++ b/test.sh @@ -960,6 +960,19 @@ EOF expect_stat 'cache miss' 1 expect_stat 'files in cache' 0 + # ------------------------------------------------------------------------- + TEST "-P" + + # Check that -P disables ccache. (-P removes preprocessor information in + # such a way that the object file from compiling the preprocessed file will + # not be equal to the object file produced when compiling without ccache.) + + $CCACHE_COMPILE -c -P test1.c + expect_stat 'cache hit (direct)' 0 + expect_stat 'cache hit (preprocessed)' 0 + expect_stat 'cache miss' 0 + expect_stat 'unsupported compiler option' 1 + # ------------------------------------------------------------------------- TEST "-Wp,-P"