diff --git a/ChangeLog b/ChangeLog index 378f6c025..34ce5df40 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,13 @@ 2016-03-04 Richard Frith-Macdonald * 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 diff --git a/Headers/GNUstepBase/GSConfig.h.in b/Headers/GNUstepBase/GSConfig.h.in index d1aae13fe..b4f9d038b 100644 --- a/Headers/GNUstepBase/GSConfig.h.in +++ b/Headers/GNUstepBase/GSConfig.h.in @@ -30,31 +30,25 @@ #define included_GSConfig_h /* Check the compiler to see if we are building on/for ms-windows. - * Whatever the compiler uses, we want a standard setting of __WIN32__ - * for a windows build. + * Whatever the compiler uses, we want a standard setting of _WIN64 + * to indicate 64bit AND _WIN32 to indicate ms-windows. + * These are defined by gcc, clang, and microsoft compilers anyway. */ #if defined(__WIN32__) \ - || defined(_WIN32) \ || defined(__MS_WIN32__) \ - || defined(__MINGW64__) -# if !defined(__WIN32__) -# define __WIN32__ + || defined(__MINGW32__) +# if !defined(_WIN32) +# define _WIN32 # 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__) \ - || defined(_WIN64) \ || defined(__MS_WIN64__) \ || defined(__MINGW64__) # if !defined(__WIN64__) # define __WIN64__ # endif -# if !defined(__WIN32__) -# define __WIN32__ +# if !defined(_WIN32) +# define _WIN32 # endif #endif @@ -310,7 +304,7 @@ typedef struct { # define __has_extension(x) __has_feature(x) #endif -#if defined(__WIN32__) +#if defined(_WIN32) #define BOOL WinBOOL #include #ifndef _WIN32_WINNT @@ -336,7 +330,7 @@ typedef struct { # include #endif -#ifndef __WIN32__ +#ifndef _WIN32 #include /* Hack to get rid of warning in GNU libc 2.0.3. */ #endif diff --git a/SSL/GSSSLHandle.m b/SSL/GSSSLHandle.m index 7640b6e7e..fc9318585 100644 --- a/SSL/GSSSLHandle.m +++ b/SSL/GSSSLHandle.m @@ -25,19 +25,13 @@ #include "config.h" -#if defined(__WIN32__) || defined(_WIN32) || defined(__MS_WIN32__) -#ifndef __WIN32__ -#define __WIN32__ +#if defined(__WIN32__) || defined(__MINGW32__) || defined(__MS_WIN32__) +#ifndef _WIN32 +#define _WIN32 #endif #endif -#ifdef __MINGW__ -#ifndef __WIN32__ -#define __WIN32__ -#endif -#endif - -#if defined(__WIN32__) +#if defined(_WIN32) #include #endif diff --git a/Source/NSBundle.m b/Source/NSBundle.m index 03a13c931..228ff7519 100644 --- a/Source/NSBundle.m +++ b/Source/NSBundle.m @@ -301,7 +301,7 @@ AbsolutePathOfExecutable(NSString *path, BOOL atLaunch) result = [prefix stringByStandardizingPath]; break; } -#if defined(__WIN32__) +#if defined(_WIN32) else { 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 tool. */ NSString *toolName = [GSPrivateExecutablePath() lastPathComponent]; -#if defined(__WIN32__) || defined(__CYGWIN__) +#if defined(_WIN32) || defined(__CYGWIN__) toolName = [toolName stringByDeletingPathExtension]; #endif diff --git a/Source/NSFileManager.m b/Source/NSFileManager.m index cdf6462b0..b6a0fe913 100644 --- a/Source/NSFileManager.m +++ b/Source/NSFileManager.m @@ -92,7 +92,7 @@ /* determine filesystem max path length */ -#if defined(_POSIX_VERSION) || defined(__WIN32__) +#if defined(_POSIX_VERSION) || defined(_WIN32) # if defined(__MINGW__) # include # else @@ -549,7 +549,7 @@ static NSStringEncoding defaultEncoding; BOOL ok = NO; struct _STATB sb; -#if defined(__WIN32__) || defined(_POSIX_VERSION) +#if defined(_WIN32) || defined(_POSIX_VERSION) struct _UTIMB ub; #else time_t ub[2]; @@ -559,7 +559,7 @@ static NSStringEncoding defaultEncoding; { ok = NO; } -#if defined(__WIN32__) +#if defined(_WIN32) else if (sb.st_mode & _S_IFDIR) { ok = YES; // Directories don't have modification times. @@ -567,7 +567,7 @@ static NSStringEncoding defaultEncoding; #endif else { -#if defined(__WIN32__) || defined(_POSIX_VERSION) +#if defined(_WIN32) || defined(_POSIX_VERSION) ub.actime = sb.st_atime; ub.modtime = [date timeIntervalSince1970]; ok = (_UTIME(lpath, &ub) == 0); diff --git a/macosx/GNUstepBase/preface.h b/macosx/GNUstepBase/preface.h index 81381d451..0dc5fd112 100644 --- a/macosx/GNUstepBase/preface.h +++ b/macosx/GNUstepBase/preface.h @@ -28,26 +28,6 @@ #include #include -#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 -#define GNUSTEP_BASE_SOCKET_MESSAGE (WM_USER + 1) -#endif - #if NeXT_RUNTIME #include #include @@ -86,9 +66,7 @@ #define _C_ULNG_LNG 'Q' #endif -#ifndef __WIN32__ #include /* Hack to get rid of warning in GNU libc 2.0.3. */ -#endif /* The following group of lines maintained by the gstep-base configure */ #define GNUSTEP_BASE_VERSION @VERSION@