Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[refactor] Replace host version names inherited from C++ with HOST_* #5549

Merged
merged 1 commit into from
Mar 20, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/dinifile.d
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const(char)* findConfFile(const(char)* argv0, const(char)* inifile)
filename = FileName.replaceName(argv0, inifile);
if (FileName.exists(filename))
return filename;
static if (__linux__ || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun)
version (Posix)
{
// Search PATH for argv0
auto p = getenv("PATH");
Expand Down
2 changes: 1 addition & 1 deletion src/errors.d
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ extern (C++) bool isConsoleColorSupported()
{
return isatty(fileno(stderr)) != 0;
}
else static if (__linux__ || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun)
else version (Posix)
{
const(char)* term = getenv("TERM");
return isatty(STDERR_FILENO) && term && term[0] && 0 != strcmp(term, "dumb");
Expand Down
6 changes: 0 additions & 6 deletions src/globals.d
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ private string stripRight(string s)
return s;
}

enum __linux__ = xversion!`linux`;
enum __APPLE__ = xversion!`OSX`;
enum __FreeBSD__ = xversion!`FreeBSD`;
enum __OpenBSD__ = xversion!`OpenBSD`;
enum __sun = xversion!`Solaris`;

enum IN_GCC = xversion!`IN_GCC`;

enum TARGET_LINUX = xversion!`linux`;
Expand Down
17 changes: 4 additions & 13 deletions src/link.d
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,6 @@ version (Windows) extern (C) int spawnl(int, const char*, const char*, const cha
version (Windows) extern (C) int spawnv(int, const char*, const char**);
version (CRuntime_Microsoft) extern (Windows) uint GetShortPathNameA(const char* lpszLongPath, char* lpszShortPath, uint cchBuffer);

static if (__linux__ || __APPLE__)
{
enum HAS_POSIX_SPAWN = 1;
}
else
{
enum HAS_POSIX_SPAWN = 0;
}

/****************************************
* Write filename to cmdbuf, quoting if necessary.
*/
Expand Down Expand Up @@ -69,7 +60,7 @@ extern (C++) void writeFilename(OutBuffer* buf, const(char)* filename)
writeFilename(buf, filename, strlen(filename));
}

static if (__linux__ || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun)
version (Posix)
{
/*****************************
* As it forwards the linker error message to stderr, checks for the presence
Expand Down Expand Up @@ -439,7 +430,7 @@ extern (C++) int runLINK()
return status;
}
}
else static if (__linux__ || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun)
else version (Posix)
{
pid_t childpid;
int status;
Expand All @@ -457,7 +448,7 @@ extern (C++) int runLINK()
if (global.params.dll)
argv.push("-dynamiclib");
}
else static if (__linux__ || __FreeBSD__ || __OpenBSD__ || __sun)
else version (Posix)
{
if (global.params.dll)
argv.push("-shared");
Expand Down Expand Up @@ -889,7 +880,7 @@ extern (C++) int runProgram()
// spawnlp returns intptr_t in some systems, not int
return spawnv(0, ex, argv.tdata());
}
else static if (__linux__ || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun)
else version (Posix)
{
pid_t childpid;
int status;
Expand Down
2 changes: 1 addition & 1 deletion src/mars.d
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ private int tryMain(size_t argc, const(char)** argv)
{
global.inifilename = findConfFile(global.params.argv0, "sc.ini");
}
else static if (__linux__ || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun)
else version (Posix)
{
global.inifilename = findConfFile(global.params.argv0, "dmd.conf");
}
Expand Down