melsman / mlkit

Standard ML Compiler and Toolkit
http://melsman.github.io/mlkit
274 stars 30 forks source link

Suppress non-warning and non-error compiler output #147

Closed someplaceguy closed 10 months ago

someplaceguy commented 10 months ago

It would be nice if there was a flag to suppress the compiler output (that is not a warning or an error).

As an example, while compiling one of my programs I see this output:

$ mlkit -o check_mlkit check.mlb
[reading source file:   nondebug.sml]
[wrote X64 code file:   MLB/RI_GC/nondebug.sml.s]
[reading source file:   util.sml]
[wrote X64 code file:   MLB/RI_GC/util.sml.s]
[reading source file:   map.sml]
[reading source file:   set.sml]
[reading source file:   fst.sml]
[reading source file:   check.sml]
[compiling body of functor MakeFst (from source check.mlb->fst.sml) begin]
[compiling body of functor ListSet (from source check.mlb->set.sml) begin]
[wrote X64 code file:   MLB/RI_GC/check.sml.code2.s]
[compiling body of functor ListSet end]
[compiling body of functor ListSet (from source check.mlb->set.sml) begin]
[wrote X64 code file:   MLB/RI_GC/check.sml.code4.s]
[compiling body of functor ListSet end]
[compiling body of functor ListSet (from source check.mlb->set.sml) begin]
[wrote X64 code file:   MLB/RI_GC/check.sml.code6.s]
[compiling body of functor ListSet end]
[wrote X64 code file:   MLB/RI_GC/check.sml.code3.s]
[wrote X64 code file:   MLB/RI_GC/check.sml.code5.s]
[wrote X64 code file:   MLB/RI_GC/check.sml.code7.s]
[compiling body of functor MakeFst end]
[wrote X64 code file:   MLB/RI_GC/check.sml.code1.s]
[wrote X64 code file:   MLB/RI_GC/check.sml.s]
[reading source file:   main.sml]
[wrote X64 code file:   MLB/RI_GC/main.sml.s]
[wrote X64 code file:   MLB/RI_GC/base-link_objects.s]
[wrote executable file: check_mlkit]

This quickly becomes noise when compiling several of such programs and it becomes hard to see actual warnings and errors (e.g. when these messages are intermixed with messages from other compilers being used in parallel).

Ideally, I would like to run something like mlkit -quiet -o check_mlkit check.mlb and MLKit would not output anything that isn't a warning or an error.

melsman commented 10 months ago

In the master branch there is now the possibility of suppressing messages by passing the -no_messages flag...

someplaceguy commented 10 months ago

@melsman Thanks for the quick reply!

It's great that such an option already exists in master! Unfortunately, it does not suppress all non-warning / non-error messages yet:

$ mlkit -no_messages -o build/gen_input_mlkit gen_input.mlb
[reading source file:   nondebug.sml]
[reading source file:   util.sml]
[reading source file:   gen_input.sml]
[reading source file:   main.sml]
(...)

Would it be possible to also suppress these messages?

Thanks!