Detect errors returned by the C compiler or the resource compiler and make them visible in Xcode.

This commit is contained in:
Jeremy Rand 2018-07-17 23:16:42 -05:00
parent 2c37fcd120
commit b883e09a18
4 changed files with 46 additions and 12 deletions

BIN
.DS_Store vendored

Binary file not shown.

BIN
make/.DS_Store vendored

Binary file not shown.

View File

@ -1,6 +1,7 @@
#!/bin/bash
TMPFILE=/tmp/orca-cc.$$
STDOUTPUT=/tmp/orca-cc-std.$$
ERROUTPUT=/tmp/orca-cc-errs.$$
FILENAME="$1"
shift
@ -28,14 +29,31 @@ DEPSNAME="${BASENAME}.d"
OBJSNAME="${BASENAME}.a"
ROOTNAME="${BASENAME}.root"
$ORCA --trace-gsos compile $COMPILEARGS "$FILENAME" keep="${BASENAME}" $CCARGS 2> $TMPFILE
$ORCA --trace-gsos compile $COMPILEARGS "$FILENAME" keep="${BASENAME}" $CCARGS > $STDOUTPUT 2> $ERROUTPUT
RESULT=$?
sed '/^[A-Za-z][A-Za-z]*(.*)$/d' $TMPFILE >&2
awk '
{
print $0
}
$1 ~ /^[0-9][0-9]*$/ {
LINENO=$1
}
/^ *\^/ {
sub(/^ *\^/, "", $0)
printf("%s/%s:%d:0:%s\n", PWD, FILE, LINENO, $0)
}
' "PWD=`pwd`" "FILE=$FILENAME" $STDOUTPUT
sed '/^[A-Za-z][A-Za-z]*(.*)$/d' $ERROUTPUT >&2
if [ "$RESULT" -ne 0 ]
then
rm -f $TMPFILE
rm -f $ERROUTPUT
rm -f $STDOUTPUT
rm -f $OBJSNAME
rm -f $ROOTNAME
exit $RESULT
@ -45,7 +63,7 @@ DEPS=`awk '
/^FastFileLoad/ {
sub(/^FastFileLoad\(/, "");
sub(/\)$/, "");
print}' $TMPFILE | sort -u | while read FILE
print}' $ERROUTPUT | sort -u | while read FILE
do
if [ -f "$FILE" ]
then
@ -53,7 +71,8 @@ DEPS=`awk '
fi
done | tr '\012' ' '`
rm -f $TMPFILE
rm -f $ERROUTPUT
rm -f $STDOUTPUT
# We add a dependency for both the .o and the .root file. If this is the
# main.c file being compiled, we need the dependency on the .root file.

View File

@ -1,6 +1,6 @@
#!/bin/bash
TMPFILE=/tmp/orca-rez.$$
ERROUTPUT=/tmp/orca-rez-err.$$
FILENAME="$1"
shift
@ -15,14 +15,29 @@ BASENAME=`echo $FILENAME | sed 's/\.rez$//'`
DEPSNAME="${BASENAME}.rez.d"
OBJSNAME="${BASENAME}.r"
$ORCA --trace-gsos compile $* keep="${OBJSNAME}" "$FILENAME" 2> $TMPFILE
$ORCA --trace-gsos compile $* keep="${OBJSNAME}" "$FILENAME" 2> $ERROUTPUT
RESULT=$?
sed '/^[A-Za-z][A-Za-z]*(.*)$/d' $TMPFILE >&2
awk '
/^[A-Za-z][A-Za-z]*\(.*\)$/ {
next
}
{
print
}
/^File [^ ]*; Line [0-9][0-9]*;/ {
sub(/;/,"",$4)
LINENO=$4
sub(/^File [^ ]*; Line [0-9][0-9]*/, "", $0)
printf("%s/%s:%d:0:%s\n", PWD, FILE, LINENO, $0)
}
' "PWD=`pwd`" "FILE=$FILENAME" $ERROUTPUT >&2
if [ "$RESULT" -ne 0 ]
then
rm -f $TMPFILE
rm -f $ERROUTPUT
rm -f $OBJSNAME
exit $RESULT
fi
@ -31,7 +46,7 @@ DEPS=`awk '
/^FastFileLoad/ {
sub(/^FastFileLoad\(/, "");
sub(/\)$/, "");
print}' $TMPFILE | sort -u | while read FILE
print}' $ERROUTPUT | sort -u | while read FILE
do
if [ -f "$FILE" ]
then
@ -40,6 +55,6 @@ DEPS=`awk '
done`
echo $OBJSNAME: $DEPS > $DEPSNAME
rm -f $TMPFILE
rm -f $ERROUTPUT
exit 0