From b6a9f0245b2aff4d9507a476203fba027ccd6cdb Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Fri, 21 Jun 2019 08:49:01 +0200 Subject: [PATCH] CMake: Fix warning about unsigned expression warning: comparison of unsigned expression >= 0 is always true Change-Id: I0a794bd7aa27a8a23094db4d95c676080b6a63b6 Reviewed-by: hjk Reviewed-by: Orgad Shaneh --- .../cmakeprojectmanager/fileapidataextractor.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp b/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp index 2b38abbee79..4335a3fb205 100644 --- a/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp +++ b/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp @@ -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(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(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(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(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(btNode.command); - QTC_ASSERT((commandIndex >= 0 && commandIndex < backtraces.commands.size()), break); + QTC_ASSERT(commandIndex < backtraces.commands.size(), break); const QString command = backtraces.commands[commandIndex];