Fix incorrect line numbers on NDS MWCC (#505)

* Turn off msg_show_realref to force #line to work on NDS MWCC

* Interleave stdout and stderr for sandbox run

* fix formatting

* feedback

* formatting
This commit is contained in:
Max Thomas
2022-08-11 01:19:38 -07:00
committed by GitHub
parent 29d9c7ad51
commit 7c800fcdb5
3 changed files with 8 additions and 12 deletions

View File

@@ -176,10 +176,7 @@ class CompilerWrapper:
)
except subprocess.CalledProcessError as e:
# Compilation failed
if e.stdout:
msg = f"{e.stdout}\n{e.stderr}"
else:
msg = e.stderr
msg = e.stdout
logging.debug("Compilation failed: %s", msg)
raise CompilationError(CompilerWrapper.filter_compile_errors(msg))
@@ -189,11 +186,9 @@ class CompilerWrapper:
raise CompilationError(str(e))
if not object_path.exists():
if compile_proc.stdout:
msg = f"{compile_proc.stdout}\n{compile_proc.stderr}"
else:
msg = compile_proc.stderr
error_msg = "Compiler did not create an object file: %s" % msg
error_msg = (
"Compiler did not create an object file: %s" % compile_proc.stdout
)
logging.debug(error_msg)
raise CompilationError(error_msg)
@@ -202,7 +197,7 @@ class CompilerWrapper:
if not object_bytes:
raise CompilationError("Compiler created an empty object file")
compile_errors = CompilerWrapper.filter_compile_errors(compile_proc.stderr)
compile_errors = CompilerWrapper.filter_compile_errors(compile_proc.stdout)
return CompilationResult(object_path.read_bytes(), compile_errors)

View File

@@ -478,7 +478,7 @@ MWCC_43_213 = MWCCCompiler(
)
# NDS_ARM9
MWCCARM_CC = '${WINE} "${COMPILER_DIR}/mwccarm.exe" -c -proc arm946e -nostdinc -stderr ${COMPILER_FLAGS} -o "${OUTPUT}" "${INPUT}"'
MWCCARM_CC = '${WINE} "${COMPILER_DIR}/mwccarm.exe" -pragma "msg_show_realref off" -c -proc arm946e -nostdinc -stderr ${COMPILER_FLAGS} -o "${OUTPUT}" "${INPUT}"'
MWCC_20_72 = MWCCCompiler(
id="mwcc_20_72",

View File

@@ -122,10 +122,11 @@ class Sandbox(contextlib.AbstractContextManager["Sandbox"]):
logger.debug(f"Sandbox Command: {debug_env_str} {shlex.join(command)}")
return subprocess.run(
command,
capture_output=True,
text=True,
env=env,
cwd=self.path,
check=True,
shell=False,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
)