]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Add pch test suite probe for seemingly broken compiler support
authorJoel Rosdahl <joel@rosdahl.net>
Sat, 22 Feb 2020 21:18:48 +0000 (22:18 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sat, 22 Feb 2020 21:18:48 +0000 (22:18 +0100)
This fixes a problem mentioned by Orion Poplawski in a comment to PR #217.

test/suites/pch.bash

index caf82c4598f4bf1ad4ca8a62c9c5711e85285520..f779a36f6a7a8a124f6e6be83dccf57a3517ca20 100644 (file)
@@ -1,8 +1,15 @@
 SUITE_pch_PROBE() {
-    touch pch.h
+    touch pch.h empty.c
+    mkdir dir
+
     if ! $REAL_COMPILER $SYSROOT -fpch-preprocess pch.h 2>/dev/null \
             || [ ! -f pch.h.gch ]; then
-        echo "compiler ($($COMPILER --version | head -1)) doesn't support precompiled headers"
+        echo "compiler ($($COMPILER --version | head -n 1)) doesn't support precompiled headers"
+    fi
+
+    $REAL_COMPILER $SYSROOT -c pch.h -o dir/pch.h.gch 2>/dev/null
+    if ! $REAL_COMPILER $SYSROOT -c -include dir/pch.h empty.c 2>/dev/null; then
+        echo "compiler ($($COMPILER --version | head -n 1)) seems to have broken support for precompiled headers"
     fi
 }