[m32c] fix sbrk prototype

DJ Delorie dj@redhat.com
Thu Jul 9 14:11:00 GMT 2009


sizeof(int) != sizeof(ptr) on m32c.  Committed.

	* m32c/sbrk.c (sbrk): Change to take ptrdiff_t, not int.

Index: m32c/sbrk.c
===================================================================
RCS file: /cvs/src/src/libgloss/m32c/sbrk.c,v
retrieving revision 1.1
diff -p -U3 -r1.1 sbrk.c
--- m32c/sbrk.c	10 Aug 2005 20:29:33 -0000	1.1
+++ m32c/sbrk.c	8 Jul 2009 20:53:16 -0000
@@ -32,8 +32,16 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
 
 extern void _set_heaptop(void *ptr);
 
+/* Normally these would be in unistd.h but we don't rely on that being
+   available during this build.  */
+#if defined(__r8c_cpu__) || defined(__m16c_cpu__)
+#define PTRDIFF_T int
+#else
+#define PTRDIFF_T long
+#endif
+
 char *
-sbrk(int adj)
+sbrk(PTRDIFF_T adj)
 {
   extern char end;
   static char *heap = &end;



More information about the Newlib mailing list