mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-17 02:13:54 +00:00
doc/reference_manual.texi:
NEWS:
Allow a disable_warning scope to override the setting of the
--warn-unknown-format-calls option to "yes" inside its scope.
compiler/prog_data.m:
Provide a representation for the new kind of disable-able warning.
compiler/parse_goal.m:
Parse the new kind of disable-able warning.
compiler/prog_out.m:
Print out the new kind of disable-able warning.
compiler/format_call.m:
Add a parameter to the format checking code to control whether
we generate this warning. Using this parameter yields clearer code
that locally overriding the value of the option.
compiler/simplify_goal_scope.m:
Ignore the new kind of disable-able warning in code that has nothing
to do with it.
compiler/options.m:
doc/user_guide.texi:
Fix an old issue: include stream.string_writer.format in the description
of --warn-unknown-format-calls.
tests/warnings/disabled_warning.{m,exp}:
Add a test of the new functionality.
tests/warnings/Mmakefile:
tests/warnings/Mercury.options:
Enable the new test case.
27 lines
792 B
Mathematica
27 lines
792 B
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ft=mercury ts=4 sw=4 et
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- module disabled_warning.
|
|
:- interface.
|
|
|
|
:- pred p1(string::in, int::in, string::out) is det.
|
|
:- pred p2(string::in, int::in, string::out) is det.
|
|
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- implementation.
|
|
|
|
:- import_module list.
|
|
:- import_module string.
|
|
|
|
p1(FormatStr, N, Str) :-
|
|
disable_warning [unknown_format_calls] (
|
|
% The warning for this call should be disabled by the scope.
|
|
string.format(FormatStr, [i(N)], Str)
|
|
).
|
|
|
|
p2(FormatStr, N, Str) :-
|
|
% We should get a warning for this call.
|
|
string.format(FormatStr, [i(N)], Str).
|