Skip to content

Commit d602288

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

3 files changed

Lines changed: 55 additions & 3 deletions

File tree

.github/workflows/CI-unixish.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ jobs:
77

88
strategy:
99
matrix:
10+
# TODO: do not run g++ on macos-* as it is just an alias for clang++
1011
compiler: [clang++, g++]
1112
os: [ubuntu-22.04, ubuntu-24.04, macos-13, macos-14, macos-15]
1213
fail-fast: false
@@ -25,6 +26,12 @@ jobs:
2526
sudo apt-get update
2627
sudo apt-get install valgrind
2728
29+
- name: Install missing software on ubuntu (clang++)
30+
if: matrix.os == 'ubuntu-22.04' && matrix.compiler == 'clang++'
31+
run: |
32+
sudo apt-get update
33+
sudo apt-get install libc++-14-dev
34+
2835
- name: Install missing software on ubuntu (clang++)
2936
if: matrix.os == 'ubuntu-24.04' && matrix.compiler == 'clang++'
3037
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: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,56 @@
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
11-
fi
13+
fi
14+
15+
if [ -z "$CXX" ]; then
16+
exit 0
17+
fi
18+
19+
$CXX --version
20+
cxx_type=$($CXX --version | head -1 | cut -d' ' -f1)
21+
if [ "$cxx_type" = "Ubuntu" ]; then
22+
cxx_type=$($CXX --version | head -1 | cut -d' ' -f2)
23+
fi
24+
echo cxx_type=$cxx_type
25+
if [ "$cxx_type" = "g++" ]; then
26+
gcc_ver=$($CXX -dumpversion)
27+
find /usr/include -name cctype
28+
find /usr/include -name c++config.h
29+
./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"
30+
ec=$?
31+
if [ $ec -ne 0 ]; then
32+
exit $ec
33+
fi
34+
elif [ "$cxx_type" = "clang" ]; then
35+
#clang_ver=$($CXX -dumpversion)
36+
#clang_ver=${clang_ver%%.*}
37+
find /usr/include -name cctype
38+
./simplecpp simplecpp.cpp -e -f -std=gnu++11 -D__BYTE_ORDER__ -I"/usr/include/c++/v1"
39+
ec=$?
40+
if [ $ec -ne 0 ]; then
41+
exit $ec
42+
fi
43+
elif [ "$cxx_type" = "Apple" ]; then
44+
#clang_ver=$($CXX -dumpversion)
45+
#clang_ver=${clang_ver%%.*}
46+
find /Applications -name cctype
47+
# 16.1 is a Xcode version common to all used platforms
48+
./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" -I"/Applications/Xcode_16.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1"
49+
ec=$?
50+
if [ $ec -ne 0 ]; then
51+
exit $ec
52+
fi
53+
else
54+
echo "unknown compiler '$cxx_type'"
55+
exit 1
56+
fi

0 commit comments

Comments
 (0)