1SUITE_input_charset_PROBE() {
2    touch test.c
3    if ! $REAL_COMPILER -c -finput-charset=latin1 test.c >/dev/null 2>&1; then
4        echo "compiler doesn't support -finput-charset"
5    fi
6}
7
8SUITE_input_charset() {
9    # -------------------------------------------------------------------------
10    TEST "-finput-charset"
11
12    printf '#include <wchar.h>\nwchar_t foo[] = L"\xbf";\n' >latin1.c
13
14    $CCACHE_COMPILE -c -finput-charset=latin1 latin1.c
15    expect_stat 'cache hit (preprocessed)' 0
16    expect_stat 'cache miss' 1
17
18    $CCACHE_COMPILE -c -finput-charset=latin1 latin1.c
19    expect_stat 'cache hit (preprocessed)' 1
20    expect_stat 'cache miss' 1
21
22    CCACHE_NOCPP2=1 $CCACHE_COMPILE -c -finput-charset=latin1 latin1.c
23    expect_stat 'cache hit (preprocessed)' 1
24    expect_stat 'cache miss' 2
25
26    CCACHE_NOCPP2=1 $CCACHE_COMPILE -c -finput-charset=latin1 latin1.c
27    expect_stat 'cache hit (preprocessed)' 2
28    expect_stat 'cache miss' 2
29}
30