Use __linux__ to identify Linux-based systems.

This is a backport from DMD 2.065. It is needed to compile LDC2 with -std=c++11.
This commit is contained in:
Kai Nacke
2014-01-03 15:51:38 +01:00
parent 58305e8bfc
commit 2eae9b6f79
6 changed files with 11 additions and 11 deletions

View File

@@ -16,7 +16,7 @@
#include <string>
#include <cstdarg>
#if linux || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun
#if __linux__ || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun
#include <errno.h>
#endif
@@ -517,7 +517,7 @@ int tryMain(size_t argc, char *argv[])
#if _WIN32
inifilename = inifile(argv[0], "sc.ini", "Environment");
#elif linux || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun
#elif __linux__ || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun
inifilename = inifile(argv[0], "dmd.conf", "Environment");
#else
#error "fix this"
@@ -917,7 +917,7 @@ Language changes listed by -transition=id:\n\
browse("http://dlang.org/dmd-windows.html");
#endif
#endif
#if linux
#if __linux__
#if DMDV1
browse("http://www.digitalmars.com/d/1.0/dmd-linux.html");
#else

View File

@@ -119,7 +119,7 @@ unsigned __stdcall startthread(void *p)
return EXIT_SUCCESS; // if skidding
}
#elif linux // Posix
#elif __linux__ // Posix
#include <errno.h>
#include <pthread.h>

View File

@@ -26,7 +26,7 @@ void browse(const char *url)
#endif
#if linux || __FreeBSD__ || __OpenBSD__ || __sun
#if __linux__ || __FreeBSD__ || __OpenBSD__ || __sun
#include <sys/types.h>
#include <sys/wait.h>

View File

@@ -542,10 +542,10 @@ longdouble Port::strtold(const char *p, char **endp)
#endif
#if linux || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __HAIKU__
#if __linux__ || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __HAIKU__
#include <math.h>
#if linux
#if __linux__
#include <bits/nan.h>
#include <bits/mathdef.h>
#endif

View File

@@ -11,7 +11,7 @@
#include <stdlib.h>
#include <string.h>
#if linux || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun
#if __linux__ || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun
#include "../root/rmem.h"
#else
#include "rmem.h"

View File

@@ -8,7 +8,7 @@
// See the included readme.txt for details.
#ifndef POSIX
#define POSIX (linux || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun)
#define POSIX (__linux__ || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun)
#endif
#include <stdio.h>
@@ -878,11 +878,11 @@ void FileName::ensurePathToNameExists(const char *name)
*/
const char *FileName::canonicalName(const char *name)
{
#if linux
#if __linux__
// Lovely glibc extension to do it for us
return canonicalize_file_name(name);
#elif POSIX
#if _POSIX_VERSION >= 200809L || defined (linux)
#if _POSIX_VERSION >= 200809L || defined (__linux__)
// NULL destination buffer is allowed and preferred
return realpath(name, NULL);
#else