Files
mercury/tests/valid/intermod_pragma_import2.m
Simon Taylor e3c5c1e085 Fix bugs in :- pragma import' and :- pragma export' with
Estimated hours taken: 3

Fix bugs in `:- pragma import' and `:- pragma export' with
inter-module optimizaton reported by Peter Ross (bug #131069).

compiler/mercury_to_mercury.m:
	The code to output `:- pragma import' declarations was
	writing `:- pragma import(p(Arg1::in, Arg2::out), "imported")'.
	The correct output is `:- pragma import(p(in, out), "imported")'.

compiler/mercury_compile.m:
	For modules containing `:- pragma export' declarations, add
	":- pragma c_header_code("#include ModuleName.h")." to
	the `.opt' file so the C compiler can find the function
	prototypes for Mercury predicates exported to C when
	compiling the C code in the `.opt' file.

	Write the `.h' file for a module when writing the `.opt' file
	when using the LLDS backend to avoid trying to use the `.h' file
	before it has been created.

tests/valid/Mmakefile:
tests/valid/intermod_pragma_import.m:
tests/valid/intermod_pragma_import2.m:
	Test case.
2001-02-09 03:27:36 +00:00

15 lines
291 B
Mathematica

:- module intermod_pragma_import2.
:- interface.
:- pred implemented_as_pragma_import(T::in, int::out) is det.
:- implementation.
:- pred p(T::in, int::out) is det.
p(_, 4).
:- pragma import(implemented_as_pragma_import(in, out), "imported").
:- pragma export(p(in, out), "imported").