# HG changeset patch # User Christian Kamm # Date 1233245988 -3600 # Node ID 52dad07846bec9d0543c2b2717951e53fd2ab2a4 # Parent 6690a1468c17aacdf44e3dcb3f11e5e54afd040f Port some LDC1 portability fixes to LDC2. Fixes #196. diff -r 6690a1468c17 -r 52dad07846be dmd/mars.c --- a/dmd/mars.c Thu Jan 29 16:56:48 2009 +0100 +++ b/dmd/mars.c Thu Jan 29 17:19:48 2009 +0100 @@ -926,18 +926,18 @@ case OSMacOSX: VersionCondition::addPredefinedGlobalIdent("darwin"); - VersionCondition::addPredefinedGlobalIdent("Posix"); - break; + VersionCondition::addPredefinedGlobalIdent("Posix"); + break; case OSFreeBSD: - VersionCondition::addPredefinedGlobalIdent("freebsd"); - VersionCondition::addPredefinedGlobalIdent("Posix"); - break; + VersionCondition::addPredefinedGlobalIdent("freebsd"); + VersionCondition::addPredefinedGlobalIdent("Posix"); + break; case OSSolaris: - VersionCondition::addPredefinedGlobalIdent("solaris"); - VersionCondition::addPredefinedGlobalIdent("Posix"); - break; + VersionCondition::addPredefinedGlobalIdent("solaris"); + VersionCondition::addPredefinedGlobalIdent("Posix"); + break; default: assert(false && "Target OS not supported"); diff -r 6690a1468c17 -r 52dad07846be dmd2/mars.c --- a/dmd2/mars.c Thu Jan 29 16:56:48 2009 +0100 +++ b/dmd2/mars.c Thu Jan 29 17:19:48 2009 +0100 @@ -190,7 +190,7 @@ -m emit code specific to being one of:\n\ x86 x86-64 ppc32 ppc64 arm thumb\n\ -t emit code specific to being one of:\n\ - Linux, Windows, MacOSX, FreeBSD\n\ + Linux, Windows, MacOSX, FreeBSD, Solaris\n\ \n\ -g, -gc add symbolic debug info\n\ \n\ @@ -343,6 +343,9 @@ global.params.os = OSMacOSX; #elif __FreeBSD__ global.params.os = OSFreeBSD; +#elif defined (__SVR4) && defined (__sun) + global.params.os = OSSolaris; +#else #else #error Unsupported OS #endif /* linux */ @@ -711,6 +714,8 @@ global.params.os = OSMacOSX; else if(strcmp(p + 2, "FreeBSD") == 0) global.params.os = OSFreeBSD; + else if(strcmp(p + 2, "Solaris") == 0) + global.params.os = OSSolaris; else error("unrecognized target os '%s'", p + 2); } @@ -945,13 +950,18 @@ case OSMacOSX: VersionCondition::addPredefinedGlobalIdent("darwin"); - VersionCondition::addPredefinedGlobalIdent("Posix"); - break; + VersionCondition::addPredefinedGlobalIdent("Posix"); + break; case OSFreeBSD: - VersionCondition::addPredefinedGlobalIdent("freebsd"); - VersionCondition::addPredefinedGlobalIdent("Posix"); - break; + VersionCondition::addPredefinedGlobalIdent("freebsd"); + VersionCondition::addPredefinedGlobalIdent("Posix"); + break; + + case OSSolaris: + VersionCondition::addPredefinedGlobalIdent("solaris"); + VersionCondition::addPredefinedGlobalIdent("Posix"); + break; default: assert(false && "Target OS not supported"); diff -r 6690a1468c17 -r 52dad07846be dmd2/mars.h --- a/dmd2/mars.h Thu Jan 29 16:56:48 2009 +0100 +++ b/dmd2/mars.h Thu Jan 29 17:19:48 2009 +0100 @@ -61,7 +61,8 @@ OSLinux, OSWindows, OSMacOSX, - OSFreeBSD + OSFreeBSD, + OSSolaris, }; // Put command line switches in here