Commit e21b3a40 authored by Joe Poirier's avatar Joe Poirier Committed by Russ Cox

build: test for _WIN32, not _MINGW32

Use OS rather than compiler specific flag the same way that
__FreeBSD__, __APPLE__, __OpenBSD__, and __linux__ are used.

_WIN32 is defined by GCC (and others) on windows for Win32
and Win64 applications. _WIN32 is set by default for several
other windows based compilers: DMC, MSVC, Intel, Watcom, LCC.

Although the change is for consistency, it allows the Go tools
to be compiled with non-Mingw GCC distributions and non-GCC
compilers that support the GCC extensions.

R=rsc, brainman, vcc
CC=golang-dev
https://golang.org/cl/2168043
parent fce222a9
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
int int
systemtype(int sys) systemtype(int sys)
{ {
#ifdef __MINGW32__ #ifdef _WIN32
return sys&Windows; return sys&Windows;
#else #else
return sys&Plan9; return sys&Plan9;
......
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
#include "a.h" #include "a.h"
#ifdef __MINGW32__ #ifdef _WIN32
int int
spawn(char *prog, char **argv) spawn(char *prog, char **argv)
{ {
......
...@@ -61,7 +61,7 @@ dirfwstat(int fd, Dir *dir) ...@@ -61,7 +61,7 @@ dirfwstat(int fd, Dir *dir)
struct timeval tv[2]; struct timeval tv[2];
ret = 0; ret = 0;
#ifndef __MINGW32__ #ifndef _WIN32
if(~dir->mode != 0){ if(~dir->mode != 0){
if(fchmod(fd, dir->mode) < 0) if(fchmod(fd, dir->mode) < 0)
ret = -1; ret = -1;
......
...@@ -39,7 +39,7 @@ dirstat(char *file) ...@@ -39,7 +39,7 @@ dirstat(char *file)
Dir *d; Dir *d;
char *str; char *str;
#ifdef __MINGW32__ #ifdef _WIN32
if(stat(file, &st) < 0) if(stat(file, &st) < 0)
return nil; return nil;
lst = st; lst = st;
......
...@@ -25,7 +25,7 @@ THE SOFTWARE. ...@@ -25,7 +25,7 @@ THE SOFTWARE.
#include <u.h> #include <u.h>
#include <sys/time.h> #include <sys/time.h>
#include <time.h> #include <time.h>
#ifndef __MINGW32__ #ifndef _WIN32
#include <sys/resource.h> #include <sys/resource.h>
#endif #endif
#define NOPLAN9DEFINES #define NOPLAN9DEFINES
...@@ -34,7 +34,7 @@ THE SOFTWARE. ...@@ -34,7 +34,7 @@ THE SOFTWARE.
long long
p9times(long *t) p9times(long *t)
{ {
#ifdef __MINGW32__ #ifdef _WIN32
memset(t, 0, 4*sizeof(long)); memset(t, 0, 4*sizeof(long));
#else #else
struct rusage ru, cru; struct rusage ru, cru;
......
...@@ -33,7 +33,7 @@ Bseek(Biobuf *bp, vlong offset, int base) ...@@ -33,7 +33,7 @@ Bseek(Biobuf *bp, vlong offset, int base)
vlong n, d; vlong n, d;
int bufsz; int bufsz;
#ifndef __MINGW32__ #ifndef _WIN32
if(sizeof(offset) != sizeof(off_t)) { if(sizeof(offset) != sizeof(off_t)) {
fprint(2, "Bseek: libbio compiled with %d-byte offset\n", sizeof(off_t)); fprint(2, "Bseek: libbio compiled with %d-byte offset\n", sizeof(off_t));
abort(); abort();
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
/* /*
* Apple still insists on underscore prefixes for C function names. * Apple still insists on underscore prefixes for C function names.
*/ */
#if defined(__APPLE__) || defined(__MINGW32__) #if defined(__APPLE__) || defined(_WIN32)
#define EXT(s) _##s #define EXT(s) _##s
#else #else
#define EXT(s) s #define EXT(s) s
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
/* /*
* Apple still insists on underscore prefixes for C function names. * Apple still insists on underscore prefixes for C function names.
*/ */
#if defined(__APPLE__) || defined(__MINGW64__) #if defined(__APPLE__) || defined(_WIN32)
#define EXT(s) _##s #define EXT(s) _##s
#else #else
#define EXT(s) s #define EXT(s) s
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment