mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-17 06:47:17 +00:00
Estimated hours taken: 1 compiler/make_hlds.m: Report errors if a variable occurs multiple times in the argument list of a `:- pragma c_code' declaration. doc/reference_manual.texi: Document that variables must occur only once in a `:- pragma c_code' argument list. tests/invalid/Mmakefile: tests/invalid/pragma_c_code_dup_var.m: tests/invalid/pragma_c_code_dup_var.err_exp: Test case.
24 lines
852 B
Mathematica
24 lines
852 B
Mathematica
% Test errors for variables occurring multiple times in
|
|
% a `:- pragma c_code' argument list.
|
|
:- module pragma_c_code_dup_var.
|
|
|
|
:- interface.
|
|
|
|
:- import_module io.
|
|
|
|
:- type buffer == string.
|
|
:- type object == c_pointer.
|
|
:- type unmarshalled(T) ---> unmarshalled(T).
|
|
:- type signed_long_int ---> signed_short_int(c_pointer).
|
|
|
|
:- func bread_impl(object, object, unmarshalled(buffer), unmarshalled(buffer), unmarshalled(signed_long_int), io__state, io__state) = unmarshalled(signed_long_int).
|
|
:- mode bread_impl(in, out, in, out, in, di, uo) = out is det.
|
|
|
|
:- implementation.
|
|
|
|
:- pragma c_code(bread_impl(MC_Object0::in, MC_Object::out, Buf::in, Buf::out, Nbyte::in, MC_IO0::di, MC_IO::uo) = (Mc_returnval::out),
|
|
will_not_call_mercury, "
|
|
Mc_returnval = apache_gen__apache__request__bread(MC_Object0, &MC_Object, Buf, &Buf, Nbyte);
|
|
MC_IO = MC_IO0;
|
|
").
|