diff --git a/codeCore/src/prog8/code/core/CompilationOptions.kt b/codeCore/src/prog8/code/core/CompilationOptions.kt index 8e7f8a8b1..16adf6eed 100644 --- a/codeCore/src/prog8/code/core/CompilationOptions.kt +++ b/codeCore/src/prog8/code/core/CompilationOptions.kt @@ -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 = emptyMap() diff --git a/compiler/src/prog8/CompilerMain.kt b/compiler/src/prog8/CompilerMain.kt index b10f9090e..d725c4128 100644 --- a/compiler/src/prog8/CompilerMain.kt +++ b/compiler/src/prog8/CompilerMain.kt @@ -41,7 +41,6 @@ fun pathFrom(stringPath: String, vararg rest: String): Path = FileSystems.getDe private fun compileMain(args: Array): 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): Boolean { slabsGolden == true, compilationTarget!!, splitWordArrays == true, - addMissingRts == true, breakpointCpuInstruction, printAst1 == true, printAst2 == true, @@ -261,7 +259,6 @@ private fun compileMain(args: Array): Boolean { slabsGolden == true, compilationTarget!!, splitWordArrays == true, - addMissingRts == true, breakpointCpuInstruction, printAst1 == true, printAst2 == true, diff --git a/compiler/src/prog8/compiler/Compiler.kt b/compiler/src/prog8/compiler/Compiler.kt index 27ebe5c1e..841f806ae 100644 --- a/compiler/src/prog8/compiler/Compiler.kt +++ b/compiler/src/prog8/compiler/Compiler.kt @@ -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 } diff --git a/compiler/src/prog8/compiler/astprocessing/BeforeAsmAstChanger.kt b/compiler/src/prog8/compiler/astprocessing/BeforeAsmAstChanger.kt index e12c964c7..b3994c138 100644 --- a/compiler/src/prog8/compiler/astprocessing/BeforeAsmAstChanger.kt +++ b/compiler/src/prog8/compiler/astprocessing/BeforeAsmAstChanger.kt @@ -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) } } diff --git a/compiler/test/TestCompilerOnExamples.kt b/compiler/test/TestCompilerOnExamples.kt index 9dcc4c5af..8d8887020 100644 --- a/compiler/test/TestCompilerOnExamples.kt +++ b/compiler/test/TestCompilerOnExamples.kt @@ -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, diff --git a/compiler/test/TestCompilerOptionLibdirs.kt b/compiler/test/TestCompilerOptionLibdirs.kt index 5d6ff30b7..f0961cf7c 100644 --- a/compiler/test/TestCompilerOptionLibdirs.kt +++ b/compiler/test/TestCompilerOptionLibdirs.kt @@ -38,7 +38,6 @@ class TestCompilerOptionSourcedirs: FunSpec({ slabsGolden = false, compilationTarget = Cx16Target.NAME, splitWordArrays = false, - addMissingRts = false, breakpointCpuInstruction = null, printAst1 = false, printAst2 = false, diff --git a/compiler/test/helpers/compileXyz.kt b/compiler/test/helpers/compileXyz.kt index 3cb2abfdd..28ae0e11d 100644 --- a/compiler/test/helpers/compileXyz.kt +++ b/compiler/test/helpers/compileXyz.kt @@ -40,7 +40,6 @@ internal fun compileFile( outputDir = outputDir, errors = errors ?: ErrorReporterForTests(), splitWordArrays = false, - addMissingRts = false, breakpointCpuInstruction = null, printAst1 = false, printAst2 = false, diff --git a/docs/source/compiling.rst b/docs/source/compiling.rst index 30ec3af3b..94b1a4571 100644 --- a/docs/source/compiling.rst +++ b/docs/source/compiling.rst @@ -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 .list