[m-rev.] diff: avoid a warning from gcc

Julien Fischer juliensf at cs.mu.OZ.AU
Thu Mar 2 16:55:24 AEDT 2006


Estimated hours taken: 0.5
Branches: main

Avoid warnings about implicit declaration of memalign in nogc grades.

Note: we'll eventually be moving to posix_memalign but we havent' yet
      tested the version that uses that.

configure.in:
runtime/mercury_conf.h.in:
	Check for malloc.h which we need for memalign on some systems, e.g.
	Linux.

runtime/mercury_memory_zones.c:
	Conditionally include malloc.h if it available, since we need
	it for memalign on some architectures.

Julien.

Index: configure.in
===================================================================
RCS file: /home/mercury1/repository/mercury/configure.in,v
retrieving revision 1.446
diff -u -r1.446 configure.in
--- configure.in	24 Feb 2006 07:11:08 -0000	1.446
+++ configure.in	2 Mar 2006 05:33:52 -0000
@@ -980,7 +980,7 @@
 		unistd.h sys/wait.h sys/siginfo.h sys/signal.h ucontext.h \
 		asm/sigcontext.h sys/param.h sys/time.h sys/times.h \
 		sys/types.h sys/stat.h fcntl.h termios.h sys/ioctl.h \
-		sys/stropts.h windows.h dirent.h getopt.h)
+		sys/stropts.h windows.h dirent.h getopt.h malloc.h)

 if test "$MR_HAVE_GETOPT_H" = 1; then
 	GETOPT_H_AVAILABLE=yes
Index: runtime/mercury_conf.h.in
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_conf.h.in,v
retrieving revision 1.52
diff -u -r1.52 mercury_conf.h.in
--- runtime/mercury_conf.h.in	13 Sep 2005 08:25:37 -0000	1.52
+++ runtime/mercury_conf.h.in	2 Mar 2006 02:18:44 -0000
@@ -128,6 +128,7 @@
 **	MR_HAVE_WINDOWS_H	we have <windows.h>
 **	MR_HAVE_IEEEFP_H	we have <ieeefp.h>
 **	MR_HAVE_DIRENT_H	we have <dirent.h>
+**	MR_HAVE_MALLOC_H	we have <malloc.h>
 */
 #undef	MR_HAVE_SYS_SIGINFO_H
 #undef	MR_HAVE_SYS_SIGNAL_H
@@ -149,6 +150,7 @@
 #undef	MR_HAVE_WINDOWS_H
 #undef	MR_HAVE_IEEEFP_H
 #undef	MR_HAVE_DIRENT_H
+#undef	MR_HAVE_MALLOC_H

 /*
 ** MR_HAVE_POSIX_TIMES is defined if we have the POSIX
Index: runtime/mercury_memory_zones.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_memory_zones.c,v
retrieving revision 1.27
diff -u -r1.27 mercury_memory_zones.c
--- runtime/mercury_memory_zones.c	15 Dec 2005 13:36:25 -0000	1.27
+++ runtime/mercury_memory_zones.c	2 Mar 2006 05:33:12 -0000
@@ -34,8 +34,10 @@
 #include <stdio.h>
 #include <string.h>

-#ifdef MR_HAVE_STDLIB_H
-  #include <stdlib.h>       /* for memalign and posix_memalign */
+#include <stdlib.h>   /* for memalign and posix_memalign */
+
+#ifdef MR_HAVE_MALLOC_H
+    #include <malloc.h>     /* for memalign */
 #endif

 #ifdef MR_HAVE_SYS_SIGINFO_H

--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list