Files
mercury/tests/invalid/bad_item_in_interface.m
Zoltan Somogyi aed31c7eda Fix several test case failures.
tests/debugger/user_event_shallow.{m,exp}:
    Mark a predicate with no_inline to prevent -O5 from optimizing
    away an event that the .inp of this case depends on.

tests/invalid/Mmakefile:
    Make the test cases in this directory work even if code generation
    requires reading in the module's own .int file.

tests/invalid/bad_item_in_interface.err_exp2:
    Add an expected output file for grades that do not support memoisation.

tests/invalid/bad_item_in_interface.m:
    Document the reason for the existence of the .err_exp2 file.

tests/options_file/Mmakefile:
    Make the test cases in this directory work even if code generation
    requires reading in the module's own .int file.

    Conform to the changes below.

compiler/options.m:
doc/user_guide.texi:
    Make the --dump-options-file file take an argument that specifies
    the file to which the contents of the options file should be dumped.

compiler/mercury_compile_main.m:
compiler/options_file.m:
    Dump the options file to the specified file, if the filename is not "".
2021-07-30 01:43:59 +10:00

75 lines
1.8 KiB
Mathematica

%---------------------------------------------------------------------------%
% vim: ts=4 sw=4 et ft=mercury
%---------------------------------------------------------------------------%
% The .err_exp2 is for grades that don't support pragma memo.
:- module bad_item_in_interface.
:- interface.
:- import_module io.
:- pred main(io::di, io::uo) is det.
:- implementation.
main(!IO) :-
hello(!IO).
:- pred hello(io::di, io::uo) is det.
% If this section marker is commented out, this module should compile cleanly.
% That way, we know that we get all the resulting error messages purely
% because the presence of the following items in the interface section,
% instead of the implementation section.
:- interface.
hello(!IO) :-
io.write_string("Hello, world.\n", !IO).
:- pragma foreign_decl("C",
"
extern int example_x;
").
:- pragma foreign_code("C",
"
int example_x = 0;
").
:- pragma foreign_export("C", hello(di, uo), "hello_for_c").
:- type e
---> e1
; e2.
:- pragma foreign_export_enum("C", e/0, [prefix("PREFIX_")]).
:- pragma inline(hello/2).
:- pragma no_inline(main/2).
:- pragma consider_used(hello/2).
:- pragma no_determinism_warning(hello/2).
:- pred ft_example(int::in, int::out) is semidet.
:- pragma fact_table(ft_example/2, "ft_examples").
:- pragma memo(ft_example/2).
:- impure pred imp1(int::out) is det.
:- impure pred imp2(int::out) is det.
:- pragma external_pred(imp1/1).
:- pragma external_pred(imp2/1).
:- pragma promise_pure(imp1/1).
:- pragma promise_semipure(imp2/1).
:- pragma promise_equivalent_clauses(hello/2).
:- pragma require_feature_set([memo]).
:- pragma foreign_proc("C",
hello(_IO0::di, _IO::uo),
[will_not_call_mercury, promise_pure],
"
printf(""Hello, world.\\n"");
").
:- mutable(x, int, 0, ground, [untrailed]).
:- initialise hello/2.
:- finalise hello/2.