Add RGBASM -MC flag to continue -MG after missing dependency files (#1687)

This commit is contained in:
Rangi
2025-07-10 13:25:36 -04:00
committed by GitHub
parent 3f4e8396aa
commit 510a4aa99d
11 changed files with 88 additions and 19 deletions

View File

@@ -0,0 +1,13 @@
PUSHC
PUSHO
PUSHS
SECTION "test", WRAM0
UNION
INCLUDE "nonexistent1.inc"
WARN "still going!"
INCLUDE "nonexistent2.inc"
WARN "and going!"
ENDU
POPS
POPO
POPC

View File

@@ -0,0 +1,4 @@
warning: continues-after-missing-include/a.asm(7): [-Wuser]
still going!
warning: continues-after-missing-include/a.asm(9): [-Wuser]
and going!

View File

@@ -0,0 +1,3 @@
a.o: continues-after-missing-include/a.asm
a.o: nonexistent1.inc
a.o: nonexistent2.inc

View File

@@ -103,7 +103,7 @@ for i in *.asm notexist.asm; do
desired_errput="$gb"
# Escape regex metacharacters
subst="$(printf '%s\n' "$i" | sed 's:[][\/.^$*]:\\&:g')"
# Replace the file name with a dash to match changed output
# Replace the file name with "<stdin>" to match changed output
sed "s/$subst/<stdin>/g" "$desired_outname" >"$desired_output"
sed "s/$subst/<stdin>/g" "$desired_errname" >"$desired_errput"
fi
@@ -135,6 +135,33 @@ done
# These tests do their own thing
i="continues-after-missing-include"
RGBASMFLAGS="-Weverything -M - -MG -MC"
# Piping the .asm file to rgbasm would not make sense for dependency generation,
# so just test the normal variant
(( tests++ ))
echo "${bold}${green}${i%.asm}...${rescolors}${resbold}"
"$RGBASM" $RGBASMFLAGS -o "$o" "$i"/a.asm >"$output" 2>"$errput"
fixed_output="$input"
if which cygpath &>/dev/null; then
# MinGW needs the Windows path substituted but with forward slash separators;
# Cygwin has `cygpath` but just needs the original path substituted.
subst1="$(printf '%s\n' "$o" | sed 's:[][\/.^$*]:\\&:g')"
subst2="$(printf '%s\n' "$(cygpath -w "$o")" | sed -e 's:\\:/:g' -e 's:[][\/.^$*]:\\&:g')"
sed -e "s/$subst1/a.o/g" -e "s/$subst2/a.o/g" "$output" >"$fixed_output"
else
subst="$(printf '%s\n' "$o" | sed 's:[][\/.^$*]:\\&:g')"
sed "s/$subst/a.o/g" "$output" >"$fixed_output"
fi
tryDiff "$i"/a.out "$fixed_output" out
our_rc=$?
tryDiff "$i"/a.err "$errput" err
(( our_rc = our_rc || $? ))
(( rc = rc || our_rc ))
if [[ $our_rc -ne 0 ]]; then
(( failed++ ))
fi
i="state-file"
if which cygpath &>/dev/null; then
# MinGW translates path names before passing them as command-line arguments,