forked from qt-creator/qt-creator
fix: [gcctoolchain] Fix GCC compiler version detection issue
Fixed incorrect position check for compiler version detection in `findCompilerCandidates` function. Changed from `pos + 2` to `pos + 1` to properly detect compiler names with single digit versions like gcc-8 and clang-7. Change-Id: I6eb16c6c88a8944ee67af42ea4c9fb244cbdb7e8 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -1406,6 +1406,7 @@ static FilePaths findCompilerCandidates(OsType os,
|
|||||||
if (os == OsTypeWindows && fileName.endsWith(u".exe", Qt::CaseInsensitive))
|
if (os == OsTypeWindows && fileName.endsWith(u".exe", Qt::CaseInsensitive))
|
||||||
fileName.chop(4);
|
fileName.chop(4);
|
||||||
|
|
||||||
|
// Do not `continue`, proceed to detect further variants
|
||||||
if (fileName == compilerName)
|
if (fileName == compilerName)
|
||||||
compilerPaths << executable;
|
compilerPaths << executable;
|
||||||
|
|
||||||
@@ -1426,7 +1427,7 @@ static FilePaths findCompilerCandidates(OsType os,
|
|||||||
// if not at the end, it must by followed by a hyphen and a digit between 1 and 9
|
// if not at the end, it must by followed by a hyphen and a digit between 1 and 9
|
||||||
pos += cl;
|
pos += cl;
|
||||||
if (pos != fileName.size()) {
|
if (pos != fileName.size()) {
|
||||||
if (pos + 2 >= fileName.size())
|
if (pos + 1 >= fileName.size())
|
||||||
continue;
|
continue;
|
||||||
if (fileName.at(pos) != '-')
|
if (fileName.at(pos) != '-')
|
||||||
continue;
|
continue;
|
||||||
|
Reference in New Issue
Block a user