From: Joel Rosdahl Date: Thu, 26 Jun 2025 19:16:57 +0000 (+0200) Subject: test: Add test for tricky preprocessed cache hit case X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4996e27cc90d5dfffc0658fba659788408f2a1d7;p=thirdparty%2Fccache.git test: Add test for tricky preprocessed cache hit case See PR #1594. --- diff --git a/test/suites/base.bash b/test/suites/base.bash index 6cbbaaeb..ac7bc157 100644 --- a/test/suites/base.bash +++ b/test/suites/base.bash @@ -1341,6 +1341,38 @@ EOF $CCACHE_COMPILE -Wall -W -c stderr.c 2>stderr.txt expect_equal_text_content reference_stderr.txt stderr.txt + # ------------------------------------------------------------------------- + TEST "Line number in compiler warning" + + cat <<'EOF' >hello.h +#define A a + +// comment + +#define B \ + x \ + y \ + z + +int hello(void) { + // trigger warning by having no return statement +} +EOF + cat <<'EOF' >hello.c +#include "hello.h" +EOF + + export CCACHE_DEBUG=1 + $COMPILER -c -Wall -c hello.c 2>stderr_1_ref.txt + $CCACHE_COMPILE -Wall -c hello.c 2>stderr_1.txt + expect_equal_text_content stderr_1_ref.txt stderr_1.txt + + sed -i 's/comment/comment\n/' hello.h + + $COMPILER -c -Wall -c hello.c 2>stderr_2_ref.txt + $CCACHE_COMPILE -Wall -c hello.c 2>stderr_2.txt + expect_equal_text_content stderr_2_ref.txt stderr_2.txt + # ------------------------------------------------------------------------- TEST "Merging stderr"