mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-19 03:13:40 +00:00
The tests below are not actually invalid, they cause the compiler to emit only
warnings and properly belong in the warnings directory.
tests/invalid/empty_interface.{m,err_exp}:
tests/invalid/foreign_singleton.{m,err_exp}:
tests/invalid/obsolete_proc_pragma.{m,err_exp}:
Shift these tests into the warnings directory and use the
appropriate extension for expected outputs in that directory
tests/invalid/Mmakefile:
tests/invalid/Mercury.options:
tests/warnings/Mercury.options:
tests/warnings/Mmakefile:
Conform to the above changes.
44 lines
798 B
Mathematica
44 lines
798 B
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- module foreign_singleton.
|
|
|
|
:- interface.
|
|
|
|
:- import_module io.
|
|
|
|
:- pred main(io::di, io::uo) is det.
|
|
|
|
:- implementation.
|
|
|
|
main(!IO) :-
|
|
f(X, !IO),
|
|
io.write_int(X, !IO),
|
|
io.nl(!IO),
|
|
g(Y, !IO),
|
|
io.write_int(Y, !IO),
|
|
io.nl(!IO).
|
|
|
|
:- pred f(int::out, io::di, io::uo) is det.
|
|
|
|
:- pragma foreign_proc("C",
|
|
f(X::out, IO0::di, _IO::uo),
|
|
[will_not_call_mercury, promise_pure],
|
|
"
|
|
X = 5;
|
|
").
|
|
|
|
f(X, !IO).
|
|
|
|
:- pred g(int::out, io::di, io::uo) is det.
|
|
|
|
g(X, !IO).
|
|
|
|
:- pragma foreign_proc("C",
|
|
g(X::out, IO0::di, _IO::uo),
|
|
[will_not_call_mercury, promise_pure],
|
|
"
|
|
X = 5;
|
|
").
|