1function except() {
2case $1 in
3    selinux_file_context_cmp) # ignore
4    ;;
5    *)
6echo "
7%exception $1 {
8  \$action
9  if (result < 0) {
10     PyErr_SetFromErrno(PyExc_OSError);
11     SWIG_fail;
12  }
13}
14"
15;;
16esac
17}
18if ! ${CC:-gcc} -x c -c -I../include - -aux-info temp.aux < ../include/selinux/selinux.h
19then
20    # clang does not support -aux-info so fall back to gcc
21    gcc -x c -c -I../include - -aux-info temp.aux < ../include/selinux/selinux.h
22fi
23for i in `awk '/<stdin>.*extern int/ { print $6 }' temp.aux`; do except $i ; done
24rm -f -- temp.aux -.o
25