Skip to content

Commit 097ae76

Browse files
committed
Update: Fixing some bugs from compiler inference after optimization
1 parent 9c44998 commit 097ae76

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

source/redub/building/utils.d

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,7 @@ import core.sys.posix.sys.ioctl;
66
string[] getHighPriorityCmd(string[] compileFlags)
77
{
88
version(Posix)
9-
{
10-
import std.array;
11-
string[] ret = new string[compileFlags.length + 3];
12-
ret[0..3] = ["nice", "-n", "0"].staticArray;
13-
ret[3..$] = compileFlags;
14-
return ret;
15-
}
9+
return ["nice", "-n", "0", "--"] ~ compileFlags;
1610
return compileFlags;
1711
}
1812

source/redub/misc/find_executable.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,5 @@ string findExecutable(string executableName)
5353
}
5454

5555
}
56-
return "";
56+
return null;
5757
}

source/redub/tooling/compilers_inference.d

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,18 +123,27 @@ private string getActualCompilerToUse(string preferredCompiler, ref string actua
123123
import std.typecons;
124124
import std.process;
125125
import redub.logging;
126-
import std.path: baseName, stripExtension;
126+
import std.path: baseName, stripExtension, isAbsolute;
127+
import redub.misc.find_executable;
127128
Tuple!(int, "status", string, "output") compVersionRes;
129+
compVersionRes.status = 1;
130+
compVersionRes.output = "No compiler found.";
128131

129132
bool preferredTested = false;
130133
foreach(string searchable; preferredCompiler~searchableCompilers)
131134
{
132-
if(preferredTested && searchable == preferredCompiler)
135+
if((preferredTested && searchable == preferredCompiler) || searchable.length == 0)
133136
continue;
134137
if(searchable != preferredCompiler)
135138
searchable = tryGetCompilerOnCwd(searchable);
136139
else
137140
preferredTested = true;
141+
if(!isAbsolute(searchable))
142+
{
143+
searchable = findExecutable(searchable);
144+
if(searchable.length == 0)
145+
continue;
146+
}
138147

139148
string[2] versionCommand = [searchable, "--version"];
140149
size_t args = searchable.baseName.stripExtension != "cl" ? 2 : 1;

0 commit comments

Comments
 (0)