Skip to content

Commit a1dc1b5

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

3 files changed

Lines changed: 47 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: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,45 @@ 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_type=$($CXX --version | head -1 | cut -d' ' -f1)
18+
if [ "$cxx_type" = "Ubuntu" ]; then
19+
cxx_type=$($CXX --version | head -1 | cut -d' ' -f2)
20+
fi
21+
if [ "$cxx_type" = "g++" ]; then
22+
gcc_ver=$($CXX -dumpversion)
23+
./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"
24+
ec=$?
25+
if [ $ec -ne 0 ]; then
26+
exit $ec
27+
fi
28+
elif [ "$cxx_type" = "clang" ]; then
29+
#clang_ver=$($CXX -dumpversion)
30+
#clang_ver=${clang_ver%%.*}
31+
./simplecpp simplecpp.cpp -e -f -std=gnu++11 -D__BYTE_ORDER__ -I"/usr/include/c++/v1"
32+
ec=$?
33+
if [ $ec -ne 0 ]; then
34+
exit $ec
35+
fi
36+
elif [ "$cxx_type" = "Apple" ]; then
37+
#clang_ver=$($CXX -dumpversion)
38+
#clang_ver=${clang_ver%%.*}
39+
# 16.1 is a Xcode version common to all used platforms
40+
./simplecpp simplecpp.cpp -e -f -std=gnu++11 -D__BYTE_ORDER__ -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"
41+
ec=$?
42+
if [ $ec -ne 0 ]; then
43+
exit $ec
44+
fi
45+
else
46+
echo "unknown compiler '$cxx_type'"
47+
exit 1
48+
fi

0 commit comments

Comments
 (0)