[m-rev.] diff: avoid another C compiler warning on MinGW
Julien Fischer
juliensf at csse.unimelb.edu.au
Wed Dec 15 00:58:45 AEDT 2010
Branches: main
Avoid a C compiler warning due to the system headers on MinGW not including a
declaration for getpagesize(). This, according to the MinGW developers, is
deliberate, despite getpagesize() being defined in libgcc on that system
it isn't supposed to be used -- this diff redirects calls to getpagesize()
on MinGW to the Win32 function GetSystemInfo().
runtime/mercury_context.c:
As above.
Rename the definition of getpagesize() we use with MSVC and use
that with MinGW as well. Add a macro that maps calls to
getpagesize() onto the renamed function.
Julien.
Index: runtime/mercury_memory.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_memory.c,v
retrieving revision 1.40
diff -u -r1.40 mercury_memory.c
--- runtime/mercury_memory.c 5 Dec 2008 07:18:05 -0000 1.40
+++ runtime/mercury_memory.c 14 Dec 2010 13:48:44 -0000
@@ -74,14 +74,28 @@
/*---------------------------------------------------------------------------*/
+/*
+** NOTE: getpagesize() is not officially supported on MinGW (there is no
+** declaration in the system headers), but one of the supporting libraries
+** used by GCC does define a symbol with that name. Consequently on MinGW,
+** we need to use GetSystemInfo() even though MR_HAVE_GETPAGESIZE is
+** defined.
+*/
+
#if defined(MR_HAVE_SYSCONF) && defined(_SC_PAGESIZE)
#define getpagesize() sysconf(_SC_PAGESIZE)
-#elif !defined(MR_HAVE_GETPAGESIZE)
+#elif !defined(MR_HAVE_GETPAGESIZE) || defined(MR_MINGW)
#if defined(MR_WIN32_GETSYSTEMINFO)
#include <windows.h>
-
+
+ #define getpagesize() MR_win32_getpagesize()
+
+ /*
+ ** NOTE: we avoid naming the following getpagesize() since that
+ ** name is already used on MinGW.
+ */
static size_t
- getpagesize(void)
+ MR_win32_getpagesize(void)
{
SYSTEM_INFO SysInfo;
GetSystemInfo(&SysInfo);
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list