changeset 10346:65d5776379c3

Reduce the amount of stuff included by windows.h and avoid min/max being #define-d
author Michael Goffioul <michael.goffioul@gmail.com>
date Sun, 21 Feb 2010 18:04:59 +0000
parents 33b012d39dce
children dcee31e49f86
files ChangeLog configure.ac libcruft/ChangeLog libcruft/misc/quit.h liboctave/ChangeLog liboctave/lo-sysdep.cc liboctave/lo-utils.h liboctave/oct-inttypes.h liboctave/oct-shlib.cc src/ChangeLog src/DLD-FUNCTIONS/fltk_backend.cc src/gl-render.h
diffstat 12 files changed, 23 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Feb 21 17:46:30 2010 +0000
+++ b/ChangeLog	Sun Feb 21 18:04:59 2010 +0000
@@ -1,5 +1,7 @@
 2010-02-21  Michael Goffioul  <michael.goffioul@gmail.com>
 
+	* configure.ac: Define NOMINMAX under MSVC.
+
 	* configure.ac: Add pcre_config --cflags to XTRA_CXXFLAGS instead of
 	CPPFLAGS.
 
--- a/configure.ac	Sun Feb 21 17:46:30 2010 +0000
+++ b/configure.ac	Sun Feb 21 18:04:59 2010 +0000
@@ -430,6 +430,11 @@
 AC_SUBST(XTRA_CFLAGS)
 AC_SUBST(XTRA_CXXFLAGS)
 
+## Avoid #define of min/max from windows.h header
+if test "$have_msvc" = "yes"; then
+  AC_DEFINE(NOMINMAX, 1, [Define if you want to avoid min/max macro definition in Windows headers])
+fi
+
 ### Use -static if compiling on Alpha OSF/1 1.3 systems.
 
 case "$canonical_host_type" in
--- a/libcruft/ChangeLog	Sun Feb 21 17:46:30 2010 +0000
+++ b/libcruft/ChangeLog	Sun Feb 21 18:04:59 2010 +0000
@@ -1,5 +1,7 @@
 2010-02-21  Michael Goffioul  <michael.goffioul@gmail.com>
 
+	* misc/quit.h: Define WIN32_LEAN_AND_MEAN and don't #undef min/max.
+
 	* Makefile.am: Add -bindir option to libcruft_la_LDFLAGS.
 
 2010-02-17  John W. Eaton  <jwe@octave.org>
--- a/libcruft/misc/quit.h	Sun Feb 21 17:46:30 2010 +0000
+++ b/libcruft/misc/quit.h	Sun Feb 21 18:04:59 2010 +0000
@@ -35,9 +35,8 @@
 
 #if defined (__WIN32__) && ! defined (_POSIX_VERSION)
 
+#define WIN32_LEAN_AND_MEAN
 #include <windows.h>
-#undef min
-#undef max
 
 CRUFT_API extern void w32_sigint_init (void);   /* setup */
 CRUFT_API extern void w32_raise_final (void);   /* tear down */
--- a/liboctave/ChangeLog	Sun Feb 21 17:46:30 2010 +0000
+++ b/liboctave/ChangeLog	Sun Feb 21 18:04:59 2010 +0000
@@ -1,5 +1,9 @@
 2010-02-21  Michael Goffioul  <michael.goffioul@gmail.com>
 
+	* lo-sysdep.cc, lo-utils.h, oct-shlib.h: Define WIN32_LEAN_AND_MEAN
+	and don't #undef min/max.
+	* oct-inttypes.h: Don't #undef min/max.
+
 	* oct-glob.cc (octave_glob): Convert backslashes to forward slashes
 	automatically before calling glob, and convert back after the call
 	(implementation from jwe).
--- a/liboctave/lo-sysdep.cc	Sun Feb 21 17:46:30 2010 +0000
+++ b/liboctave/lo-sysdep.cc	Sun Feb 21 18:04:59 2010 +0000
@@ -34,11 +34,8 @@
 #include <fcntl.h>
 
 #if defined (__WIN32__) && ! defined (__CYGWIN__)
