[m-users.] ROTD-2024-06-28 and use of new format_call pragma
Zoltan Somogyi
zoltan.somogyi at runbox.com
Sun Jun 30 02:22:18 AEST 2024
On 2024-06-29 19:56 +10:00 AEST, "Sean Charles (emacstheviking)" <objitsu at gmail.com> wrote:
> First of all, a huge big massive thank you to everybody involved in that ROTD, I read the entire release notes over breakfast, what a fantastic amount of work and effort has been expended over it. Very much appreciated here. Again, thank you.
The "release notes" of a release-of-the-day consist of the
continuously updated list of changes since the last stable release.
In this case, that consists of everything done in the last two years
and about five months.
> The function chromakey/1 is the source of my problem because it is used by all of the above to actually map the source format string into the final format string, and thus, when we look at the implementation code:
>
> format(Format, Args, !IO) :- format_to(io.stdout_stream, Format, Args, !IO).
> error(Format, Args, !IO) :- format_to(io.stderr_stream, Format, Args, !IO).
>
> :- pred format_to(output_stream::in, string::in, list(poly_type)::in, io::di, io::uo) is det.
> :- pragma format_call(pred(format_to/5), format_string_values(2, 3)).
>
> format_to(Stream, Format, Args, !IO) :-
> [52] io.format(Stream, chromakey(Format), Args, !IO).
>
> [67] format(Format, Args) = string.format(chromakey(Format), Args).
>
> The errors I get are:
>
> aio.m:052: Error: unknown format string in call to predicate `io.format'/5.
> aio.m:052: Error: unknown list of values to be formatted in call to predicate
> aio.m:052: `io.format'/5.
> aio.m:067: Error: unknown format string in call to function `string.format'/2.
> aio.m:067: Error: unknown list of values to be formatted in call to function
> aio.m:067: `string.format'/2.
> ** Error making `Mercury/cs/aio.c'.
>
> Am I stuck with this error in these two places or is there someway I can rearrange the code?
No, you are not stuck.
Actually, the error messages above are themselves buggy: the issue
they report is a warning, not an error, so their first words are misleading.
And this warning can be overridden. You probably want it overridden
only on lines 52 and 67, which you can do by wrapping up the goals
on those lines (represented by Goal below) with a scope that disables this warning:
disable_warning [unknown_format_calls] ( Goal )
Zoltan.
More information about the users
mailing list