File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ test: testrunner simplecpp
1616 python3 -m pytest integration_test.py -vv
1717
1818selfcheck : simplecpp
19- ./selfcheck.sh
19+ CXX= $( CXX ) ./selfcheck.sh
2020
2121simplecpp : main.o simplecpp.o
2222 $(CXX ) $(LDFLAGS ) main.o simplecpp.o -o simplecpp
Original file line number Diff line number Diff line change @@ -4,8 +4,45 @@ output=$(./simplecpp simplecpp.cpp -e -f 2>&1)
44ec=$?
55errors=$( echo " $output " | grep -v ' Header not found: <' )
66if [ $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+ echo cxx_type=$cxx_type
19+ if [ " $cxx_type " = " g++" ] || [ " $cxx_type " = " Ubuntu" ]; then # on ubuntu 22.04 there is an "Ubuntu" prefix
20+ gcc_ver=$( $CXX -dumpversion)
21+ find /usr/include -name cctype
22+ ./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"
23+ ec=$?
24+ if [ $ec -ne 0 ]; then
25+ exit $ec
26+ fi
27+ elif [ " $cxx_type " = " clang" ]; then
28+ # clang_ver=$($CXX -dumpversion)
29+ # clang_ver=${clang_ver%%.*}
30+ ./simplecpp simplecpp.cpp -e -f -std=gnu++11 -D__BYTE_ORDER__ -I" /usr/include/c++/v1"
31+ ec=$?
32+ if [ $ec -ne 0 ]; then
33+ exit $ec
34+ fi
35+ elif [ " $cxx_type " = " Apple" ]; then
36+ # clang_ver=$($CXX -dumpversion)
37+ # clang_ver=${clang_ver%%.*}
38+ find /Applications -name cctype
39+ # TODO: how to get XCode version
40+ ./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"
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
You can’t perform that action at this time.
0 commit comments