use compiler conventions to tell if we are on mswindows

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39453 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2016-03-04 15:02:07 +00:00
parent 84613dbfde
commit 4f9d5c0982
6 changed files with 27 additions and 54 deletions

View file

@ -1,6 +1,13 @@
2016-03-04 Richard Frith-Macdonald <rfm@gnu.org> 2016-03-04 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSCalendar.m: Fix 64bit issue with undefined components. * Source/NSCalendar.m: Fix 64bit issue with undefined components.
* Source\NSBundle.m:
* Source\NSFileManager.m:
* SSL\GSSSLHandle.m:
* Headers\GNUstepBase\GSConfig.h.in:
* macosx\GNUstepBase\preface.h:
Standardise on using _WIN32 and _WIN64 defines, following the
informal convention used by all the compilers we might be compiled with.
2016-03-01 Richard Frith-Macdonald <rfm@gnu.org> 2016-03-01 Richard Frith-Macdonald <rfm@gnu.org>

View file

@ -30,31 +30,25 @@
#define included_GSConfig_h #define included_GSConfig_h
/* Check the compiler to see if we are building on/for ms-windows. /* Check the compiler to see if we are building on/for ms-windows.
* Whatever the compiler uses, we want a standard setting of __WIN32__ * Whatever the compiler uses, we want a standard setting of _WIN64
* for a windows build. * to indicate 64bit AND _WIN32 to indicate ms-windows.
* These are defined by gcc, clang, and microsoft compilers anyway.
*/ */
#if defined(__WIN32__) \ #if defined(__WIN32__) \
|| defined(_WIN32) \
|| defined(__MS_WIN32__) \ || defined(__MS_WIN32__) \
|| defined(__MINGW64__) || defined(__MINGW32__)
# if !defined(__WIN32__) # if !defined(_WIN32)
# define __WIN32__ # define _WIN32
# endif # endif
#endif #endif
/* Check the compiler to see if we are building on/for 64bit ms-windows.
* Whatever the compiler uses, we want a standard setting of __WIN64__
* to indicate 64bit AND __WIN32__ to indicate ms-windows.
*/
#if defined(__WIN64__) \ #if defined(__WIN64__) \
|| defined(_WIN64) \
|| defined(__MS_WIN64__) \ || defined(__MS_WIN64__) \
|| defined(__MINGW64__) || defined(__MINGW64__)
# if !defined(__WIN64__) # if !defined(__WIN64__)
# define __WIN64__ # define __WIN64__
# endif # endif
# if !defined(__WIN32__) # if !defined(_WIN32)
# define __WIN32__ # define _WIN32
# endif # endif
#endif #endif
@ -310,7 +304,7 @@ typedef struct {
# define __has_extension(x) __has_feature(x) # define __has_extension(x) __has_feature(x)
#endif #endif
#if defined(__WIN32__) #if defined(_WIN32)
#define BOOL WinBOOL #define BOOL WinBOOL
#include <w32api.h> #include <w32api.h>
#ifndef _WIN32_WINNT #ifndef _WIN32_WINNT
@ -336,7 +330,7 @@ typedef struct {
# include <objc/block_runtime.h> # include <objc/block_runtime.h>
#endif #endif
#ifndef __WIN32__ #ifndef _WIN32
#include <sys/param.h> /* Hack to get rid of warning in GNU libc 2.0.3. */ #include <sys/param.h> /* Hack to get rid of warning in GNU libc 2.0.3. */
#endif #endif

View file

@ -25,19 +25,13 @@
#include "config.h" #include "config.h"
#if defined(__WIN32__) || defined(_WIN32) || defined(__MS_WIN32__) #if defined(__WIN32__) || defined(__MINGW32__) || defined(__MS_WIN32__)
#ifndef __WIN32__ #ifndef _WIN32
#define __WIN32__ #define _WIN32
#endif #endif
#endif #endif
#ifdef __MINGW__ #if defined(_WIN32)
#ifndef __WIN32__
#define __WIN32__
#endif
#endif
#if defined(__WIN32__)
#include <windows.h> #include <windows.h>
#endif #endif

View file

@ -301,7 +301,7 @@ AbsolutePathOfExecutable(NSString *path, BOOL atLaunch)
result = [prefix stringByStandardizingPath]; result = [prefix stringByStandardizingPath];
break; break;
} }
#if defined(__WIN32__) #if defined(_WIN32)
else else
{ {
NSString *extension = [path pathExtension]; NSString *extension = [path pathExtension];
@ -1348,7 +1348,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
the executable name here - just in case it turns out it's a the executable name here - just in case it turns out it's a
tool. */ tool. */
NSString *toolName = [GSPrivateExecutablePath() lastPathComponent]; NSString *toolName = [GSPrivateExecutablePath() lastPathComponent];
#if defined(__WIN32__) || defined(__CYGWIN__) #if defined(_WIN32) || defined(__CYGWIN__)
toolName = [toolName stringByDeletingPathExtension]; toolName = [toolName stringByDeletingPathExtension];
#endif #endif

View file

@ -92,7 +92,7 @@
/* determine filesystem max path length */ /* determine filesystem max path length */
#if defined(_POSIX_VERSION) || defined(__WIN32__) #if defined(_POSIX_VERSION) || defined(_WIN32)
# if defined(__MINGW__) # if defined(__MINGW__)
# include <sys/utime.h> # include <sys/utime.h>
# else # else
@ -549,7 +549,7 @@ static NSStringEncoding defaultEncoding;
BOOL ok = NO; BOOL ok = NO;
struct _STATB sb; struct _STATB sb;
#if defined(__WIN32__) || defined(_POSIX_VERSION) #if defined(_WIN32) || defined(_POSIX_VERSION)
struct _UTIMB ub; struct _UTIMB ub;
#else #else
time_t ub[2]; time_t ub[2];
@ -559,7 +559,7 @@ static NSStringEncoding defaultEncoding;
{ {
ok = NO; ok = NO;
} }
#if defined(__WIN32__) #if defined(_WIN32)
else if (sb.st_mode & _S_IFDIR) else if (sb.st_mode & _S_IFDIR)
{ {
ok = YES; // Directories don't have modification times. ok = YES; // Directories don't have modification times.
@ -567,7 +567,7 @@ static NSStringEncoding defaultEncoding;
#endif #endif
else else
{ {
#if defined(__WIN32__) || defined(_POSIX_VERSION) #if defined(_WIN32) || defined(_POSIX_VERSION)
ub.actime = sb.st_atime; ub.actime = sb.st_atime;
ub.modtime = [date timeIntervalSince1970]; ub.modtime = [date timeIntervalSince1970];
ok = (_UTIME(lpath, &ub) == 0); ok = (_UTIME(lpath, &ub) == 0);

View file

@ -28,26 +28,6 @@
#include <stdarg.h> #include <stdarg.h>
#include <GNUstepBase/objc-gnu2next.h> #include <GNUstepBase/objc-gnu2next.h>
#if defined(__WIN32__) || defined(_WIN32) || defined(__MS_WIN32__)
#ifndef __WIN32__
#define __WIN32__
#endif
#endif
#ifdef __MINGW32__
#ifndef __MINGW__
#define __MINGW__
#endif
#ifndef __WIN32__
#define __WIN32__
#endif
#endif
#if defined(__WIN32__)
#include <windows.h>
#define GNUSTEP_BASE_SOCKET_MESSAGE (WM_USER + 1)
#endif
#if NeXT_RUNTIME #if NeXT_RUNTIME
#include <objc/objc.h> #include <objc/objc.h>
#include <objc/objc-class.h> #include <objc/objc-class.h>
@ -86,9 +66,7 @@
#define _C_ULNG_LNG 'Q' #define _C_ULNG_LNG 'Q'
#endif #endif
#ifndef __WIN32__
#include <sys/param.h> /* Hack to get rid of warning in GNU libc 2.0.3. */ #include <sys/param.h> /* Hack to get rid of warning in GNU libc 2.0.3. */
#endif
/* The following group of lines maintained by the gstep-base configure */ /* The following group of lines maintained by the gstep-base configure */
#define GNUSTEP_BASE_VERSION @VERSION@ #define GNUSTEP_BASE_VERSION @VERSION@