mirror of
https://github.com/irmen/prog8.git
synced 2026-04-20 11:17:01 +00:00
added %option ignore_unused to suppress warnings about unused vars and subs in that module/block.
Also improved error for invalid directive.
This commit is contained in:
@@ -1667,6 +1667,7 @@ class IRCodeGen(
|
||||
block.options.forceOutput,
|
||||
block.options.noSymbolPrefixing,
|
||||
block.options.veraFxMuls,
|
||||
block.options.ignoreUnused,
|
||||
translate(block.options.alignment)
|
||||
), block.position)
|
||||
for (child in block.children) {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package prog8.codegen.intermediate
|
||||
|
||||
import prog8.code.core.IErrorReporter
|
||||
import prog8.code.core.SourceCode.Companion.LIBRARYFILEPREFIX
|
||||
import prog8.intermediate.*
|
||||
|
||||
|
||||
@@ -61,7 +60,7 @@ class IRUnusedCodeRemover(
|
||||
irprog.blocks.forEach { block ->
|
||||
block.children.filterIsInstance<IRSubroutine>().reversed().forEach { sub ->
|
||||
if(sub.isEmpty()) {
|
||||
if(!sub.position.file.startsWith(LIBRARYFILEPREFIX)) {
|
||||
if(!block.options.ignoreUnused) {
|
||||
errors.warn("unused subroutine '${sub.label}'", sub.position)
|
||||
}
|
||||
block.children.remove(sub)
|
||||
@@ -82,7 +81,7 @@ class IRUnusedCodeRemover(
|
||||
irprog.blocks.forEach { block ->
|
||||
block.children.filterIsInstance<IRAsmSubroutine>().reversed().forEach { sub ->
|
||||
if(sub.isEmpty()) {
|
||||
if(!sub.position.file.startsWith(LIBRARYFILEPREFIX)) {
|
||||
if(!block.options.ignoreUnused) {
|
||||
errors.warn("unused subroutine '${sub.label}'", sub.position)
|
||||
}
|
||||
block.children.remove(sub)
|
||||
|
||||
Reference in New Issue
Block a user