[m-dev.] mainline regression: io.buffer vs ISO C

Peter Ross pro at missioncriticalit.com
Tue Dec 24 23:35:44 AEDT 2002


On Tue, Dec 24, 2002 at 02:24:10AM +1100, Fergus Henderson wrote:
> Pete,
> 
> The following change
> 
> > revision 1.282
> > date: 2002/12/04 09:39:37;  author: petdr;  state: Exp;  lines: +63 -36
> > 
> > Estimated hours taken: 2
> > Branches: main
> > 
> > Get io__read_file_as_string working on the il backend.
> > 
> > library/io.m:
> >         Implement the buffer type as a Mercury type, in addition to as
> >         a C array.
> 
> appears to be responsible for the following stage 1 compile error
> when compiling with lcc:
> 

===================================================================


Estimated hours taken: 0.5
Branches: main

library/io.m:
    Fix an ISO C compliance error, where we attempted to cast a (char *)
    to an (unsigned int).

Index: library//io.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/library/io.m,v
retrieving revision 1.284
diff -u -r1.284 io.m
--- library//io.m	18 Dec 2002 16:21:07 -0000	1.284
+++ library//io.m	24 Dec 2002 10:35:14 -0000
@@ -2125,10 +2125,11 @@
 	io__alloc_buffer(Size::in, Buffer::buffer_uo),
 	[will_not_call_mercury, promise_pure, tabled_for_io, thread_safe],
 "{
-	MR_incr_hp_atomic_msg(Buffer,
+	MR_maybe_record_allocation(
 		(Size * sizeof(MR_Char) + sizeof(MR_Word) - 1)
 			/ sizeof(MR_Word),
 		MR_PROC_LABEL, ""io:buffer/0"");
+	Buffer = MR_GC_NEW_ARRAY(MR_Char, Size);
 }").
 
 io__alloc_buffer(Size, buffer(Array)) :-
@@ -2173,7 +2174,7 @@
 	}
 #endif
 
-	Buffer = (MR_Word) buffer;
+	Buffer = buffer;
 }").
 
 io__resize_buffer(buffer(Array0), _OldSize, NewSize, buffer(Array)) :-
@@ -2220,7 +2221,7 @@
 
 	items_read = MR_READ(*f, buffer + Pos0, Size - Pos0);
 
-	Buffer = (MR_Word) buffer;
+	Buffer = buffer;
 	Pos = Pos0 + items_read;
 	MR_update_io(IO0, IO);
 }").

--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list