1
0
mirror of https://github.com/KarolS/millfork.git synced 2025-03-28 08:30:13 +00:00

Fix errors about invalid function flags

This commit is contained in:
Karol Stasiak 2019-11-13 18:39:27 +01:00
parent 113befeb36
commit 3b78206c35

View File

@ -562,17 +562,17 @@ abstract class MfParser[T](fileId: String, input: String, currentDirectory: Stri
} yield {
if (flags("interrupt") && flags("macro")) log.error(s"Interrupt function `$name` cannot be macros", Some(p))
if (flags("kernal_interrupt") && flags("macro")) log.error(s"Kernal interrupt function `$name` cannot be macros", Some(p))
if (flags("interrupt") && flags("reentrant")) log.error("Interrupt function `$name` cannot be reentrant", Some(p))
if (flags("interrupt") && flags("kernal_interrupt")) log.error("Interrupt function `$name` cannot be a Kernal interrupt", Some(p))
if (flags("interrupt") && flags("reentrant")) log.error(s"Interrupt function `$name` cannot be reentrant", Some(p))
if (flags("interrupt") && flags("kernal_interrupt")) log.error(s"Interrupt function `$name` cannot be a Kernal interrupt", Some(p))
if (flags("macro") && flags("reentrant")) log.error("Reentrant and macro exclude each other", Some(p))
if (flags("inline") && flags("noinline")) log.error("Noinline and inline exclude each other", Some(p))
if (flags("macro") && flags("noinline")) log.error("Noinline and macro exclude each other", Some(p))
if (flags("inline") && flags("macro")) log.error("Macro and inline exclude each other", Some(p))
if (flags("interrupt") && returnType != "void") log.error("Interrupt function `$name` has to return void", Some(p))
if (addr.isEmpty && statements.isEmpty) log.error("Extern function `$name` must have an address", Some(p))
if (addr.isDefined && alignment.isDefined) log.error("Function `$name` has both address and alignment", Some(p))
if (statements.isEmpty && alignment.isDefined) log.error("Extern function `$name` cannot have alignment", Some(p))
if (statements.isEmpty && !flags("asm") && params.nonEmpty) log.error("Extern non-asm function `$name` cannot have parameters", Some(p))
if (flags("interrupt") && returnType != "void") log.error(s"Interrupt function `$name` has to return void", Some(p))
if (addr.isEmpty && statements.isEmpty) log.error(s"Extern function `$name` must have an address", Some(p))
if (addr.isDefined && alignment.isDefined) log.error(s"Function `$name` has both address and alignment", Some(p))
if (statements.isEmpty && alignment.isDefined) log.error(s"Extern function `$name` cannot have alignment", Some(p))
if (statements.isEmpty && !flags("asm") && params.nonEmpty) log.error(s"Extern non-asm function `$name` cannot have parameters", Some(p))
if (flags("asm")) validateAsmFunctionBody(p, flags, name, statements)
Seq(FunctionDeclarationStatement(name, returnType, params.toList,
bank,