+#define WIN32_LEAN_AND_MEAN
 #include <windows.h>
-#ifdef max
-# undef min
-# undef max
-#endif
 #endif
 
 #include "file-ops.h"
--- a/liboctave/lo-utils.h	Sun Feb 21 17:46:30 2010 +0000
+++ b/liboctave/lo-utils.h	Sun Feb 21 18:04:59 2010 +0000
@@ -114,13 +114,13 @@
 octave_write_float_complex (std::ostream& os, const FloatComplex& cval);
 
 #ifdef HAVE_LOADLIBRARY_API
+#define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 extern "C" OCTAVE_API void *
 octave_w32_library_search (HINSTANCE handle, const char *name);
-#undef min
-#undef max
-#endif
 #endif
 
 extern "C" OCTAVE_API pid_t
 octave_waitpid (pid_t pid, int *status, int options);
+
+#endif
--- a/liboctave/oct-inttypes.h	Sun Feb 21 17:46:30 2010 +0000
+++ b/liboctave/oct-inttypes.h	Sun Feb 21 18:04:59 2010 +0000
@@ -39,12 +39,6 @@
 inline long double xisnan (long double x) { return xisnan (static_cast<double> (x)); }
 #endif
 
-// Undefine min/max if needed (this may happen under Windows)
-#ifdef min
-#undef min
-#undef max
-#endif
-
 // FIXME -- we define this by our own because some compilers, such as
 // MSVC, do not provide std::abs (int64_t) and std::abs (uint64_t).  In
 // the future, it should go away in favor of std::abs.
--- a/liboctave/oct-shlib.cc	Sun Feb 21 17:46:30 2010 +0000
+++ b/liboctave/oct-shlib.cc	Sun Feb 21 18:04:59 2010 +0000
@@ -50,9 +50,8 @@
 #elif defined (HAVE_SHL_LOAD_API)
 #include <dl.h>
 #elif defined (HAVE_LOADLIBRARY_API)
+#define WIN32_LEAN_AND_MEAN
 #include <windows.h>
-#undef min
-#undef max
 #endif
 }
 
--- a/src/ChangeLog	Sun Feb 21 17:46:30 2010 +0000
+++ b/src/ChangeLog	Sun Feb 21 18:04:59 2010 +0000
@@ -1,5 +1,8 @@
 2010-02-21  Michael Goffioul  <michael.goffioul@gmail.com>
 
+	* gl-render.h: Define WIN32_LEAN_AND_MEAN and don't #undef min/max.
+	* DLD-FUNCTIONS/fltk_backend.cc: Don't #undef min/max.
+
 	* sighandlers.cc (octave_set_signal_handler): Don't use SIGALRM
 	unconditionally.
 
--- a/src/DLD-FUNCTIONS/fltk_backend.cc	Sun Feb 21 17:46:30 2010 +0000
+++ b/src/DLD-FUNCTIONS/fltk_backend.cc	Sun Feb 21 18:04:59 2010 +0000
@@ -49,11 +49,6 @@
 #include <FL/fl_draw.H>
 #include <FL/gl.h>
 
-#ifdef min
-#undef min
-#undef max
-#endif
-
 #include "cmd-edit.h"
 #include "lo-ieee.h"
 
--- a/src/gl-render.h	Sun Feb 21 17:46:30 2010 +0000
+++ b/src/gl-render.h	Sun Feb 21 18:04:59 2010 +0000
@@ -24,11 +24,8 @@
 #define gl_render_h 1
 
 #ifdef HAVE_WINDOWS_H
+#define WIN32_LEAN_AND_MEAN
 #include <windows.h>
-#ifdef max
-# undef min
-# undef max
-#endif
 #endif
 
 #ifdef HAVE_GL_GL_H