CMake: Fix warning about unsigned expression

warning: comparison of unsigned expression >= 0 is always true

Change-Id: I0a794bd7aa27a8a23094db4d95c676080b6a63b6
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Nikolai Kosjar
2019-06-21 08:49:01 +02:00
parent 428b24fcb5
commit b6a9f0245b

View File

@@ -267,7 +267,7 @@ CppTools::RawProjectParts generateRawProjectParts(const PreprocessedData &input,
FilePath directorySourceDir(const Configuration &c, const QDir &sourceDir, int directoryIndex)
{
const size_t di = static_cast<size_t>(directoryIndex);
QTC_ASSERT(di >= 0 && di < c.directories.size(), return FilePath());
QTC_ASSERT(di < c.directories.size(), return FilePath());
return FilePath::fromString(
QDir::cleanPath(sourceDir.absoluteFilePath(c.directories[di].sourcePath)));
@@ -276,7 +276,7 @@ FilePath directorySourceDir(const Configuration &c, const QDir &sourceDir, int d
FilePath directoryBuildDir(const Configuration &c, const QDir &buildDir, int directoryIndex)
{
const size_t di = static_cast<size_t>(directoryIndex);
QTC_ASSERT(di >= 0 && di < c.directories.size(), return FilePath());
QTC_ASSERT(di < c.directories.size(), return FilePath());
return FilePath::fromString(
QDir::cleanPath(buildDir.absoluteFilePath(c.directories[di].buildPath)));
@@ -304,12 +304,12 @@ void addBacktraceInformation(FolderNode *node,
FilePath targetPath = node->filePath().pathAppended("CMakeLists.txt");
while (backtraceIndex != -1) {
const size_t bi = static_cast<size_t>(backtraceIndex);
QTC_ASSERT((bi >= 0 && bi < backtraces.nodes.size()), break);
QTC_ASSERT(bi < backtraces.nodes.size(), break);
const BacktraceNode &btNode = backtraces.nodes[bi];
backtraceIndex = btNode.parent; // advance to next node
const size_t fileIndex = static_cast<size_t>(btNode.file);
QTC_ASSERT((fileIndex >= 0 && fileIndex < backtraces.files.size()), break);
QTC_ASSERT(fileIndex < backtraces.files.size(), break);
const FilePath path = FilePath::fromString(
sourceDir.absoluteFilePath(backtraces.files[fileIndex]));
@@ -319,7 +319,7 @@ void addBacktraceInformation(FolderNode *node,
}
const size_t commandIndex = static_cast<size_t>(btNode.command);
QTC_ASSERT((commandIndex >= 0 && commandIndex < backtraces.commands.size()), break);
QTC_ASSERT(commandIndex < backtraces.commands.size(), break);
const QString command = backtraces.commands[commandIndex];