Skip to content

Commit b79310d

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

3 files changed

Lines changed: 52 additions & 3 deletions

File tree

.github/workflows/CI-unixish.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ jobs:
2525
sudo apt-get update
2626
sudo apt-get install valgrind
2727
28+
- name: Install missing software on ubuntu (clang++)
29+
if: matrix.os == 'ubuntu-22.04' && matrix.compiler == 'clang++'
30+
run: |
31+
sudo apt-get update
32+
sudo apt-get install libc++-14-dev
33+
2834
- name: Install missing software on ubuntu (clang++)
2935
if: matrix.os == 'ubuntu-24.04' && matrix.compiler == 'clang++'
3036
run: |

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ test: testrunner simplecpp
1616
python3 -m pytest integration_test.py -vv
1717

1818
selfcheck: simplecpp
19-
./selfcheck.sh
19+
CXX=$(CXX) ./selfcheck.sh
2020

2121
simplecpp: main.o simplecpp.o
2222
$(CXX) $(LDFLAGS) main.o simplecpp.o -o simplecpp

selfcheck.sh

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,51 @@ output=$(./simplecpp simplecpp.cpp -e -f 2>&1)
44
ec=$?
55
errors=$(echo "$output" | grep -v 'Header not found: <')
66
if [ $ec -ne 0 ]; then
7-
# only fail if got errors which do not refer to missing system includes
7+
# only fail if we got errors which do not refer to missing system includes
88
if [ ! -z "$errors" ]; then
99
exit $ec
1010
fi
11-
fi
11+
fi
12+
13+
if [ -z "$CXX" ]; then
14+
exit 0
15+
fi
16+
17+
$CXX --version
18+
cxx_type=$($CXX --version | head -1 | cut -d' ' -f1)
19+
if [ "$cxx_type" = "Ubuntu" ]; then
20+
cxx_type=$($CXX --version | head -1 | cut -d' ' -f2)
21+
fi
22+
echo cxx_type=$cxx_type
23+
if [ "$cxx_type" = "g++" ]; then
24+
gcc_ver=$($CXX -dumpversion)
25+
find /usr/include -name cctype
26+
find /usr/include -name c++config.h
27+
./simplecpp simplecpp.cpp -e -f -std=gnu++11 -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" -I"/usr/include/x86_64-linux-gnu/c++/$gcc_ver/v1"
28+
ec=$?
29+
if [ $ec -ne 0 ]; then
30+
exit $ec
31+
fi
32+
elif [ "$cxx_type" = "clang" ]; then
33+
#clang_ver=$($CXX -dumpversion)
34+
#clang_ver=${clang_ver%%.*}
35+
find /usr/include -name cctype
36+
./simplecpp simplecpp.cpp -e -f -std=gnu++11 -D__BYTE_ORDER__ -I"/usr/include/c++/v1"
37+
ec=$?
38+
if [ $ec -ne 0 ]; then
39+
exit $ec
40+
fi
41+
elif [ "$cxx_type" = "Apple" ]; then
42+
#clang_ver=$($CXX -dumpversion)
43+
#clang_ver=${clang_ver%%.*}
44+
find /Applications -name cctype
45+
# 16.1 is an Xcode version common to all used platforms
46+
./simplecpp simplecpp.cpp -e -f -std=gnu++11 -I"/Applications/Xcode_16.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include"
47+
ec=$?
48+
if [ $ec -ne 0 ]; then
49+
exit $ec
50+
fi
51+
else
52+
echo "unknown compiler '$cxx_type'"
53+
exit 1
54+
fi

0 commit comments

Comments
 (0)