Files
mercury/tests/warnings/foreign_singleton.m
Julien Fischer 99cd93dcfb Shift some tests.
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.
2022-04-14 16:13:37 +10:00

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;
").