From 17a574d7cd8c541c902cc0da40362a32d965e77b Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 4 Sep 2012 22:53:42 -0700 Subject: [PATCH] Use the correct macro _WIN32 for Windows. The correct predefined macro for Windows is _WIN32, not WIN32 or __WIN32__. _WIN32 is defined for 32-bit and 64-bit version of Windows by both MSVC and MinGW compilers. http://sourceforge.net/p/predef/wiki/OperatingSystems http://msdn.microsoft.com/en-us/library/b0084kay.aspx This patch also fixes a MinGW automake build error. Signed-off-by: Vinson Lee Reviewed-by: Brian Paul --- src/gallium/auxiliary/util/u_snprintf.c | 2 +- src/gallium/auxiliary/util/u_string.h | 4 ++-- src/gallium/tests/graw/fs-test.c | 2 +- src/gallium/tests/graw/gs-test.c | 2 +- src/gallium/tests/graw/vs-test.c | 2 +- src/glx/glxclient.h | 2 +- src/mapi/glapi/gen/gl_x86-64_asm.py | 2 +- src/mapi/glapi/gen/gl_x86_asm.py | 2 +- src/mapi/glapi/glapi_dispatch.c | 2 +- src/mapi/mapi/u_current.c | 2 +- src/mapi/mapi/u_thread.h | 4 ++-- src/mesa/main/compiler.h | 6 +++--- src/mesa/main/imports.c | 2 +- src/mesa/x86/common_x86.c | 6 +++--- 14 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/gallium/auxiliary/util/u_snprintf.c b/src/gallium/auxiliary/util/u_snprintf.c index f0d53b3cecd..e16f103e3f5 100644 --- a/src/gallium/auxiliary/util/u_snprintf.c +++ b/src/gallium/auxiliary/util/u_snprintf.c @@ -167,7 +167,7 @@ #if HAVE_CONFIG_H #include #else -#ifdef WIN32 +#ifdef _WIN32 #define vsnprintf util_vsnprintf #define snprintf util_snprintf #define HAVE_VSNPRINTF 0 diff --git a/src/gallium/auxiliary/util/u_string.h b/src/gallium/auxiliary/util/u_string.h index ed15981f1a5..15630ad0791 100644 --- a/src/gallium/auxiliary/util/u_string.h +++ b/src/gallium/auxiliary/util/u_string.h @@ -35,7 +35,7 @@ #ifndef U_STRING_H_ #define U_STRING_H_ -#if !defined(WIN32) && !defined(XF86_LIBC_H) +#if !defined(_WIN32) && !defined(XF86_LIBC_H) #include #endif #include @@ -64,7 +64,7 @@ util_strchrnul(const char *s, char c) #endif -#ifdef WIN32 +#ifdef _WIN32 int util_vsnprintf(char *, size_t, const char *, va_list); int util_snprintf(char *str, size_t size, const char *format, ...); diff --git a/src/gallium/tests/graw/fs-test.c b/src/gallium/tests/graw/fs-test.c index 1c0d514667a..ffb6bd269d6 100644 --- a/src/gallium/tests/graw/fs-test.c +++ b/src/gallium/tests/graw/fs-test.c @@ -22,7 +22,7 @@ unsigned show_fps = 0; static void usage(char *name) { fprintf(stderr, "usage: %s [ options ] shader_filename\n", name); -#ifndef WIN32 +#ifndef _WIN32 fprintf(stderr, "\n" ); fprintf(stderr, "options:\n"); fprintf(stderr, " -fps show frames per second\n"); diff --git a/src/gallium/tests/graw/gs-test.c b/src/gallium/tests/graw/gs-test.c index 52eb6007976..48db759a112 100644 --- a/src/gallium/tests/graw/gs-test.c +++ b/src/gallium/tests/graw/gs-test.c @@ -23,7 +23,7 @@ unsigned draw_strip = 0; static void usage(char *name) { fprintf(stderr, "usage: %s [ options ] shader_filename\n", name); -#ifndef WIN32 +#ifndef _WIN32 fprintf(stderr, "\n" ); fprintf(stderr, "options:\n"); fprintf(stderr, " -fps show frames per second\n"); diff --git a/src/gallium/tests/graw/vs-test.c b/src/gallium/tests/graw/vs-test.c index ad524c46537..d01cdf8e95f 100644 --- a/src/gallium/tests/graw/vs-test.c +++ b/src/gallium/tests/graw/vs-test.c @@ -23,7 +23,7 @@ unsigned show_fps = 0; static void usage(char *name) { fprintf(stderr, "usage: %s [ options ] shader_filename\n", name); -#ifndef WIN32 +#ifndef _WIN32 fprintf(stderr, "\n" ); fprintf(stderr, "options:\n"); fprintf(stderr, " -fps show frames per second\n"); diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h index 91577a81c2d..087f23892e9 100644 --- a/src/glx/glxclient.h +++ b/src/glx/glxclient.h @@ -47,7 +47,7 @@ #include #include #include -#ifdef WIN32 +#ifdef _WIN32 #include #endif #include "GL/glxproto.h" diff --git a/src/mapi/glapi/gen/gl_x86-64_asm.py b/src/mapi/glapi/gen/gl_x86-64_asm.py index ef759bf7bf3..3ef5e08a9c0 100644 --- a/src/mapi/glapi/gen/gl_x86-64_asm.py +++ b/src/mapi/glapi/gen/gl_x86-64_asm.py @@ -138,7 +138,7 @@ class PrintGenericStubs(gl_XML.gl_print_base): print '# define GL_PREFIX(n) GLNAME(CONCAT(gl,n))' print '# endif' print '' - print '#if defined(PTHREADS) || defined(WIN32)' + print '#if defined(PTHREADS) || defined(_WIN32)' print '# define THREADS' print '#endif' print '' diff --git a/src/mapi/glapi/gen/gl_x86_asm.py b/src/mapi/glapi/gen/gl_x86_asm.py index b43b65dd829..095edcdc035 100644 --- a/src/mapi/glapi/gen/gl_x86_asm.py +++ b/src/mapi/glapi/gen/gl_x86_asm.py @@ -78,7 +78,7 @@ class PrintGenericStubs(gl_XML.gl_print_base): print '#define GLOBL_FN(x) GLOBL x' print '#endif' print '' - print '#if defined(PTHREADS) || defined(WIN32)' + print '#if defined(PTHREADS) || defined(_WIN32)' print '# define THREADS' print '#endif' print '' diff --git a/src/mapi/glapi/glapi_dispatch.c b/src/mapi/glapi/glapi_dispatch.c index 989f4a3fc30..be65ebedd1d 100644 --- a/src/mapi/glapi/glapi_dispatch.c +++ b/src/mapi/glapi/glapi_dispatch.c @@ -43,7 +43,7 @@ #if !(defined(USE_X86_ASM) || defined(USE_X86_64_ASM) || defined(USE_SPARC_ASM)) -#if defined(WIN32) +#if defined(_WIN32) #define KEYWORD1 GLAPI #else #define KEYWORD1 PUBLIC diff --git a/src/mapi/mapi/u_current.c b/src/mapi/mapi/u_current.c index 21a07abbae5..d902375f8c6 100644 --- a/src/mapi/mapi/u_current.c +++ b/src/mapi/mapi/u_current.c @@ -125,7 +125,7 @@ static int ThreadSafe; void u_current_destroy(void) { -#if defined(THREADS) && defined(WIN32) +#if defined(THREADS) && defined(_WIN32) u_tsd_destroy(&u_current_table_tsd); u_tsd_destroy(&u_current_user_tsd); #endif diff --git a/src/mapi/mapi/u_thread.h b/src/mapi/mapi/u_thread.h index ffe17b207a3..e53f872c92f 100644 --- a/src/mapi/mapi/u_thread.h +++ b/src/mapi/mapi/u_thread.h @@ -153,7 +153,7 @@ u_tsd_set(struct u_tsd *tsd, void *ptr) * IMPORTANT: Link with multithreaded runtime library when THREADS are * used! */ -#ifdef WIN32 +#ifdef _WIN32 struct u_tsd { DWORD key; @@ -225,7 +225,7 @@ u_tsd_set(struct u_tsd *tsd, void *ptr) } } -#endif /* WIN32 */ +#endif /* _WIN32 */ /* diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h index 32efe843415..a8cddaf8fd7 100644 --- a/src/mesa/main/compiler.h +++ b/src/mesa/main/compiler.h @@ -90,7 +90,7 @@ extern "C" { /** * Disable assorted warnings */ -#if !defined(OPENSTEP) && (defined(__WIN32__) && !defined(__CYGWIN__)) && !defined(BUILD_FOR_SNAP) +#if !defined(OPENSTEP) && (defined(_WIN32) && !defined(__CYGWIN__)) && !defined(BUILD_FOR_SNAP) # if !defined(__GNUC__) /* mingw environment */ # pragma warning( disable : 4068 ) /* unknown pragma */ # pragma warning( disable : 4710 ) /* function 'foo' not inlined */ @@ -246,7 +246,7 @@ static INLINE GLuint CPU_TO_LE32(GLuint x) -#if !defined(CAPI) && defined(WIN32) && !defined(BUILD_FOR_SNAP) +#if !defined(CAPI) && defined(_WIN32) && !defined(BUILD_FOR_SNAP) #define CAPI _cdecl #endif @@ -256,7 +256,7 @@ static INLINE GLuint CPU_TO_LE32(GLuint x) * than GNU C */ #ifndef _ASMAPI -#if defined(WIN32) && !defined(BUILD_FOR_SNAP)/* was: !defined( __GNUC__ ) && !defined( VMS ) && !defined( __INTEL_COMPILER )*/ +#if defined(_WIN32) && !defined(BUILD_FOR_SNAP)/* was: !defined( __GNUC__ ) && !defined( VMS ) && !defined( __INTEL_COMPILER )*/ #define _ASMAPI __cdecl #else #define _ASMAPI diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index 0d6b56a518a..9b5f856b0a8 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -57,7 +57,7 @@ #endif -#ifdef WIN32 +#ifdef _WIN32 #define vsnprintf _vsnprintf #elif defined(__IBMC__) || defined(__IBMCPP__) || ( defined(__VMS) && __CRTL_VER < 70312000 ) extern int vsnprintf(char *str, size_t count, const char *fmt, va_list arg); diff --git a/src/mesa/x86/common_x86.c b/src/mesa/x86/common_x86.c index b70ee5084dd..62995072319 100644 --- a/src/mesa/x86/common_x86.c +++ b/src/mesa/x86/common_x86.c @@ -82,7 +82,7 @@ extern void _mesa_test_os_sse_support( void ); extern void _mesa_test_os_sse_exception_support( void ); -#if defined(WIN32) +#if defined(_WIN32) #ifndef STATUS_FLOAT_MULTIPLE_TRAPS # define STATUS_FLOAT_MULTIPLE_TRAPS (0xC00002B5L) #endif @@ -110,7 +110,7 @@ static LONG WINAPI ExceptionFilter(LPEXCEPTION_POINTERS exp) return EXCEPTION_CONTINUE_EXECUTION; } -#endif /* WIN32 */ +#endif /* _WIN32 */ /** @@ -149,7 +149,7 @@ void _mesa_check_os_sse_support( void ) if (ret || !enabled) _mesa_x86_cpu_features &= ~(X86_FEATURE_XMM); } -#elif defined(WIN32) +#elif defined(_WIN32) LPTOP_LEVEL_EXCEPTION_FILTER oldFilter; /* Install our ExceptionFilter */ -- 2.30.2