library/io.m:
library/prolog.m:
Move the definitions of see/seen/tell/told and their binary variants
from io.m to prolog.m, leaving behind forwarding predicates that are
marked obsolete.
library/robdd.m:
Replace tell/told with output to specified streams.
Where exported predicates sent output to the current output stream,
add a version that sends output to a user-specified stream.
This required replacing user-provided predicates that wrote a variable
to the current output stream with a user-provided function that simply
returns the string representation of the variable, so that the resulting
string could be printed to a *specified* stream.
NEWS:
Document the changes above.
compiler/mode_constraint_robdd.m:
compiler/mode_robdd.implications.m:
Conform to the changes above.
compiler/simplify_goal_call.m:
Warn about calls to see/seen/tell/told in prolog.m as well as io.m.
Warn about the binary versions of see/seen/tell told, and
the binary versions of set_{in,out}put_stream.
tests/warnings/save.{m,exp}:
Call prolog.see instead of io.see, since we want to test the warning
from simplify_goal_call.m, not the warning about io.see being obsolete.
The code I added recently to implement --warn-implicit-stream-calls
generated misleading messages for calls to io.format/3 and its
stream.string_writer.put cousin, because these calls are transformed
into other code by format_call.m before the main simplification pass
ever sees them. For example, calls to io.format/4 are transformed
into code that figures out what to print and then calls io.write_string/3.
Since format_call.m is called before the main simplification pass for a good
reason, the fix is to make format_call.m itself generate the warnings based
on the as-yet-untransformed code.
compiler/format_call.m:
As above. Also, mark the calls in the transformed code that could possibly
get the warning from simplify_goal_call.m with a new feature.
Delete some dead code, and use a bespoke type to avoid ambiguity.
compiler/simplify_goal_call.m:
Export to format_call.m the code that generates the warning if
warranted. Make this code respect format_call.m's feature to avoid
generating redundant and misleading error messages.
compiler/simplify_proc.m:
Tell format_call.m whether it should try to generate these warnings.
compiler/hlds_goal.m:
Add the goal feature that format_call.m uses to tell simplify_goal_call.m
not generate would-be-redundant warnings for code generated by
format_call.m.
compiler/saved_vars.m:
Conform to the change to hlds_goal.m.
tests/warnings/save.{m,exp}:
Change the test case for --warn-implicit-stream-call to test warnings
for io.format too.
compiler/options.m:
doc/user_guide.texi:
NEWS:
Add the above option.
compiler/simplify_goal_call.m:
If the option is given, then generate severity_informational messages
for calls to I/O predicates such as io.write_string/3, which have twins
(in this case io.write_string/4) that take an extra initial argument
that explicit specifies the stream to do the I/O on.
Additionally, generate warnings for the predicates that update
the library's notion of the current input and outpuy streams,
since these are effectively the "enablers" for the calls that the
above paragraph describes.
Fix the conditions on some error specs.
Delete a duplicated comment.
compiler/simplify_tasks.m:
Add the new task to the list of tasks that simplification
may be asked to do.
compiler/simplify_info.m:
compiler/simplify_proc.m:
Fix an old minor bug: shut up *all* messages, whether their severity
is error, warning or informational, during the second pass of
simplification. (The need for the fix is described in the new comment
in simplify_proc.m.)
compiler/common.m:
compiler/simplify_goal.m:
compiler/simplify_goal_disj.m:
compiler/simplify_goal_ite.m:
Conform to the changes above.
tests/warnings/save.{m,exp}:
A new test case to test the new option.
tests/warnings/Mmakefile:
Enable the new test case.
Switch to a more consistent indentation style.
tests/warnings/Mercury.options:
Run the new test case with the new option.
tests/debugger/save.m:
The new test case, warnings/save.m, is a version of debugger/save.m
with up-to-date programming style. Update the original as well.