[m-rev.] diff: fix mercury_windows.h

Julien Fischer juliensf at csse.unimelb.edu.au
Fri Oct 28 01:13:18 AEDT 2011


Branches: 11.07, main

Fix several problems in the recently added mercury_windows header.

runtime/mercury_windows.h
 	Fix a typo: s/WIN2_/WIN32_/

 	We need to wrap the contents of this file in
 	#if defined(MR_WIN32) ... #endif; otherwise the
 	namespace cleanliness check fails on non-Windows
 	systems.

runtime/RESERVED_MACRO_NAMES:
 	Ignore the WIN32_LEAN_NAD_MEAN macro since the runtime
 	may define it in order to control the behaviour of windows.h.

Julien.

Index: runtime/RESERVED_MACRO_NAMES
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/RESERVED_MACRO_NAMES,v
retrieving revision 1.22
diff -u -r1.22 RESERVED_MACRO_NAMES
--- runtime/RESERVED_MACRO_NAMES	14 Sep 2011 07:00:43 -0000	1.22
+++ runtime/RESERVED_MACRO_NAMES	27 Oct 2011 14:04:29 -0000
@@ -81,3 +81,6 @@
  _REENTRANT
  _THREAD_SAFE
  #-----------------------------------------------------------------------------#
+# This is defined on Windows to workaround problems with windows.h.
+WIN32_LEAN_AND_MEAN
+#-----------------------------------------------------------------------------#
Index: runtime/mercury_windows.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_windows.h,v
retrieving revision 1.1
diff -u -r1.1 mercury_windows.h
--- runtime/mercury_windows.h	26 Oct 2011 14:08:45 -0000	1.1
+++ runtime/mercury_windows.h	27 Oct 2011 14:08:16 -0000
@@ -17,21 +17,21 @@
  #ifndef MERCURY_WINDOWS_H
  #define MERCURY_WINDOWS_H

-/*
-** NOTE: the following is not protected by any guards - it is the
-** responsibility of modules that #include this one to ensure that
-** the windows.h is available before #including this file.
-*/
+#include "mercury_conf_param.h"

-/*
-** Defining WIN32_LEAN_AND_MEAN disables a series of #includes inside
-** windows.h -- notably it disables the #include of winsock.h, the inclusion
-** of which renders the winsock2 API unusable in Mercury foreign_procs.
-*/
-#if !defined(WIN32_LEAN_AND_MEAN)
-    #define WIN2_LEAN_AND_MEAN
-#endif
+#if defined(MR_WIN32)
+ 
+    /*
+    ** Defining WIN32_LEAN_AND_MEAN disables a series of #includes inside
+    ** windows.h -- notably it disables the #include of winsock.h, the
+    ** inclusion of which renders the winsock2 API unusable in Mercury
+    ** foreign_procs.
+    */
+    #if !defined(WIN32_LEAN_AND_MEAN)
+        #define WIN32_LEAN_AND_MEAN
+    #endif

-#include <windows.h>
+    #include <windows.h>
+#endif

  #endif /* not MERCURY_WINDOWS_H */

--------------------------------------------------------------------------
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