diff options
author | Joel Rosdahl <joel@rosdahl.net> | 2016-07-27 20:49:00 +0200 |
---|---|---|
committer | Joel Rosdahl <joel@rosdahl.net> | 2016-07-27 22:13:24 +0200 |
commit | eb3148ca25cb90ef74570c8503d91dc1fe30904d (patch) | |
tree | ca606d115b24d85c0c1b974fb01946b8a6f825af /test.sh | |
parent | 5afd456829563fe7e8bf48df3e659f7c7d535a8e (diff) | |
download | ccache-eb3148ca25cb90ef74570c8503d91dc1fe30904d.tar.gz |
Let run_second_cpp default to true
ccache has since day 1 (OK, actually day 13: 5f6f5010) relied on the
fact that GCC and similar enough compilers are able to compile their own
preprocessed output with the same outcome as if they compiled the real
source code directly.
However, newer versions of GCC no longer quite work this way since they
perform an increasing amount of diagnostics analysis only if the source
code is compiled directly. The same goes for Clang. It's impossible for
ccache to work around this changed behavior in a good way.
Closes #116.
Diffstat (limited to 'test.sh')
-rwxr-xr-x | test.sh | 40 |
1 files changed, 13 insertions, 27 deletions
@@ -176,9 +176,9 @@ TEST() { unset CCACHE_BASEDIR unset CCACHE_CC + unset CCACHE_COMMENTS unset CCACHE_COMPILERCHECK unset CCACHE_COMPRESS - unset CCACHE_COMMENTS unset CCACHE_CPP2 unset CCACHE_DIR unset CCACHE_DISABLE @@ -189,6 +189,7 @@ TEST() { unset CCACHE_IGNOREHEADERS unset CCACHE_LOGFILE unset CCACHE_NLEVELS + unset CCACHE_NOCPP2 unset CCACHE_NOSTATS unset CCACHE_PATH unset CCACHE_PREFIX @@ -388,20 +389,6 @@ base_tests() { expect_equal_object_files reference_test1.o test1.o # ------------------------------------------------------------------------- - TEST "CCACHE_CPP2" - - CCACHE_CPP2=1 $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - - CCACHE_CPP2=1 $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 - - $UNCACHED_COMPILE -c -o reference_test1.o test1.c - expect_equal_object_files reference_test1.o test1.o - - # ------------------------------------------------------------------------- TEST "CCACHE_NOSTATS" CCACHE_NOSTATS=1 $CCACHE_COMPILE -c test1.c -O -O @@ -1097,12 +1084,12 @@ SUITE_base() { # ============================================================================= -SUITE_cpp2_SETUP() { - export CCACHE_CPP2=1 +SUITE_nocpp2_SETUP() { + export CCACHE_NOCPP2=1 generate_code 1 test1.c } -SUITE_cpp2() { +SUITE_nocpp2() { base_tests } @@ -1150,8 +1137,7 @@ SUITE_serialize_diagnostics() { $UNCACHED_COMPILE -c --serialize-diagnostics expected.dia test1.c - # Run with CCACHE_CPP2 to ensure the same diagnostics output as above - CCACHE_CPP2=1 $CCACHE_COMPILE -c --serialize-diagnostics test.dia test1.c + $CCACHE_COMPILE -c --serialize-diagnostics test.dia test1.c expect_stat 'cache hit (preprocessed)' 0 expect_stat 'cache miss' 1 expect_stat 'files in cache' 2 @@ -1159,7 +1145,7 @@ SUITE_serialize_diagnostics() { rm test.dia - CCACHE_CPP2=1 $CCACHE_COMPILE -c --serialize-diagnostics test.dia test1.c + $CCACHE_COMPILE -c --serialize-diagnostics test.dia test1.c expect_stat 'cache hit (preprocessed)' 1 expect_stat 'cache miss' 1 expect_stat 'files in cache' 2 @@ -1173,7 +1159,7 @@ SUITE_serialize_diagnostics() { test_failed "Expected an error compiling error.c" fi - CCACHE_CPP2=1 $CCACHE_COMPILE -c --serialize-diagnostics test.dia error.c 2>test.stderr + $CCACHE_COMPILE -c --serialize-diagnostics test.dia error.c 2>test.stderr expect_stat 'compile failed' 1 expect_stat 'cache hit (preprocessed)' 0 expect_stat 'cache miss' 0 @@ -3182,19 +3168,19 @@ SUITE_input_charset() { printf '#include <wchar.h>\nwchar_t foo[] = L"\xbf";\n' >latin1.c - CCACHE_CPP2=1 $CCACHE_COMPILE -c -finput-charset=latin1 latin1.c + $CCACHE_COMPILE -c -finput-charset=latin1 latin1.c expect_stat 'cache hit (preprocessed)' 0 expect_stat 'cache miss' 1 - CCACHE_CPP2=1 $CCACHE_COMPILE -c -finput-charset=latin1 latin1.c + $CCACHE_COMPILE -c -finput-charset=latin1 latin1.c expect_stat 'cache hit (preprocessed)' 1 expect_stat 'cache miss' 1 - $CCACHE_COMPILE -c -finput-charset=latin1 latin1.c + CCACHE_NOCPP2=1 $CCACHE_COMPILE -c -finput-charset=latin1 latin1.c expect_stat 'cache hit (preprocessed)' 1 expect_stat 'cache miss' 2 - $CCACHE_COMPILE -c -finput-charset=latin1 latin1.c + CCACHE_NOCPP2=1 $CCACHE_COMPILE -c -finput-charset=latin1 latin1.c expect_stat 'cache hit (preprocessed)' 2 expect_stat 'cache miss' 2 } @@ -3307,7 +3293,7 @@ cd $TESTDIR || exit 1 all_suites=" base -cpp2 +nocpp2 multi_arch serialize_diagnostics debug_prefix_map |