Skip to content

Commit cceba58

Browse files
committed
selfcheck.sh: also run with system includes made available
1 parent 435a74c commit cceba58

1 file changed

Lines changed: 24 additions & 1 deletion

File tree

selfcheck.sh

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,34 @@
11
#!/bin/sh
22

3+
set -x
4+
35
output=$(./simplecpp simplecpp.cpp -e -f 2>&1)
46
ec=$?
57
errors=$(echo "$output" | grep -v 'Header not found: <')
68
if [ $ec -ne 0 ]; then
7-
# only fail if got errors which do not refer to missing system includes
9+
# only fail if we got errors which do not refer to missing system includes
810
if [ ! -z "$errors" ]; then
911
exit $ec
1012
fi
13+
fi
14+
15+
# on macOS gcc is an alias for clang
16+
gcc_type=$(gcc --version | head -1 | cut -d' ' -f1)
17+
if [ "$gcc_type" = "gcc" ]; then
18+
gcc_ver=$(gcc -dumpversion)
19+
./simplecpp simplecpp.cpp -e -f -D__GNUC__ -D__STDC__ -D__STDC_HOSTED__ -D__CHAR_BIT__=8 -I"/usr/include" -I"/usr/include/linux" -I"/usr/include/c++/$gcc_ver" -I"/usr/include/c++/$gcc_ver/x86_64-pc-linux-gnu" -I"/usr/lib64/gcc/x86_64-pc-linux-gnu/$gcc_ver/include"
20+
ec=$?
21+
if [ $ec -ne 0 ]; then
22+
exit $ec
23+
fi
24+
fi
25+
26+
if [ -d "/usr/include/c++/v1" ]; then
27+
#clang_ver=$(clang -dumpversion)
28+
#clang_ver=${clang_ver%%.*}
29+
./simplecpp simplecpp.cpp -e -f -D__BYTE_ORDER__ -I"/usr/include/c++/v1"
30+
ec=$?
31+
if [ $ec -ne 0 ]; then
32+
exit $ec
33+
fi
1134
fi

0 commit comments

Comments
 (0)