]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
qcc.sh: fix preprocessor error reporting
authorTimePath <andrew.hardaker1995@gmail.com>
Tue, 15 Mar 2016 09:23:25 +0000 (20:23 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Tue, 15 Mar 2016 09:23:25 +0000 (20:23 +1100)
qcsrc/tools/qcc.sh

index 92f8b98fbd600c1a6b804558de8f11c8740ad2b9..40223c113a85281b1a641aa0b0bffa82b1bbb40f 100755 (executable)
@@ -1,5 +1,6 @@
 #!/bin/bash
-set -eu
+set -euo pipefail
+IFS=$' \n\t'
 
 WORKDIR=${WORKDIR}
 CPP=${CPP}
@@ -12,6 +13,7 @@ function qpp() {
     IN=$1
     OUT=$2
     >&2 echo + ${CPP} ${@:3} ${IN}
+    set +e
     # additional information
     ${CPP} ${@:3} \
         -dM 1>${WORKDIR}/${MODE}_macros.txt \
@@ -19,6 +21,9 @@ function qpp() {
         ${IN}
     # main step
     ${CPP} ${@:3} -MMD -MP -MT ${OUT} -Wall -Wundef -Werror ${IN} -o ${WORKDIR}/${MODE}.txt
+    err=$?
+    set -e
+    if [ ${err} -ne 0 ]; then return ${err}; fi
     sed 's/^#\(line\)\? \([[:digit:]]\+\) "\(.*\)".*/\n#pragma file(\3)\n#pragma line(\2)/g' ${WORKDIR}/${MODE}.txt
 }