[bTSstream-devel] header_test: test both C and C++
Benjamin Cohen
git at videolan.org
Fri Apr 24 13:56:50 CEST 2015
bitstream | branch: master | Benjamin Cohen <bencoh at notk.org> | Fri Apr 24 13:02:55 2015 +0200| [ef78816fda649696048041002eea993c5a9ce3ca] | committer: Benjamin Cohen
header_test: test both C and C++
Also fix check with old (~4.2) gcc
> http://git.videolan.org/gitweb.cgi/bitstream.git/?a=commit;h=ef78816fda649696048041002eea993c5a9ce3ca
---
headers_test.sh | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/headers_test.sh b/headers_test.sh
index 99cc906..8ee4fdc 100755
--- a/headers_test.sh
+++ b/headers_test.sh
@@ -11,12 +11,23 @@ HEADER_LIST="dvb/sim.h ietf/rtp.h"
# If you want to test only particular headers comment the line bellow
HEADER_LIST=$(find * | grep \\.h$ | sort | sed -e 's|^\./||')
-for HDR in $HEADER_LIST
+for suffix in "c" "cpp"
do
- test_file=$(echo $HDR | sed -e 's|/|_|g;s|\.h$||')
- echo "Testing: $HDR"
- printf "#include \"$HDR\"\n\nint main(void) { return 0; }\n" > $test_file.cpp
- gcc -I.. -Werror -Wall -Wextra -Wno-unused -Wno-sign-compare -Wformat-security $test_file.cpp -o $test_file
- [ $? != 0 ] && exit 1
- rm $test_file $test_file.cpp
+ case $suffix in
+ "cpp")
+ compiler="g++"
+ ;;
+ *)
+ compiler="gcc"
+ ;;
+ esac
+ for HDR in $HEADER_LIST
+ do
+ test_file=$(echo $HDR | sed -e 's|/|_|g;s|\.h$||')
+ echo "Testing ($compiler): $HDR"
+ printf "#include \"$HDR\"\n\nint main(void) { return 0; }\n" > $test_file.$suffix
+ $compiler -I.. -Werror -Wall -Wextra -Wno-unused -Wno-sign-compare -Wformat-security $test_file.$suffix -o $test_file
+ [ $? != 0 ] && exit 1
+ rm $test_file $test_file.$suffix
+ done
done
More information about the biTStream-devel
mailing list