mirror of
https://github.com/irmen/prog8.git
synced 2025-01-26 19:30:59 +00:00
trim down number of warnings a bit
This commit is contained in:
parent
1462c57d0c
commit
e051e09c1d
@ -68,7 +68,8 @@ class UnusedCodeRemover(private val program: Program,
|
||||
return listOf(IAstModification.Remove(block, parent as IStatementContainer))
|
||||
}
|
||||
if(callgraph.unused(block)) {
|
||||
errors.warn("removing unused block '${block.name}'", block.position)
|
||||
if(block.statements.any{ it !is VarDecl || it.type==VarDeclType.VAR})
|
||||
errors.warn("removing unused block '${block.name}'", block.position)
|
||||
return listOf(IAstModification.Remove(block, parent as IStatementContainer))
|
||||
}
|
||||
}
|
||||
|
@ -952,11 +952,8 @@ internal class AstChecker(private val program: Program,
|
||||
// if the asmsub returns multiple values and one of them is via a status register bit,
|
||||
// it *is* possible to handle them by just actually assigning the register value and
|
||||
// dealing with the status bit as just being that, the status bit after the call.
|
||||
val (returnRegisters, returnStatusflags) = stmt.asmReturnvaluesRegisters.partition { rr -> rr.registerOrPair != null }
|
||||
if (returnRegisters.isEmpty() || returnRegisters.size == 1) {
|
||||
if (returnStatusflags.any())
|
||||
errors.warn("this asmsub also has one or more return 'values' in one of the status flags", functionCall.position)
|
||||
} else {
|
||||
val (returnRegisters, _) = stmt.asmReturnvaluesRegisters.partition { rr -> rr.registerOrPair != null }
|
||||
if (returnRegisters.size>1) {
|
||||
errors.err("It's not possible to store the multiple result values of this asmsub call; you should use a small block of custom inline assembly for this.", functionCall.position)
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,19 @@
|
||||
%option enable_floats
|
||||
|
||||
|
||||
main {
|
||||
sub start() {
|
||||
ubyte[] @shared @zp array = [1,2,3,4]
|
||||
str @shared @zp name = "test"
|
||||
ubyte @shared @zp bytevar = 0
|
||||
float @shared @zp fl
|
||||
ubyte @shared joy_info
|
||||
|
||||
%asm {{
|
||||
lda array
|
||||
lda name
|
||||
lda bytevar
|
||||
}}
|
||||
sub start() {
|
||||
void pushing_start()
|
||||
}
|
||||
|
||||
sub pushing_start() -> ubyte {
|
||||
joy_info++
|
||||
return not c64.READST()
|
||||
}
|
||||
|
||||
sub derp(ubyte aa) -> ubyte {
|
||||
aa++
|
||||
return aa*2
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user