From 3e872ba1c495feafaafac97cc449f81d8a4d451f Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sun, 15 Mar 2020 12:18:40 +0100 Subject: pkg/compiler: emit warnings after generate stage Description generation can also produce errors. We don't want to emit warnings if there are any errors. Move warnings emission to the very end of compilation. --- pkg/compiler/compiler.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'pkg') diff --git a/pkg/compiler/compiler.go b/pkg/compiler/compiler.go index a88e44d70..2291d349e 100644 --- a/pkg/compiler/compiler.go +++ b/pkg/compiler/compiler.go @@ -99,9 +99,6 @@ func Compile(desc *ast.Description, consts map[string]uint64, target *targets.Ta if comp.errors != 0 { return nil } - for _, w := range comp.warnings { - eh(w.pos, w.msg) - } syscalls := comp.genSyscalls() prg := &Prog{ Resources: comp.genResources(), @@ -112,6 +109,9 @@ func Compile(desc *ast.Description, consts map[string]uint64, target *targets.Ta if comp.errors != 0 { return nil } + for _, w := range comp.warnings { + eh(w.pos, w.msg) + } return prg } -- cgit mrf-deployment