add check for always true, and pretty warnings

This commit is contained in:
Neemek 2025-09-30 16:02:18 +02:00
parent c8660a6471
commit 0d66db35aa
Signed by: neemek
GPG key ID: 84FFE4D7D40AB25E
2 changed files with 54 additions and 11 deletions

View file

@ -138,11 +138,15 @@ func makeChunk(ctx *Context, fpath string, ignoreWarnings bool) (*core.Chunk, er
}
// if there were non-critical warnings, report them
if !ignoreWarnings && len(c.Warnings) != 0 {
if len(c.Warnings) != 0 {
for _, warning := range c.Warnings {
log.Println(warning.Format())
log.Println(warning.Format() + "\n")
}
if !ignoreWarnings {
return nil, errors.New("compiler reported warning(s) (run anyways with --ignore-warnings)")
} else {
log.Println("compiler reported warning(s), but running anyways")
}
log.Fatal("compiler reported warning(s) (ignore warnings with the --ignore-warnings option)")
}
return c.Chunk, nil