From: Anders Björklund Date: Thu, 14 Jul 2016 15:28:20 +0000 (+0200) Subject: Add test for certain gcc compilers with buggy cpp X-Git-Tag: v3.2.7~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7899edd41c7d4943604ef56c0bcecfa81e10abb1;p=thirdparty%2Fccache.git Add test for certain gcc compilers with buggy cpp The preprocessor in later gcc versions is buggy, returning extra lines and different "line numbers": # 1 "" # 1 "" # 31 "" # 1 "/usr/include/stdc-predef.h" 1 3 4 # 32 "" 2 But it only does this when there are no macros, otherwise (with -D) it returns the regular output: # 1 "" # 1 "" # 1 "/usr/include/stdc-predef.h" 1 3 4 # 1 "" 2 --- diff --git a/test.sh b/test.sh index 2f3a45af2..30aa3eb71 100755 --- a/test.sh +++ b/test.sh @@ -2432,6 +2432,38 @@ b" b" } +buggy_cpp_suite() { + testname="buggy_cpp" + $CCACHE -Cz >/dev/null + cat >buggy-cpp </dev/null; then + $COMPILER "\$@" +else + # mistreat the preprocessor output in the same way as gcc6 does + $COMPILER "\$@" | + sed -e '/^# 1 ""$/ a # 31 ""' \\ + -e 's/^# 1 "" 2$/# 32 "" 2/' +fi +exit 0 +EOF + cat <<'EOF' >file.c +int foo; +EOF + chmod +x buggy-cpp + backdate buggy-cpp + $CCACHE ./buggy-cpp -c file.c + checkstat 'cache hit (direct)' 0 + checkstat 'cache hit (preprocessed)' 0 + checkstat 'cache miss' 1 + $CCACHE ./buggy-cpp -DNOT_AFFECTING=1 -c file.c + checkstat 'cache hit (direct)' 0 + checkstat 'cache hit (preprocessed)' 1 + checkstat 'cache miss' 1 +} + symlinks_suite() { ################################################################## testname="symlink to source directory" @@ -2598,6 +2630,7 @@ pch symlinks upgrade prefix +buggy_cpp " case $host_os in