[m-rev.] changed "no targets specified" message
Peter Wang
novalazy at gmail.com
Wed Nov 23 15:12:51 AEDT 2022
On Tue, 22 Nov 2022 23:05:59 +1100 "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
>
> 2022-11-22 17:15 GMT+11:00 "Peter Wang" <novalazy at gmail.com>:
> > How about one of:
> >
> > mercury_compile: *** Error: no target specified.
> > mercury_compile: *** Error: no target or `MAIN_TARGET' specified.
> > mercury_compile: *** Error: no target specified and `MAIN_TARGET' not defined.
>
> I am fine with either the second or third, though I don't see the point
> of quoting MAIN_TARGET.
I agree. Patch attached.
>
> > For other errors, I'd prefer each error message to appear on a single
> > line, even if it might exceed what the compiler *thinks* the window
> > width is. If they happen to be formatted with error_specs then I think
> > they should behave as though --no-max-error-line-width was passed.
>
> At the moment, there is no way to embed the instruction "ignore the
> max line width" in an error_spec. Adding such a mechanism
> would not be hard, but with the wordings above, it would not
> be needed.
Technically, it could still be wrapped if --max-error-line-width is set
low enough. There are other error messages built with error_specs as
well.
Peter
---
Shorten the "no targets specified" message.
Previously, when mmc --make did not have a target to make
it would print the error message:
** Error: no targets specified and `MAIN_TARGET' not defined.
Since commit c2be36780, it prints:
`mercury_compile': *** Error: no targets specified and `MAIN_TARGET' not
defined.
Note the line break. This is due to constructing the message with
error_specs, which causes the message to be wrapped to the value of
--max-error-line-width. For various reasons, I find this undesirable.
compiler/make.top_level.m:
Reword the error message so that it does not exceed the default
value of --max-error-line-width. (This is far from a complete fix,
of course.)
Remove unnecessary quotes.
diff --git a/compiler/make.top_level.m b/compiler/make.top_level.m
index 0c959c3fe..e47b454a5 100644
--- a/compiler/make.top_level.m
+++ b/compiler/make.top_level.m
@@ -170,9 +170,9 @@ get_main_target_if_needed(ProgName, Variables, Targets0, MaybeTargets) :-
MaybeTargets = ok1(MainTargets)
;
MainTargets = [],
- Pieces = [quote(ProgName), suffix(":"),
- words("*** Error: no targets specified and"),
- quote("MAIN_TARGET"), words("not defined."), nl],
+ Pieces = [fixed(ProgName), suffix(":"),
+ words("*** Error: no target or MAIN_TARGET specified."),
+ nl],
Spec = simplest_no_context_spec($pred, severity_error,
phase_options, Pieces),
MaybeTargets = error1([Spec])
--
2.38.0
More information about the reviews
mailing list