mirror of
https://github.com/irmen/prog8.git
synced 2024-12-24 01:29:28 +00:00
remove the 'addmissingrts' compiler option
This commit is contained in:
parent
fb0d9b46b0
commit
ea1daa97d3
@ -28,7 +28,6 @@ class CompilationOptions(val output: OutputType,
|
||||
var slabsHighBank: Int? = null,
|
||||
var slabsGolden: Boolean = false,
|
||||
var splitWordArrays: Boolean = false,
|
||||
var addMissingRts: Boolean = false, // deprecated, will likely go way in future version
|
||||
var breakpointCpuInstruction: String? = null,
|
||||
var outputDir: Path = Path(""),
|
||||
var symbolDefs: Map<String, String> = emptyMap()
|
||||
|
@ -41,7 +41,6 @@ fun pathFrom(stringPath: String, vararg rest: String): Path = FileSystems.getDe
|
||||
|
||||
private fun compileMain(args: Array<String>): Boolean {
|
||||
val cli = ArgParser("prog8c", prefixStyle = ArgParser.OptionPrefixStyle.JVM)
|
||||
val addMissingRts by cli.option(ArgType.Boolean, fullName = "addmissingrts", description="enable old behavior that silently adds RTS to asmsubs that don't have one (deprecated, may go away in future version)")
|
||||
val asmListfile by cli.option(ArgType.Boolean, fullName = "asmlist", description = "make the assembler produce a listing file as well")
|
||||
val breakpointCpuInstruction by cli.option(ArgType.Choice(listOf("brk", "stp"), { it }), fullName = "breakinstr", description = "the CPU instruction to use as well for %breakpoint")
|
||||
val bytes2float by cli.option(ArgType.String, fullName = "bytes2float", description = "convert a comma separated list of bytes from the target system to a float value. NOTE: you need to supply a target option too, and also still have to supply a dummy module file name as well!")
|
||||
@ -180,7 +179,6 @@ private fun compileMain(args: Array<String>): Boolean {
|
||||
slabsGolden == true,
|
||||
compilationTarget!!,
|
||||
splitWordArrays == true,
|
||||
addMissingRts == true,
|
||||
breakpointCpuInstruction,
|
||||
printAst1 == true,
|
||||
printAst2 == true,
|
||||
@ -261,7 +259,6 @@ private fun compileMain(args: Array<String>): Boolean {
|
||||
slabsGolden == true,
|
||||
compilationTarget!!,
|
||||
splitWordArrays == true,
|
||||
addMissingRts == true,
|
||||
breakpointCpuInstruction,
|
||||
printAst1 == true,
|
||||
printAst2 == true,
|
||||
|
@ -49,7 +49,6 @@ class CompilerArguments(val filepath: Path,
|
||||
val slabsGolden: Boolean,
|
||||
val compilationTarget: String,
|
||||
val splitWordArrays: Boolean,
|
||||
val addMissingRts: Boolean,
|
||||
val breakpointCpuInstruction: String?,
|
||||
val printAst1: Boolean,
|
||||
val printAst2: Boolean,
|
||||
@ -87,7 +86,6 @@ fun compileProgram(args: CompilerArguments): CompilationResult? {
|
||||
slabsHighBank = args.slabsHighBank
|
||||
slabsGolden = args.slabsGolden
|
||||
splitWordArrays = args.splitWordArrays
|
||||
addMissingRts = args.addMissingRts
|
||||
outputDir = args.outputDir.normalize()
|
||||
symbolDefs = args.symbolDefs
|
||||
}
|
||||
|
@ -83,21 +83,10 @@ internal class BeforeAsmAstChanger(val program: Program, private val options: Co
|
||||
|
||||
if (!subroutine.inline) {
|
||||
if (subroutine.isAsmSubroutine && subroutine.asmAddress==null) {
|
||||
if(!options.addMissingRts && !subroutine.hasRtsInAsm(true)) {
|
||||
errors.err("asmsub seems to never return as it doesn't end with RTS/JMP/branch. If this is intended, add a '; !notreached!' comment at the end, or use -addmissingrts", subroutine.position)
|
||||
}
|
||||
else if (!subroutine.hasRtsInAsm(false)) {
|
||||
// make sure the NOT INLINED asm subroutine actually has a rts at the end
|
||||
// (non-asm routines get a Return statement as needed, above)
|
||||
if(options.addMissingRts) {
|
||||
errors.info("added missing RTS to asmsub", subroutine.position)
|
||||
mods += if(options.compTarget.name==VMTarget.NAME)
|
||||
IAstModification.InsertLast(InlineAssembly(" return\n", true, Position.DUMMY), subroutine)
|
||||
else
|
||||
IAstModification.InsertLast(InlineAssembly(" rts\n", false, Position.DUMMY), subroutine)
|
||||
} else
|
||||
errors.err("asmsub seems to never return as it doesn't end with RTS/JMP/branch. If this is intended, add a '; !notreached!' comment at the end, or use -addmissingrts", subroutine.position)
|
||||
}
|
||||
if(!subroutine.hasRtsInAsm(true))
|
||||
errors.err("asmsub seems to never return as it doesn't end with RTS/JMP/branch. If this is intended, add a '; !notreached!' comment at the end", subroutine.position)
|
||||
else if (!subroutine.hasRtsInAsm(false))
|
||||
errors.err("asmsub seems to never return as it doesn't end with RTS/JMP/branch. If this is intended, add a '; !notreached!' comment at the end", subroutine.position)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,6 @@ private fun compileTheThing(filepath: Path, optimize: Boolean, target: ICompilat
|
||||
slabsGolden = false,
|
||||
compilationTarget = target.name,
|
||||
splitWordArrays = false,
|
||||
addMissingRts = false,
|
||||
breakpointCpuInstruction = null,
|
||||
printAst1 = false,
|
||||
printAst2 = false,
|
||||
|
@ -38,7 +38,6 @@ class TestCompilerOptionSourcedirs: FunSpec({
|
||||
slabsGolden = false,
|
||||
compilationTarget = Cx16Target.NAME,
|
||||
splitWordArrays = false,
|
||||
addMissingRts = false,
|
||||
breakpointCpuInstruction = null,
|
||||
printAst1 = false,
|
||||
printAst2 = false,
|
||||
|
@ -40,7 +40,6 @@ internal fun compileFile(
|
||||
outputDir = outputDir,
|
||||
errors = errors ?: ErrorReporterForTests(),
|
||||
splitWordArrays = false,
|
||||
addMissingRts = false,
|
||||
breakpointCpuInstruction = null,
|
||||
printAst1 = false,
|
||||
printAst2 = false,
|
||||
|
@ -133,12 +133,6 @@ One or more .p8 module files
|
||||
``-help``, ``-h``
|
||||
Prints short command line usage information.
|
||||
|
||||
``-addmissingrts``
|
||||
Enables old compiler behavior that silently adds RTS to asmsubs that don't have one.
|
||||
This was done to fix asmsubs so they return properly to the caller instead of crashing the program.
|
||||
However the new compiler behavior is to not silently modify the code anymore and instead give an error message
|
||||
that tells you how to fix the problem. This option may go away in future version.
|
||||
|
||||
``-asmlist``
|
||||
Also generate an assembler listing file <program>.list
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user