]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Bail out on too hard compiler option -P
authorJoel Rosdahl <joel@rosdahl.net>
Wed, 27 Jul 2016 09:05:38 +0000 (11:05 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Wed, 27 Jul 2016 18:00:10 +0000 (20:00 +0200)
NEWS.txt
compopt.c
test.sh

index 46d2a33437dedf808297f3af2a17f499d7def00f..d7930c89e0c9df1304832c5108e3e06c19a11bc2 100644 (file)
--- 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.
index 74ad990aad2f8105315815800ddff4a2a1e75b8c..e5bee23483b1c7509ad51570ce8b57b1eeb1b10a 100644 (file)
--- 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 0f142619525af3510e7c0b9d6a9d6aa13af42248..abfa000ed196876affde5e8f37a799191d2f52c2 100755 (executable)
--- 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"