File: api-compat-test.sh

package info (click to toggle)
rtfilter 1.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 500 kB
  • sloc: ansic: 2,671; makefile: 248; sh: 83; python: 57
file content (50 lines) | stat: -rwxr-xr-x 1,058 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash

set -e

includedir=$1
shift 1

randomize_header_list()
{
	for header in $@ ; do
		echo $header
	done | sort -R
}
all_headers=$(randomize_header_list $@)

all_included()
{
	for header in $all_headers ; do
		echo "#include \"$(basename $header)\""
	done

	echo "int main(void) { return 0; }"
}

# dump compilers versions
gcc --version

# dump generated file
all_included

# test headers for compliance with most warnings
for std in c99 c11 c17 gnu99 gnu11 gnu17
do
	echo "Test C language standard : $std"
	all_included | gcc -std=$std -x c - -I"$includedir" -Werror -Wall -Wextra -pedantic
done

# also test with clang if available
if [ -x "$(which clang)" ] ; then
	clang --version
	all_included | clang -x c - -I"$includedir" -Weverything \
		-Wno-documentation-unknown-command  # silence doxygen-related warnings
fi

# test headers for C++ compatibility
for std in c++11 c++14 c++17 gnu++11 gnu++14 gnu++17
do
	echo "Test C++ language standard : $std"
	all_included | gcc -std=$std -x c++ - -I"$includedir" -Werror -Wall -Wextra -pedantic
done