Files
mercury/tests/warnings/save.exp
Zoltan Somogyi ecf46857c1 Fix warnings for io.format("...", [...], !IO).
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.
2016-10-17 20:54:03 +11:00

24 lines
1.5 KiB
Plaintext

save.m:026: The call to predicate `io.write_string'/3 could have an additional
save.m:026: argument explicitly specifying a stream.
save.m:028: The call to predicate `io.see'/4 could be made redundant by
save.m:028: explicitly passing the input stream it specifies to later I/O
save.m:028: operations.
save.m:031: The call to predicate `io.read_file_as_string'/3 could have an
save.m:031: additional argument explicitly specifying a stream.
save.m:034: The call to predicate `io.write_string'/3 could have an additional
save.m:034: argument explicitly specifying a stream.
save.m:038: The call to predicate `io.format'/4 could have an additional
save.m:038: argument explicitly specifying a stream.
save.m:043: The call to predicate `io.write_string'/3 could have an additional
save.m:043: argument explicitly specifying a stream.
save.m:106: The call to predicate `io.write_string'/3 could have an additional
save.m:106: argument explicitly specifying a stream.
save.m:109: The call to predicate `io.write_string'/3 could have an additional
save.m:109: argument explicitly specifying a stream.
save.m:111: The call to predicate `io.write_string'/3 could have an additional
save.m:111: argument explicitly specifying a stream.
save.m:118: The call to predicate `io.write_int'/3 could have an additional
save.m:118: argument explicitly specifying a stream.
save.m:123: The call to predicate `io.write_string'/3 could have an additional
save.m:123: argument explicitly specifying a stream.