diff options
Diffstat (limited to 'qmake/generators')
-rw-r--r-- | qmake/generators/mac/pbuilder_pbx.cpp | 48 | ||||
-rw-r--r-- | qmake/generators/makefile.cpp | 114 | ||||
-rw-r--r-- | qmake/generators/makefile.h | 3 | ||||
-rw-r--r-- | qmake/generators/makefiledeps.cpp | 4 | ||||
-rw-r--r-- | qmake/generators/metamakefile.cpp | 22 | ||||
-rw-r--r-- | qmake/generators/projectgenerator.cpp | 32 | ||||
-rw-r--r-- | qmake/generators/unix/unixmake.cpp | 19 | ||||
-rw-r--r-- | qmake/generators/unix/unixmake2.cpp | 53 | ||||
-rw-r--r-- | qmake/generators/win32/mingw_make.cpp | 6 | ||||
-rw-r--r-- | qmake/generators/win32/msbuild_objectmodel.cpp | 36 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_nmake.cpp | 10 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_objectmodel.cpp | 53 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_objectmodel.h | 1 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_vcproj.cpp | 26 | ||||
-rw-r--r-- | qmake/generators/win32/winmakefile.cpp | 16 | ||||
-rw-r--r-- | qmake/generators/xmloutput.cpp | 12 |
16 files changed, 235 insertions, 220 deletions
diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index efc7528c56..9e36cad887 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -87,7 +87,7 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t) for(int pb_subdir = 0; pb_subdir < pb_subdirs.size(); ++pb_subdir) { ProjectBuilderSubDirs *pb = pb_subdirs[pb_subdir]; const ProStringList &subdirs = pb->project->values("SUBDIRS"); - for(int subdir = 0; subdir < subdirs.count(); subdir++) { + for(int subdir = 0; subdir < subdirs.size(); subdir++) { ProString tmpk = subdirs[subdir]; const ProKey fkey(tmpk + ".file"); if (!pb->project->isEmpty(fkey)) { @@ -329,7 +329,7 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t) t << "\t\t\tprojectReferences = (\n"; { const ProStringList &qmake_subdirs = project->values("QMAKE_PBX_SUBDIRS"); - for(int i = 0; i < qmake_subdirs.count(); i++) { + for(int i = 0; i < qmake_subdirs.size(); i++) { const ProString &subdir = qmake_subdirs[i]; t << "\t\t\t\t{\n" << "\t\t\t\t\t" << writeSettings("ProductGroup", keyFor(subdir + "_PRODUCTGROUP")) << ";\n" @@ -429,17 +429,17 @@ ProjectBuilderSources::files(QMakeProject *project) const static QString xcodeFiletypeForFilename(const QString &filename) { - for (const QString &ext : qAsConst(Option::cpp_ext)) { + for (const QString &ext : std::as_const(Option::cpp_ext)) { if (filename.endsWith(ext)) return QStringLiteral("sourcecode.cpp.cpp"); } - for (const QString &ext : qAsConst(Option::c_ext)) { + for (const QString &ext : std::as_const(Option::c_ext)) { if (filename.endsWith(ext)) return QStringLiteral("sourcecode.c.c"); } - for (const QString &ext : qAsConst(Option::h_ext)) { + for (const QString &ext : std::as_const(Option::h_ext)) { if (filename.endsWith(ext)) return "sourcecode.c.h"; } @@ -524,14 +524,14 @@ bool ProjectBuilderMakefileGenerator::replaceLibrarySuffix(const QString &lib_fi warn_msg(WarnLogic, "Failed to find expected suffix '%s' for library '%s'.", qPrintable(librarySuffix), qPrintable(library)); } else { - library.replace(pos, librarySuffix.length(), suffixSetting); + library.replace(pos, librarySuffix.size(), suffixSetting); if (name.endsWith(librarySuffix)) - name.chop(librarySuffix.length()); + name.chop(librarySuffix.size()); } } else { int pos = library.lastIndexOf(name); if (pos != -1) - library.insert(pos + name.length(), suffixSetting); + library.insert(pos + name.size(), suffixSetting); } } } @@ -658,7 +658,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) const QStringList &files = fileFixify(sources.at(source).files(project), FileFixifyFromOutdir | FileFixifyAbsolute); - for(int f = 0; f < files.count(); ++f) { + for(int f = 0; f < files.size(); ++f) { QString file = files[f]; if(!sources.at(source).compilerName().isNull() && !verifyExtraCompiler(sources.at(source).compilerName(), file)) @@ -873,7 +873,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", nullptr }; for (int i = 0; libs[i]; i++) { tmp = project->values(libs[i]); - for(int x = 0; x < tmp.count();) { + for(int x = 0; x < tmp.size();) { bool libSuffixReplaced = false; bool remove = false; QString library, name; @@ -912,7 +912,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) if(opt.size() > 2) { r = opt.mid(2).toQString(); } else { - if(x == tmp.count()-1) + if(x == tmp.size()-1) break; r = tmp[++x].toQString(); } @@ -921,12 +921,12 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) frameworkdirs.append(r); } } else if(opt == "-framework") { - if(x == tmp.count()-1) + if(x == tmp.size()-1) break; const ProString &framework = tmp[x+1]; ProStringList fdirs = frameworkdirs; fdirs << "/System/Library/Frameworks/" << "/Library/Frameworks/"; - for(int fdir = 0; fdir < fdirs.count(); fdir++) { + for(int fdir = 0; fdir < fdirs.size(); fdir++) { if(exists(fdirs[fdir] + QDir::separator() + framework + ".framework")) { remove = true; library = fdirs[fdir] + Option::dir_sep + framework + ".framework"; @@ -955,7 +955,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) const int slsh = library.lastIndexOf(Option::dir_sep); if(name.isEmpty()) { if(slsh != -1) - name = library.right(library.length() - slsh - 1); + name = library.right(library.size() - slsh - 1); } if(slsh != -1) { const QString path = QFileInfo(library.left(slsh)).absoluteFilePath(); @@ -1008,12 +1008,12 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) mkt << "SUBLIBS= "; // ### This is missing the parametrization found in unixmake2.cpp tmp = project->values("SUBLIBS"); - for(int i = 0; i < tmp.count(); i++) + for(int i = 0; i < tmp.size(); i++) t << escapeFilePath("tmp/lib" + tmp[i] + ".a") << ' '; t << Qt::endl << Qt::endl; mkt << "sublibs: $(SUBLIBS)\n\n"; tmp = project->values("SUBLIBS"); - for(int i = 0; i < tmp.count(); i++) + for(int i = 0; i < tmp.size(); i++) t << escapeFilePath("tmp/lib" + tmp[i] + ".a") + ":\n\t" << var(ProKey("MAKELIB" + tmp[i])) << Qt::endl << Qt::endl; mkt.flush(); @@ -1148,7 +1148,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) //all bundle data const ProStringList &bundle_data = project->values("QMAKE_BUNDLE_DATA"); - for(int i = 0; i < bundle_data.count(); i++) { + for(int i = 0; i < bundle_data.size(); i++) { ProStringList bundle_files; ProString path = project->first(ProKey(bundle_data[i] + ".path")); const bool isEmbeddedFramework = ((!osx && path == QLatin1String("Frameworks")) @@ -1158,7 +1158,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) //all files const ProStringList &files = project->values(ProKey(bundle_data[i] + ".files")); - for(int file = 0; file < files.count(); file++) { + for(int file = 0; file < files.size(); file++) { QString fn = fileFixify(files[file].toQString(), FileFixifyAbsolute); QString name = fn.split(Option::dir_sep).back(); QString file_ref_key = keyFor("QMAKE_PBX_BUNDLE_DATA_FILE_REF." + bundle_data[i] + "-" + fn); @@ -1181,13 +1181,13 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) if (copyBundleResources && ((!osx && path.isEmpty()) || (osx && path == QLatin1String("Contents/Resources")))) { - for (const ProString &s : qAsConst(bundle_files)) + for (const ProString &s : std::as_const(bundle_files)) bundle_resources_files << s; } else if (copyBundleResources && isEmbeddedFramework) { - for (const ProString &s : qAsConst(bundle_files)) + for (const ProString &s : std::as_const(bundle_files)) embedded_frameworks << s; } else if (copyBundleResources && isEmbeddedPlugin) { - for (const ProString &s : qAsConst(bundle_files)) { + for (const ProString &s : std::as_const(bundle_files)) { ProString subpath = (path == pluginsPrefix) ? ProString() : path.mid(pluginsPrefix.size() + 1); embedded_plugins[subpath] << s; } @@ -1684,7 +1684,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) t << "\t\t\t\t" << writeSettings("CODE_SIGN_IDENTITY", project->first("QMAKE_XCODE_CODE_SIGN_IDENTITY")) << ";\n"; tmp = project->values("QMAKE_PBX_VARS"); - for (int i = 0; i < tmp.count(); i++) { + for (int i = 0; i < tmp.size(); i++) { QString var = tmp[i].toQString(), val = QString::fromLocal8Bit(qgetenv(var.toLatin1().constData())); if (val.isEmpty() && var == "TB") val = "/usr/bin/"; @@ -1888,7 +1888,7 @@ ProStringList ProjectBuilderMakefileGenerator::fixListForOutput(const ProStringList &l) { ProStringList ret; - for(int i = 0; i < l.count(); i++) + for(int i = 0; i < l.size(); i++) ret += fixForOutput(l[i].toQString()); return ret; } @@ -1970,7 +1970,7 @@ ProjectBuilderMakefileGenerator::pbxbuild() static QString quotedStringLiteral(const QString &value) { QString result; - const int len = value.length(); + const int len = value.size(); result.reserve(int(len * 1.1) + 2); result += QLatin1Char('"'); diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 4c21ef8202..11d2f0ff7d 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -16,6 +16,7 @@ #include <qdebug.h> #include <qbuffer.h> #include <qdatetime.h> +#include <qtversion.h> #if defined(Q_OS_UNIX) #include <unistd.h> @@ -38,7 +39,7 @@ using namespace QMakeInternal; bool MakefileGenerator::canExecute(const QStringList &cmdline, int *a) const { int argv0 = -1; - for(int i = 0; i < cmdline.count(); ++i) { + for(int i = 0; i < cmdline.size(); ++i) { if(!cmdline.at(i).contains('=')) { argv0 = i; break; @@ -112,7 +113,7 @@ MakefileGenerator::initOutPaths() if(!fi.makeAbsolute()) { QString cache_r = fi.path(), pwd = Option::output_dir; if(pwd.startsWith(cache_r) && !pwd.startsWith(root)) { - pwd = root + pwd.mid(cache_r.length()); + pwd = root + pwd.mid(cache_r.size()); if(exists(pwd)) v.insert("QMAKE_ABSOLUTE_SOURCE_PATH", ProStringList(pwd)); } @@ -237,7 +238,7 @@ MakefileGenerator::findFilesInVPATH(ProStringList l, uchar flags, const QString { ProStringList vpath; const ProValueMap &v = project->variables(); - for(int val_it = 0; val_it < l.count(); ) { + for(int val_it = 0; val_it < l.size(); ) { bool remove_file = false; ProString &val = l[val_it]; if(!val.isEmpty()) { @@ -287,7 +288,7 @@ MakefileGenerator::findFilesInVPATH(ProStringList l, uchar flags, const QString real_dir = dir; if(!(flags & VPATH_NoFixify)) real_dir = fileFixify(real_dir, FileFixifyBackwards) + '/'; - regex.remove(0, dir.length()); + regex.remove(0, dir.size()); } if(real_dir.isEmpty() || exists(real_dir)) { QStringList files = QDir(real_dir).entryList(QStringList(regex), @@ -296,14 +297,14 @@ MakefileGenerator::findFilesInVPATH(ProStringList l, uchar flags, const QString debug_msg(1, "%s:%d Failure to find %s in vpath (%s)", __FILE__, __LINE__, val.toLatin1().constData(), vpath.join(QString("::")).toLatin1().constData()); - if(flags & VPATH_RemoveMissingFiles) + if (flags & VPATH_RemoveMissingFiles) remove_file = true; - else if(flags & VPATH_WarnMissingFiles) + if (flags & VPATH_WarnMissingFiles) warn_msg(WarnLogic, "Failure to find: %s", val.toLatin1().constData()); } else { l.removeAt(val_it); QString a; - for(int i = (int)files.count()-1; i >= 0; i--) { + for(int i = (int)files.size()-1; i >= 0; i--) { a = real_dir + files[i]; if(!(flags & VPATH_NoFixify)) a = fileFixify(a); @@ -314,9 +315,9 @@ MakefileGenerator::findFilesInVPATH(ProStringList l, uchar flags, const QString debug_msg(1, "%s:%d Cannot match %s%s, as %s does not exist.", __FILE__, __LINE__, real_dir.toLatin1().constData(), regex.toLatin1().constData(), real_dir.toLatin1().constData()); - if(flags & VPATH_RemoveMissingFiles) + if (flags & VPATH_RemoveMissingFiles) remove_file = true; - else if(flags & VPATH_WarnMissingFiles) + if (flags & VPATH_WarnMissingFiles) warn_msg(WarnLogic, "Failure to find: %s", val.toLatin1().constData()); } } @@ -337,9 +338,14 @@ MakefileGenerator::initCompiler(const MakefileGenerator::Compiler &comp) // find all the relevant file inputs if(!init_compiler_already.contains(comp.variable_in)) { init_compiler_already.insert(comp.variable_in, true); - if(!noIO()) - l = findFilesInVPATH(l, (comp.flags & Compiler::CompilerRemoveNoExist) ? - VPATH_RemoveMissingFiles : VPATH_WarnMissingFiles, "VPATH_" + comp.variable_in); + if(!noIO()) { + uchar flags = 0; + if (comp.flags & Compiler::CompilerRemoveNoExist) + flags |= VPATH_RemoveMissingFiles; + if (comp.flags & Compiler::CompilerWarnNoExist) + flags |= VPATH_WarnMissingFiles; + l = findFilesInVPATH(l, flags, "VPATH_" + comp.variable_in); + } } } @@ -467,12 +473,12 @@ MakefileGenerator::init() continue; } const ProStringList &tinn = v[innkey], &toutn = v[outnkey]; - if (tinn.length() != 1) { + if (tinn.size() != 1) { warn_msg(WarnLogic, "Substitute '%s.input' does not have exactly one value", sub.toLatin1().constData()); continue; } - if (toutn.length() != 1) { + if (toutn.size() != 1) { warn_msg(WarnLogic, "Substitute '%s.output' does not have exactly one value", sub.toLatin1().constData()); continue; @@ -490,7 +496,7 @@ MakefileGenerator::init() inn.toLatin1().constData()); continue; } - outn = fileFixify(inn.left(inn.length() - 3), FileFixifyBackwards); + outn = fileFixify(inn.left(inn.size() - 3), FileFixifyBackwards); } const ProKey confign(sub + ".CONFIG"); @@ -511,7 +517,7 @@ MakefileGenerator::init() QString line = QString::fromLatin1(in.readLine()); if (line.startsWith("!!IF ")) { if (state.isEmpty() || state.top() == IN_CONDITION) { - QString test = line.mid(5, line.length()-(5+1)); + QString test = line.mid(5, line.size()-(5+1)); if (project->test(test, inn, count)) state.push(IN_CONDITION); else @@ -524,7 +530,7 @@ MakefileGenerator::init() warn_msg(WarnLogic, "(%s:%d): Unexpected else condition", in.fileName().toLatin1().constData(), count); } else if (state.top() == PENDING_CONDITION) { - QString test = line.mid(7, line.length()-(7+1)); + QString test = line.mid(7, line.size()-(7+1)); if (project->test(test, inn, count)) { state.pop(); state.push(IN_CONDITION); @@ -612,6 +618,10 @@ MakefileGenerator::init() const ProStringList &config = v[ProKey(*it + ".CONFIG")]; if (config.indexOf("ignore_no_exist") != -1) compiler.flags |= Compiler::CompilerRemoveNoExist; + else + compiler.flags |= Compiler::CompilerWarnNoExist; + if (config.indexOf("remove_no_exist") != -1) + compiler.flags |= Compiler::CompilerRemoveNoExist; if (config.indexOf("no_dependencies") != -1) compiler.flags |= Compiler::CompilerNoCheckDeps; if (config.indexOf("add_inputs_as_makefile_deps") != -1) @@ -633,12 +643,12 @@ MakefileGenerator::init() } { //do the path fixifying ProStringList paths; - for(x = 0; x < compilers.count(); ++x) { + for(x = 0; x < compilers.size(); ++x) { if(!paths.contains(compilers.at(x).variable_in)) paths << compilers.at(x).variable_in; } paths << "INCLUDEPATH" << "QMAKE_INTERNAL_INCLUDED_FILES" << "PRECOMPILED_HEADER"; - for(int y = 0; y < paths.count(); y++) { + for(int y = 0; y < paths.size(); y++) { ProStringList &l = v[paths[y].toKey()]; for (ProStringList::Iterator it = l.begin(); it != l.end(); ++it) { if((*it).isEmpty()) @@ -652,7 +662,7 @@ MakefileGenerator::init() if(noIO() || !doDepends() || project->isActiveConfig("GNUmake")) QMakeSourceFileInfo::setDependencyMode(QMakeSourceFileInfo::NonRecursive); - for(x = 0; x < compilers.count(); ++x) + for(x = 0; x < compilers.size(); ++x) initCompiler(compilers.at(x)); //merge actual compiler outputs into their variable_out. This is done last so that @@ -763,7 +773,7 @@ MakefileGenerator::init() incDirs.join(QString(" :: ")).toLatin1().constData()); //add to dependency engine - for(x = 0; x < compilers.count(); ++x) { + for(x = 0; x < compilers.size(); ++x) { const MakefileGenerator::Compiler &comp = compilers.at(x); if(!(comp.flags & Compiler::CompilerNoCheckDeps)) { const ProKey ikey(comp.variable_in); @@ -819,14 +829,14 @@ MakefileGenerator::init() QString dir, regex = Option::normalizePath(dep); if (regex.lastIndexOf('/') != -1) { dir = regex.left(regex.lastIndexOf('/') + 1); - regex.remove(0, dir.length()); + regex.remove(0, dir.size()); } QStringList files = QDir(dir).entryList(QStringList(regex)); if(files.isEmpty()) { warn_msg(WarnLogic, "Dependency for [%s]: Not found %s", (*file_it).toLatin1().constData(), dep.toLatin1().constData()); } else { - for(int i = 0; i < files.count(); i++) + for(int i = 0; i < files.size(); i++) out_deps.append(dir + files[i]); } } @@ -1030,7 +1040,7 @@ MakefileGenerator::writeProjectMakefile() //install t << "install: "; - for (SubTarget *s : qAsConst(targets)) + for (SubTarget *s : std::as_const(targets)) t << s->target << '-'; t << "install " << Qt::endl; @@ -1172,7 +1182,7 @@ QString MakefileGenerator::filePrefixRoot(const QString &root, const QString &path) { QString ret(path); - if(path.length() > 2 && path[1] == ':') //c:\foo + if(path.size() > 2 && path[1] == ':') //c:\foo ret.insert(2, root); else ret.prepend(root); @@ -1248,14 +1258,14 @@ MakefileGenerator::writeInstalls(QTextStream &t, bool noBuild) qPrintable(wild), qPrintable((*it).toQString()), qPrintable(base_path)); } else { - QString dir_sfx = dirstr.mid(base_path.length()); + QString dir_sfx = dirstr.mid(base_path.size()); dst_dir += dir_sfx; if (!dir_sfx.isEmpty() && !made_dirs.contains(dir_sfx)) { made_dirs.insert(dir_sfx); QString tmp_dst = fileFixify(dst_dir, FileFixifyAbsolute, false); tmp_dst.chop(1); inst << mkdir_p_asstring(filePrefixRoot(root, tmp_dst)); - for (int i = dst.length(); i < dst_dir.length(); i++) { + for (int i = dst.size(); i < dst_dir.size(); i++) { if (dst_dir.at(i) == Option::dir_sep) { QString subd = dst_dir.left(i); if (!removed_dirs.contains(subd)) { @@ -1315,7 +1325,7 @@ MakefileGenerator::writeInstalls(QTextStream &t, bool noBuild) inst << cmd; uninst.append(rm_dir_contents + " " + escapeFilePath(filePrefixRoot(root, fileFixify(dst_dir + filestr, FileFixifyAbsolute, false)))); } - for(int x = 0; x < files.count(); x++) { + for(int x = 0; x < files.size(); x++) { QString file = files[x]; uninst.append(rm_dir_contents + " " + escapeFilePath(filePrefixRoot(root, fileFixify(dst_dir + file, FileFixifyAbsolute, false)))); QFileInfo fi(fileInfo(dirstr + file)); @@ -1615,7 +1625,7 @@ MakefileGenerator::replaceExtraCompilerVariables( QFileInfo fi(fileInfo(Option::normalizePath(in.at(i)))); QString ext; // Ensure complementarity with QMAKE_FILE_BASE - int baseLen = fi.completeBaseName().length(); + int baseLen = fi.completeBaseName().size(); if(baseLen == 0) ext = fi.fileName(); else @@ -1681,7 +1691,7 @@ MakefileGenerator::replaceExtraCompilerVariables( fullVal = val.join(' '); } ret.replace(match.capturedStart(), match.capturedLength(), fullVal); - rep += fullVal.length(); + rep += fullVal.size(); } else { rep = match.capturedEnd(); } @@ -1882,7 +1892,7 @@ void MakefileGenerator::callExtraCompilerDependCommand(const ProString &extraCom return; QDir outDir(Option::output_dir); QStringList dep_cmd_deps = splitDeps(indeps, dep_lines); - for (int i = 0; i < dep_cmd_deps.count(); ++i) { + for (int i = 0; i < dep_cmd_deps.size(); ++i) { QString &file = dep_cmd_deps[i]; const QString absFile = outDir.absoluteFilePath(file); if (absFile == file) { @@ -1960,7 +1970,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) if (raw_clean.isEmpty()) raw_clean << tmp_out; QString tmp_clean; - for (const QString &rc : qAsConst(raw_clean)) + for (const QString &rc : std::as_const(raw_clean)) tmp_clean += ' ' + escapeFilePath(Option::fixPathToTargetOS(rc)); QString tmp_clean_cmds = project->values(ProKey(*it + ".clean_commands")).join(' '); if(!tmp_inputs.isEmpty()) @@ -1985,7 +1995,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) for (ProStringList::ConstIterator input = tmp_inputs.cbegin(); input != tmp_inputs.cend(); ++input) { QString tinp = (*input).toQString(); QString out = replaceExtraCompilerVariables(tmp_out, tinp, QString(), NoShell); - for (const QString &rc : qAsConst(raw_clean)) { + for (const QString &rc : std::as_const(raw_clean)) { dels << ' ' + escapeFilePath(fileFixify( replaceExtraCompilerVariables(rc, tinp, out, NoShell), FileFixifyFromOutdir)); @@ -1996,9 +2006,9 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) } else { QString files; const int commandlineLimit = 2047; // NT limit, expanded - for (const QString &file : qAsConst(dels)) { - if(del_statement.length() + files.length() + - qMax(fixEnvVariables(file).length(), file.length()) > commandlineLimit) { + for (const QString &file : std::as_const(dels)) { + if(del_statement.size() + files.size() + + qMax(fixEnvVariables(file).size(), file.size()) > commandlineLimit) { cleans.append(files); files.clear(); } @@ -2262,11 +2272,11 @@ QString MakefileGenerator::buildArgs(bool withExtra) { QString ret; - for (const QString &arg : qAsConst(Option::globals->qmake_args)) + for (const QString &arg : std::as_const(Option::globals->qmake_args)) ret += " " + shellQuote(arg); if (withExtra && !Option::globals->qmake_extra_args.isEmpty()) { ret += " --"; - for (const QString &arg : qAsConst(Option::globals->qmake_extra_args)) + for (const QString &arg : std::as_const(Option::globals->qmake_extra_args)) ret += " " + shellQuote(arg); } return ret; @@ -2297,7 +2307,7 @@ MakefileGenerator::writeHeader(QTextStream &t) { t << "#############################################################################\n"; t << "# Makefile for building: " << escapeFilePath(var("TARGET")) << Qt::endl; - t << "# Generated by qmake (" QMAKE_VERSION_STR ") (Qt " << qVersion() << ")\n"; + t << "# Generated by qmake (" QMAKE_VERSION_STR ") (Qt " QT_VERSION_STR ")\n"; t << "# Project: " << fileFixify(project->projectFile()) << Qt::endl; t << "# Template: " << var("TEMPLATE") << Qt::endl; if(!project->isActiveConfig("build_pass")) @@ -2381,7 +2391,7 @@ MakefileGenerator::findSubDirsSubTargets() const if(new_slsh != -1) basename = basename.mid(new_slsh+1); if(st->profile != basename + Option::pro_ext) - st->makefile += "." + st->profile.left(st->profile.length() - Option::pro_ext.length()); + st->makefile += "." + st->profile.left(st->profile.size() - Option::pro_ext.size()); } } const ProKey dkey(fixedSubdir + ".depends"); @@ -2520,7 +2530,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT if(!out_directory.isEmpty() && !out_directory.endsWith(Option::dir_sep)) out_directory += Option::dir_sep; if(!abs_source_path.isEmpty() && out_directory.startsWith(abs_source_path)) - out_directory = Option::output_dir + out_directory.mid(abs_source_path.length()); + out_directory = Option::output_dir + out_directory.mid(abs_source_path.size()); QString out_directory_cdin = out_directory.isEmpty() ? QString("\n\t") : "\n\tcd " + escapeFilePath(out_directory) + " && "; @@ -2533,7 +2543,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT out = subtarget->makefile; in = escapeFilePath(fileFixify(in_directory + subtarget->profile, FileFixifyAbsolute)); if(out.startsWith(in_directory)) - out = out.mid(in_directory.length()); + out = out.mid(in_directory.size()); out = escapeFilePath(out); t << subtarget->target << "-qmake_all: "; if (flags & SubTargetOrdered) { @@ -2698,7 +2708,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT if(!out_directory.isEmpty() && !out_directory.endsWith(Option::dir_sep)) out_directory += Option::dir_sep; if(!abs_source_path.isEmpty() && out_directory.startsWith(abs_source_path)) - out_directory = Option::output_dir + out_directory.mid(abs_source_path.length()); + out_directory = Option::output_dir + out_directory.mid(abs_source_path.size()); if(!recurse.contains(subtarget->name)) continue; @@ -2713,7 +2723,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT out = subtarget->makefile; in = escapeFilePath(fileFixify(in_directory + subtarget->profile, FileFixifyAbsolute)); if (out.startsWith(in_directory)) - out = out.mid(in_directory.length()); + out = out.mid(in_directory.size()); out = escapeFilePath(out); } @@ -2849,7 +2859,7 @@ MakefileGenerator::fixLibFlags(const ProKey &var) const ProStringList &in = project->values(var); ProStringList ret; - ret.reserve(in.length()); + ret.reserve(in.size()); for (const ProString &v : in) ret << fixLibFlag(v); return ret; @@ -3015,7 +3025,7 @@ MakefileGenerator::fileFixify(const QString &file, FileFixifyTypes fix, bool can if(ret == match_dir) { ret = ""; } else if(ret.startsWith(match_dir + Option::dir_sep)) { - ret = ret.mid(match_dir.length() + Option::dir_sep.length()); + ret = ret.mid(match_dir.size() + Option::dir_sep.size()); } else { //figure out the depth int depth = 4; @@ -3037,7 +3047,7 @@ MakefileGenerator::fileFixify(const QString &file, FileFixifyTypes fix, bool can break; if(ret.startsWith(match_dir + Option::dir_sep)) { //concat - int remlen = ret.length() - (match_dir.length() + 1); + int remlen = ret.size() - (match_dir.size() + 1); if(remlen < 0) remlen = 0; ret = ret.right(remlen); @@ -3111,12 +3121,12 @@ MakefileGenerator::findFileForDep(const QMakeLocalFileName &dep, const QMakeLoca QList<QMakeLocalFileName> depdirs = QMakeSourceFileInfo::dependencyPaths(); depdirs.prepend(fileInfo(file.real()).absoluteDir().path()); QString pwd = qmake_getpwd(); - if(pwd.at(pwd.length()-1) != '/') + if(pwd.at(pwd.size()-1) != '/') pwd += '/'; - for(int i = 0; i < depdirs.count(); i++) { + for(int i = 0; i < depdirs.size(); i++) { QString dir = depdirs.at(i).real(); if(!QDir::isRelativePath(dir) && dir.startsWith(pwd)) - dir = dir.mid(pwd.length()); + dir = dir.mid(pwd.size()); if(QDir::isRelativePath(dir)) { if(!dir.endsWith(Option::dir_sep)) dir += Option::dir_sep; @@ -3232,7 +3242,7 @@ MakefileGenerator::pkgConfigFileName(bool fixify) ret = project->first("TARGET").toQString(); int slsh = ret.lastIndexOf(Option::dir_sep); if (slsh != -1) - ret = ret.right(ret.length() - slsh - 1); + ret = ret.right(ret.size() - slsh - 1); if (ret.startsWith("lib")) ret = ret.mid(3); int dot = ret.indexOf('.'); @@ -3537,7 +3547,7 @@ MakefileGenerator::LinkerResponseFileInfo MakefileGenerator::maybeCreateLinkerRe // When using QMAKE_LINK_OBJECT_MAX, the number of object files (regardless of their path // length) decides whether to use a response file. This is far from being a useful // heuristic but let's keep this behavior for backwards compatibility. - if (linkerInputs.count() < threshold) + if (linkerInputs.size() < threshold) return {}; } else { // When using QMAKE_REPONSEFILE_THRESHOLD, try to determine the command line length of the diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h index 854defb1a0..6ab4ad505d 100644 --- a/qmake/generators/makefile.h +++ b/qmake/generators/makefile.h @@ -145,7 +145,8 @@ protected: CompilerBuiltin = 0x01, CompilerNoCheckDeps = 0x02, CompilerRemoveNoExist = 0x04, - CompilerAddInputsAsMakefileDeps = 0x08 + CompilerWarnNoExist = 0x08, + CompilerAddInputsAsMakefileDeps = 0x10 }; uint flags, type; }; diff --git a/qmake/generators/makefiledeps.cpp b/qmake/generators/makefiledeps.cpp index c8f4772dcb..8e8d42cc96 100644 --- a/qmake/generators/makefiledeps.cpp +++ b/qmake/generators/makefiledeps.cpp @@ -164,7 +164,7 @@ void QMakeSourceFileInfo::setDependencyPaths(const QList<QMakeLocalFileName> &l) { // Ensure that depdirs does not contain the same paths several times, to minimize the stats QList<QMakeLocalFileName> ll; - for (int i = 0; i < l.count(); ++i) { + for (int i = 0; i < l.size(); ++i) { if (!ll.contains(l.at(i))) ll.append(l.at(i)); } @@ -809,7 +809,7 @@ bool QMakeSourceFileInfo::findDeps(SourceFile *file) } } if(!exists) { //path lookup - for (const QMakeLocalFileName &depdir : qAsConst(depdirs)) { + for (const QMakeLocalFileName &depdir : std::as_const(depdirs)) { QMakeLocalFileName f(depdir.real() + Option::dir_sep + lfn.real()); QFileInfo fi(findFileInfo(f)); if(fi.exists() && !fi.isDir()) { diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp index 9616e560b5..c9235509f2 100644 --- a/qmake/generators/metamakefile.cpp +++ b/qmake/generators/metamakefile.cpp @@ -52,7 +52,7 @@ public: void BuildsMetaMakefileGenerator::clearBuilds() { - for(int i = 0; i < makefiles.count(); i++) { + for(int i = 0; i < makefiles.size(); i++) { Build *build = makefiles[i]; if(QMakeProject *p = build->makefile->projectFile()) { if(p != project) @@ -73,12 +73,12 @@ BuildsMetaMakefileGenerator::init() const ProStringList &builds = project->values("BUILDS"); bool use_single_build = builds.isEmpty(); - if(builds.count() > 1 && Option::output.fileName() == "-") { + if(builds.size() > 1 && Option::output.fileName() == "-") { use_single_build = true; warn_msg(WarnLogic, "Cannot direct to stdout when using multiple BUILDS."); } if(!use_single_build) { - for(int i = 0; i < builds.count(); i++) { + for(int i = 0; i < builds.size(); i++) { ProString build = builds[i]; MakefileGenerator *makefile = processBuild(build); if(!makefile) @@ -91,7 +91,7 @@ BuildsMetaMakefileGenerator::init() } else { Build *b = new Build; b->name = name; - if(builds.count() != 1) + if(builds.size() != 1) b->build = build.toQString(); b->makefile = makefile; makefiles += b; @@ -126,7 +126,7 @@ BuildsMetaMakefileGenerator::write() bool ret = true; const QString &output_name = Option::output.fileName(); - for(int i = 0; ret && i < makefiles.count(); i++) { + for(int i = 0; ret && i < makefiles.size(); i++) { Option::output.setFileName(output_name); Build *build = makefiles[i]; @@ -223,7 +223,7 @@ void BuildsMetaMakefileGenerator::accumulateVariableFromBuilds(const ProKey &nam void BuildsMetaMakefileGenerator::checkForConflictingTargets() const { - if (makefiles.count() < 3) { + if (makefiles.size() < 3) { // Checking for conflicts only makes sense if we have more than one BUILD, // and the last entry in makefiles is the "glue" Build. return; @@ -234,7 +234,7 @@ void BuildsMetaMakefileGenerator::checkForConflictingTargets() const } using TargetInfo = std::pair<Build *, ProString>; QList<TargetInfo> targets; - const int last = makefiles.count() - 1; + const int last = makefiles.size() - 1; targets.resize(last); for (int i = 0; i < last; ++i) { Build *b = makefiles.at(i); @@ -324,7 +324,7 @@ SubdirsMetaMakefileGenerator::init() if(!subdir.isRelative()) { //we can try to make it relative QString subdir_path = subdir.filePath(); if(subdir_path.startsWith(thispwd)) - subdir = QFileInfo(subdir_path.mid(thispwd.length())); + subdir = QFileInfo(subdir_path.mid(thispwd.size())); } //handle sub project @@ -391,12 +391,12 @@ SubdirsMetaMakefileGenerator::write() const QString &pwd = qmake_getpwd(); const QString &output_dir = Option::output_dir; const QString &output_name = Option::output.fileName(); - for(int i = 0; ret && i < subs.count(); i++) { + for(int i = 0; ret && i < subs.size(); i++) { const Subdir *sub = subs.at(i); qmake_setpwd(sub->input_dir); Option::output_dir = QFileInfo(sub->output_dir).absoluteFilePath(); Option::output.setFileName(sub->output_file); - if(i != subs.count()-1) { + if(i != subs.size()-1) { for (int ind = 0; ind < sub->indent; ++ind) printf(" "); printf("Writing %s\n", QDir::cleanPath(Option::output_dir+"/"+ @@ -414,7 +414,7 @@ SubdirsMetaMakefileGenerator::write() SubdirsMetaMakefileGenerator::~SubdirsMetaMakefileGenerator() { - for(int i = 0; i < subs.count(); i++) + for(int i = 0; i < subs.size(); i++) delete subs[i]; subs.clear(); } diff --git a/qmake/generators/projectgenerator.cpp b/qmake/generators/projectgenerator.cpp index 730e16fdaf..96d7b26370 100644 --- a/qmake/generators/projectgenerator.cpp +++ b/qmake/generators/projectgenerator.cpp @@ -54,7 +54,7 @@ ProjectGenerator::init() dirs.prepend(qmake_getpwd()); } - for(int i = 0; i < dirs.count(); ++i) { + for(int i = 0; i < dirs.size(); ++i) { QString dir, regex, pd = dirs.at(i); bool add_depend = false; if(exists(pd)) { @@ -66,7 +66,7 @@ ProjectGenerator::init() dir += Option::dir_sep; if (Option::recursive) { QStringList files = QDir(dir).entryList(QDir::Files); - for (int i = 0; i < files.count(); i++) + for (int i = 0; i < files.size(); i++) dirs.append(dir + files[i] + QDir::separator() + builtin_regex); } regex = builtin_regex; @@ -87,16 +87,16 @@ ProjectGenerator::init() int s = regex.lastIndexOf(Option::dir_sep); if(s != -1) { dir = regex.left(s+1); - regex = regex.right(regex.length() - (s+1)); + regex = regex.right(regex.size() - (s+1)); } const QDir d(dir); if (Option::recursive) { QStringList entries = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot); - for (int i = 0; i < entries.count(); i++) + for (int i = 0; i < entries.size(); i++) dirs.append(dir + entries[i] + QDir::separator() + regex); } QStringList files = d.entryList(QDir::nameFiltersFromString(regex)); - for(int i = 0; i < (int)files.count(); i++) { + for(int i = 0; i < (int)files.size(); i++) { QString file = d.absoluteFilePath(files[i]); if (addFile(file)) { add_depend = true; @@ -116,7 +116,7 @@ ProjectGenerator::init() if(Option::projfile::do_pwd) knownDirs.prepend("."); const QString out_file = fileFixify(Option::output.fileName()); - for(int i = 0; i < knownDirs.count(); ++i) { + for(int i = 0; i < knownDirs.size(); ++i) { QString pd = knownDirs.at(i); if(exists(pd)) { QString newdir = pd; @@ -129,7 +129,7 @@ ProjectGenerator::init() subdirs.append(newdir); } else { QStringList profiles = QDir(newdir).entryList(QStringList("*" + Option::pro_ext), QDir::Files); - for(int i = 0; i < (int)profiles.count(); i++) { + for(int i = 0; i < (int)profiles.size(); i++) { QString nd = newdir; if(nd == ".") nd = ""; @@ -143,7 +143,7 @@ ProjectGenerator::init() } if (Option::recursive) { QStringList dirs = QDir(newdir).entryList(QDir::Dirs | QDir::NoDotAndDotDot); - for(int i = 0; i < (int)dirs.count(); i++) { + for(int i = 0; i < (int)dirs.size(); i++) { QString nd = fileFixify(newdir + QDir::separator() + dirs[i]); if (!knownDirs.contains(nd, Qt::CaseInsensitive)) knownDirs.append(nd); @@ -155,12 +155,12 @@ ProjectGenerator::init() int s = regx.lastIndexOf(Option::dir_sep); if(s != -1) { dir = regx.left(s+1); - regx = regx.right(regx.length() - (s+1)); + regx = regx.right(regx.size() - (s+1)); } QStringList files = QDir(dir).entryList(QDir::nameFiltersFromString(regx), QDir::Dirs | QDir::NoDotAndDotDot); ProStringList &subdirs = v["SUBDIRS"]; - for(int i = 0; i < (int)files.count(); i++) { + for(int i = 0; i < (int)files.size(); i++) { QString newdir(dir + files[i]); QFileInfo fi(fileInfo(newdir)); { @@ -170,7 +170,7 @@ ProjectGenerator::init() subdirs.append(newdir); } else { QStringList profiles = QDir(newdir).entryList(QStringList("*" + Option::pro_ext), QDir::Files); - for(int i = 0; i < (int)profiles.count(); i++) { + for(int i = 0; i < (int)profiles.size(); i++) { QString nd = newdir + QDir::separator() + files[i]; fileFixify(nd); if(files[i] != "." && files[i] != ".." && !subdirs.contains(nd, Qt::CaseInsensitive)) { @@ -231,7 +231,7 @@ ProjectGenerator::init() } if(!h_ext.isEmpty()) { for(int cppit = 0; cppit < Option::cpp_ext.size(); ++cppit) { - QString src(dep.left(dep.length() - h_ext.length()) + + QString src(dep.left(dep.size() - h_ext.size()) + Option::cpp_ext.at(cppit)); if(exists(src)) { ProStringList &srcl = v["SOURCES"]; @@ -321,7 +321,7 @@ ProjectGenerator::writeMakefile(QTextStream &t) "# Please consult the documentation of the deprecated API in order to know\n" "# how to port your code away from it.\n" "# You can also select to disable deprecated APIs only up to a certain version of Qt.\n" - "#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0\n\n"; + "#DEFINES += QT_DISABLE_DEPRECATED_UP_TO=0x060000 # disables all APIs deprecated in Qt 6.0.0 and earlier\n\n"; t << "# Input" << "\n"; t << getWritableVar("HEADERS") @@ -358,7 +358,7 @@ ProjectGenerator::addFile(QString file) int s = file.lastIndexOf(Option::dir_sep); if(s != -1) dir = file.left(s+1); - if(file.mid(dir.length(), Option::h_moc_mod.length()) == Option::h_moc_mod) + if(file.mid(dir.size(), Option::h_moc_mod.size()) == Option::h_moc_mod) return false; ProKey where; @@ -428,9 +428,9 @@ ProjectGenerator::getWritableVar(const char *vk, bool) else ret = v + " += "; QString join = vals.join(' '); - if(ret.length() + join.length() > 80) { + if(ret.size() + join.size() > 80) { QString spaces; - for(int i = 0; i < ret.length(); i++) + for(int i = 0; i < ret.size(); i++) spaces += " "; join = vals.join(" \\\n" + spaces); } diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp index 54c8d6e6a3..c6771e7ab9 100644 --- a/qmake/generators/unix/unixmake.cpp +++ b/qmake/generators/unix/unixmake.cpp @@ -14,7 +14,7 @@ QT_BEGIN_NAMESPACE ProStringList UnixMakefileGenerator::libdirToFlags(const ProKey &key) { ProStringList results; - for (const auto &libdir : qAsConst(project->values(key))) { + for (const auto &libdir : std::as_const(project->values(key))) { if (!project->isEmpty("QMAKE_LFLAGS_RPATH") && project->isActiveConfig("rpath_libdirs")) project->values("QMAKE_LFLAGS") += var("QMAKE_LFLAGS_RPATH") + libdir; results.append("-L" + escapeFilePath(libdir)); @@ -48,7 +48,7 @@ UnixMakefileGenerator::init() for (const ProString &iif : project->values("QMAKE_INTERNAL_INCLUDED_FILES")) { if (iif == project->cacheFile()) continue; - if (iif.startsWith(sroot) && iif.at(sroot.length()) == QLatin1Char('/')) + if (iif.startsWith(sroot) && iif.at(sroot.size()) == QLatin1Char('/')) project->values("DISTFILES") += fileFixify(iif.toQString(), FileFixifyRelative); } @@ -101,7 +101,7 @@ UnixMakefileGenerator::init() const ProStringList &rpathdirs = project->values("QMAKE_RPATHDIR"); for (int i = 0; i < rpathdirs.size(); ++i) { QString rpathdir = rpathdirs[i].toQString(); - if (rpathdir.length() > 1 && rpathdir.at(0) == '$' && rpathdir.at(1) != '(') { + if (rpathdir.size() > 1 && rpathdir.at(0) == '$' && rpathdir.at(1) != '(') { rpathdir.replace(0, 1, "\\$$"); // Escape from make and the shell } else if (!rpathdir.startsWith('@') && fileInfo(rpathdir).isRelative()) { QString rpathbase = project->first("QMAKE_REL_RPATH_BASE").toQString(); @@ -241,7 +241,6 @@ UnixMakefileGenerator::init() if(project->isEmpty("QMAKE_BUNDLE_LOCATION")) project->values("QMAKE_BUNDLE_LOCATION").append("Contents/MacOS"); project->values("QMAKE_PKGINFO").append(project->first("DESTDIR") + bundle + "/Contents/PkgInfo"); - project->values("QMAKE_BUNDLE_RESOURCE_FILE").append(project->first("DESTDIR") + bundle + "/Contents/Resources/empty.lproj"); } else if(project->first("TEMPLATE") == "lib" && !project->isActiveConfig("staticlib") && ((!project->isActiveConfig("plugin") && project->isActiveConfig("lib_bundle")) || (project->isActiveConfig("plugin") && project->isActiveConfig("plugin_bundle")))) { @@ -299,7 +298,7 @@ QStringList ProStringList pchArchs = project->values("QMAKE_PCH_ARCHS"); if (pchArchs.isEmpty()) pchArchs << ProString(); // normal single-arch PCH - for (const ProString &arch : qAsConst(pchArchs)) { + for (const ProString &arch : std::as_const(pchArchs)) { auto pfx = header_prefix; if (!arch.isEmpty()) pfx.replace(QLatin1String("${QMAKE_PCH_ARCH}"), arch.toQString()); @@ -337,7 +336,7 @@ QStringList ProStringList pchArchs = project->values("QMAKE_PCH_ARCHS"); if (pchArchs.isEmpty()) pchArchs << ProString(); // normal single-arch PCH - for (const ProString &arch : qAsConst(pchArchs)) { + for (const ProString &arch : std::as_const(pchArchs)) { QString precompiledHeader = header_prefix + language + header_suffix; if (!arch.isEmpty()) { precompiledHeader.replace(QLatin1String("${QMAKE_PCH_ARCH}"), @@ -392,7 +391,7 @@ UnixMakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags) libdirs.insert(libidx++, f); } else if(opt.startsWith("-l")) { QString lib = opt.mid(2); - for (const QMakeLocalFileName &libdir : qAsConst(libdirs)) { + for (const QMakeLocalFileName &libdir : std::as_const(libdirs)) { QString libBase = libdir.local() + '/' + project->first("QMAKE_PREFIX_SHLIB") + lib; if (linkPrl && processPrlFile(libBase, true)) @@ -418,7 +417,7 @@ UnixMakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags) frameworkName.truncate(suffixPosition); opt.remove(suffixMarker); // Apply suffix by removing marker } - for (const QMakeLocalFileName &dir : qAsConst(frameworkdirs)) { + for (const QMakeLocalFileName &dir : std::as_const(frameworkdirs)) { auto processPrlIfFound = [&](QString directory) { QString suffixedPrl = directory + opt; if (processPrlFile(suffixedPrl, true)) @@ -436,7 +435,7 @@ UnixMakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags) break; } } else { - if (opt.length() == 10) + if (opt.size() == 10) ++it; // Skip } @@ -689,7 +688,7 @@ UnixMakefileGenerator::defaultInstall(const QString &t) QString link = Option::fixPathToTargetOS(destdir + links[i], false); int lslash = link.lastIndexOf(Option::dir_sep); if(lslash != -1) - link = link.right(link.length() - (lslash + 1)); + link = link.right(link.size() - (lslash + 1)); QString dst_link = escapeFilePath( filePrefixRoot(root, fileFixify(targetdir + link, FileFixifyAbsolute))); ret += "\n\t-$(SYMLINK) $(TARGET) " + dst_link; diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 98c7e217cf..96036eba70 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -10,6 +10,7 @@ #include <qfile.h> #include <qdir.h> #include <qdebug.h> +#include <qtversion.h> #include <time.h> #include <tuple> @@ -104,11 +105,11 @@ UnixMakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator:: if (!out_directory.isEmpty() && !out_directory.endsWith(Option::dir_sep)) out_directory += Option::dir_sep; if (!abs_source_path.isEmpty() && out_directory.startsWith(abs_source_path)) - out_directory = Option::output_dir + out_directory.mid(abs_source_path.length()); + out_directory = Option::output_dir + out_directory.mid(abs_source_path.size()); QString dist_directory = out_directory; if (dist_directory.endsWith(Option::dir_sep)) - dist_directory.chop(Option::dir_sep.length()); + dist_directory.chop(Option::dir_sep.size()); if (!dist_directory.startsWith(Option::dir_sep)) dist_directory.prepend(Option::dir_sep); @@ -120,7 +121,7 @@ UnixMakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator:: QString out = subtarget->makefile; QString in = escapeFilePath(fileFixify(in_directory + subtarget->profile, FileFixifyAbsolute)); if (out.startsWith(in_directory)) - out.remove(0, in_directory.length()); + out.remove(0, in_directory.size()); t << subtarget->target << "-distdir: FORCE"; writeSubTargetCall(t, in_directory, in, out_directory, escapeFilePath(out), @@ -302,7 +303,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) for(QStringList::Iterator cit = Option::c_ext.begin(); cit != Option::c_ext.end(); ++cit) { if((*it).endsWith((*cit))) { - d_file = (*it).left((*it).length() - (*cit).length()).toQString(); + d_file = (*it).left((*it).length() - (*cit).size()).toQString(); break; } } @@ -310,7 +311,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) for(QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) { if((*it).endsWith((*cppit))) { - d_file = (*it).left((*it).length() - (*cppit).length()).toQString(); + d_file = (*it).left((*it).length() - (*cppit).size()).toQString(); break; } } @@ -387,7 +388,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) //incremental target QString incr_target = var("TARGET") + "_incremental"; if(incr_target.indexOf(Option::dir_sep) != -1) - incr_target = incr_target.right(incr_target.length() - + incr_target = incr_target.right(incr_target.size() - (incr_target.lastIndexOf(Option::dir_sep) + 1)); QString incr_deps, incr_objs; if(project->first("QMAKE_INCREMENTAL_STYLE") == "ld") { @@ -488,7 +489,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) QString incr_target = var("QMAKE_ORIG_TARGET").replace( QRegularExpression("\\." + s_ext), "").replace(QRegularExpression("^lib"), "") + "_incremental"; if(incr_target.indexOf(Option::dir_sep) != -1) - incr_target = incr_target.right(incr_target.length() - + incr_target = incr_target.right(incr_target.size() - (incr_target.lastIndexOf(Option::dir_sep) + 1)); if(project->first("QMAKE_INCREMENTAL_STYLE") == "ld") { @@ -803,18 +804,19 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) QString icon = fileFixify(var("ICON")); t << "@$(DEL_FILE) " << info_plist_out << "\n\t" - << "@sed "; - for (const ProString &arg : qAsConst(commonSedArgs)) + << "@plutil -convert xml1 -o - " << info_plist << " | " + << "sed "; + for (const ProString &arg : std::as_const(commonSedArgs)) t << arg; const QString iconName = icon.section(Option::dir_sep, -1); t << "-e \"s,@ICON@," << iconName << ",g\" " << "-e \"s,\\$${ASSETCATALOG_COMPILER_APPICON_NAME}," << iconName << ",g\" " << "-e \"s,@EXECUTABLE@," << app_bundle_name << ",g\" " << "-e \"s,@LIBRARY@," << plugin_bundle_name << ",g\" " - << "-e \"s,\\$${EXECUTABLE_NAME}," << (app_bundle_name.isEmpty() ? app_bundle_name : plugin_bundle_name) << ",g\" " + << "-e \"s,\\$${EXECUTABLE_NAME}," << (!app_bundle_name.isEmpty() ? app_bundle_name : plugin_bundle_name) << ",g\" " << "-e \"s,@TYPEINFO@,"<< typeInfo << ",g\" " << "-e \"s,\\$${QMAKE_PKGINFO_TYPEINFO},"<< typeInfo << ",g\" " - << "" << info_plist << " >" << info_plist_out << Qt::endl; + << ">" << info_plist_out << Qt::endl; //copy the icon if (!project->isEmpty("ICON")) { QString dir = bundle_dir + "Contents/Resources/"; @@ -835,21 +837,22 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) if (!isShallowBundle) symlinks[bundle_dir + "Resources"] = "Versions/Current/Resources"; t << "@$(DEL_FILE) " << info_plist_out << "\n\t" - << "@sed "; - for (const ProString &arg : qAsConst(commonSedArgs)) + << "@plutil -convert xml1 -o - " << info_plist << " | " + << "sed "; + for (const ProString &arg : std::as_const(commonSedArgs)) t << arg; t << "-e \"s,@LIBRARY@," << lib_bundle_name << ",g\" " << "-e \"s,\\$${EXECUTABLE_NAME}," << lib_bundle_name << ",g\" " << "-e \"s,@TYPEINFO@," << typeInfo << ",g\" " << "-e \"s,\\$${QMAKE_PKGINFO_TYPEINFO}," << typeInfo << ",g\" " - << "" << info_plist << " >" << info_plist_out << Qt::endl; + << ">" << info_plist_out << Qt::endl; } break; } // project->isActiveConfig("no_plist") //copy other data if(!project->isEmpty("QMAKE_BUNDLE_DATA")) { const ProStringList &bundle_data = project->values("QMAKE_BUNDLE_DATA"); - for(int i = 0; i < bundle_data.count(); i++) { + for(int i = 0; i < bundle_data.size(); i++) { const ProStringList &files = project->values(ProKey(bundle_data[i] + ".files")); QString path = bundle_dir; const ProKey pkey(bundle_data[i] + ".path"); @@ -869,7 +872,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) } path += project->first(pkey).toQString(); path = Option::fixPathToTargetOS(path); - for(int file = 0; file < files.count(); file++) { + for(int file = 0; file < files.size(); file++) { QString fn = files.at(file).toQString(); QString src = fileFixify(fn, FileFixifyAbsolute); if (!QFile::exists(src)) @@ -976,7 +979,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) ProStringList pchArchs = project->values("QMAKE_PCH_ARCHS"); if (pchArchs.isEmpty()) pchArchs << ProString(); // normal single-arch PCH - for (const ProString &arch : qAsConst(pchArchs)) { + for (const ProString &arch : std::as_const(pchArchs)) { ProString pchOutput; if (!project->isEmpty("PRECOMPILED_DIR")) pchOutput = project->first("PRECOMPILED_DIR"); @@ -1007,7 +1010,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) ProStringList pchArchs = project->values("QMAKE_PCH_ARCHS"); if (pchArchs.isEmpty()) pchArchs << ProString(); // normal single-arch PCH - for (const ProString &arch : qAsConst(pchArchs)) { + for (const ProString &arch : std::as_const(pchArchs)) { QString file = precomph_out_dir + header_prefix + language + header_suffix; if (!arch.isEmpty()) file.replace(QStringLiteral("${QMAKE_PCH_ARCH}"), arch.toQString()); @@ -1105,7 +1108,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) } pchFlags.replace(QLatin1String("${QMAKE_PCH_INPUT}"), escapeFilePath(pchInput)) .replace(QLatin1String("${QMAKE_PCH_OUTPUT_BASE}"), escapeFilePath(pchBaseName.toQString())); - for (const ProString &arch : qAsConst(pchArchs)) { + for (const ProString &arch : std::as_const(pchArchs)) { auto pchArchOutput = pchOutput.toQString(); if (!arch.isEmpty()) pchArchOutput.replace(QStringLiteral("${QMAKE_PCH_ARCH}"), arch.toQString()); @@ -1394,7 +1397,7 @@ UnixMakefileGenerator::libtoolFileName(bool fixify) QString ret = var("TARGET"); int slsh = ret.lastIndexOf(Option::dir_sep); if(slsh != -1) - ret = ret.right(ret.length() - slsh - 1); + ret = ret.right(ret.size() - slsh - 1); int dot = ret.indexOf('.'); if(dot != -1) ret = ret.left(dot); @@ -1464,7 +1467,7 @@ UnixMakefileGenerator::writeLibtoolFile() mkdir(fileInfo(fname).path()); int slsh = lname.lastIndexOf(Option::dir_sep); if(slsh != -1) - lname = lname.right(lname.length() - slsh - 1); + lname = lname.right(lname.size() - slsh - 1); QFile ft(fname); if(!ft.open(QIODevice::WriteOnly)) return; @@ -1475,7 +1478,7 @@ UnixMakefileGenerator::writeLibtoolFile() QTextStream t(&ft); t << "# " << lname << " - a libtool library file\n"; t << "# Generated by qmake/libtool (" QMAKE_VERSION_STR ") (Qt " - << qVersion() << ")"; + << QT_VERSION_STR << ")"; t << "\n"; t << "# The name that we can dlopen(3).\n" @@ -1494,7 +1497,7 @@ UnixMakefileGenerator::writeLibtoolFile() t << "'\n\n"; t << "# The name of the static archive.\n" - << "old_library='" << escapeFilePath(lname.left(lname.length()-Option::libtool_ext.length())) + << "old_library='" << escapeFilePath(lname.left(lname.size()-Option::libtool_ext.size())) << ".a'\n\n"; t << "# Libraries that this one depends upon.\n"; @@ -1557,9 +1560,9 @@ bool UnixMakefileGenerator::writeObjectsPart(QTextStream &t, bool do_incremental if (!increment) t << "\\\n\t\t" << (*objit); } - if (incrs_out.count() == objs.count()) { //we just switched places, no real incrementals to be done! + if (incrs_out.size() == objs.size()) { //we just switched places, no real incrementals to be done! t << escapeFilePaths(incrs_out).join(QString(" \\\n\t\t")) << Qt::endl; - } else if (!incrs_out.count()) { + } else if (!incrs_out.size()) { t << Qt::endl; } else { src_incremental = true; diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index b8f6e54593..7f798a2cc6 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -191,7 +191,7 @@ void MingwMakefileGenerator::writeIncPart(QTextStream &t) return; } } - for (const ProString &incit: qAsConst(incs)) { + for (const ProString &incit: std::as_const(incs)) { QString inc = incit.toQString(); inc.replace(QRegularExpression("\\\\$"), ""); inc.replace('\\', '/'); @@ -250,7 +250,7 @@ void MingwMakefileGenerator::writeBuildRulesPart(QTextStream &t) if(project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") { t << "\n\t-$(DEL_FILE) $(DESTDIR_TARGET) 2>" << var("QMAKE_SHELL_NULL_DEVICE"); const ProString &objmax = project->first("QMAKE_LINK_OBJECT_MAX"); - if (objmax.isEmpty() || project->values("OBJECTS").count() < objmax.toInt()) { + if (objmax.isEmpty() || project->values("OBJECTS").size() < objmax.toInt()) { t << "\n\t$(LIB) $(DESTDIR_TARGET) " << objectsLinkLine << " " ; } else { t << "\n\t" << objectsLinkLine << " " ; @@ -273,7 +273,7 @@ void MingwMakefileGenerator::writeRcFilePart(QTextStream &t) ProStringList rcIncPaths = project->values("RC_INCLUDEPATH"); rcIncPaths.prepend(fileInfo(rc_file).path()); QString incPathStr; - for (int i = 0; i < rcIncPaths.count(); ++i) { + for (int i = 0; i < rcIncPaths.size(); ++i) { const ProString &path = rcIncPaths.at(i); if (path.isEmpty()) continue; diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp index ba3bc37088..7cbb44dde4 100644 --- a/qmake/generators/win32/msbuild_objectmodel.cpp +++ b/qmake/generators/win32/msbuild_objectmodel.cpp @@ -283,7 +283,7 @@ static QString commandLinesForOutput(QStringList commands) // As we want every sub-command to be error-checked (as is done by makefile-based // backends), we insert the checks ourselves, using the undocumented jump target. static QString errchk = QStringLiteral("if errorlevel 1 goto VCEnd"); - for (int i = commands.count() - 2; i >= 0; --i) { + for (int i = commands.size() - 2; i >= 0; --i) { if (!commands.at(i).startsWith("rem", Qt::CaseInsensitive)) commands.insert(i + 1, errchk); } @@ -301,7 +301,7 @@ static QStringList unquote(const QStringList &values) { QStringList result; result.reserve(values.size()); - for (int i = 0; i < values.count(); ++i) + for (int i = 0; i < values.size(); ++i) result << unquote(values.at(i)); return result; } @@ -544,7 +544,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool) [] (const VCFilter &filter) { return filter.Name; }); tempProj.ExtraCompilers.removeDuplicates(); - for (int x = 0; x < tempProj.ExtraCompilers.count(); ++x) + for (int x = 0; x < tempProj.ExtraCompilers.size(); ++x) addFilters(tempProj, xmlFilter, tempProj.ExtraCompilers.at(x)); xmlFilter << closetag(); @@ -559,7 +559,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool) outputFilter(tempProj, xml, xmlFilter, "Deployment Files"); outputFilter(tempProj, xml, xmlFilter, "Distribution Files"); - for (int x = 0; x < tempProj.ExtraCompilers.count(); ++x) { + for (int x = 0; x < tempProj.ExtraCompilers.size(); ++x) { outputFilter(tempProj, xml, xmlFilter, tempProj.ExtraCompilers.at(x)); } @@ -574,7 +574,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool) void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool) { - if (tool.SingleProjects.count() == 0) { + if (tool.SingleProjects.size() == 0) { warn_msg(WarnLogic, "Generator: .NET: no single project in merge project, no output"); return; } @@ -589,7 +589,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool) << tag("ItemGroup") << attrTag("Label", "ProjectConfigurations"); - for (int i = 0; i < tool.SingleProjects.count(); ++i) { + for (int i = 0; i < tool.SingleProjects.size(); ++i) { xml << tag("ProjectConfiguration") << attrTag("Include" , tool.SingleProjects.at(i).Configuration.Name) << tagValue("Configuration", tool.SingleProjects.at(i).Configuration.ConfigurationName) @@ -613,7 +613,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool) // config part. xml << import("Project", "$(VCTargetsPath)\\Microsoft.Cpp.Default.props"); - for (int i = 0; i < tool.SingleProjects.count(); ++i) + for (int i = 0; i < tool.SingleProjects.size(); ++i) write(xml, tool.SingleProjects.at(i).Configuration); xml << import("Project", "$(VCTargetsPath)\\Microsoft.Cpp.props"); @@ -623,7 +623,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool) << closetag(); // PropertySheets - for (int i = 0; i < tool.SingleProjects.count(); ++i) { + for (int i = 0; i < tool.SingleProjects.size(); ++i) { xml << tag("ImportGroup") << attrTag("Condition", generateCondition(tool.SingleProjects.at(i).Configuration)) << attrTag("Label", "PropertySheets"); @@ -641,7 +641,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool) << closetag(); xml << tag("PropertyGroup"); - for (int i = 0; i < tool.SingleProjects.count(); ++i) { + for (int i = 0; i < tool.SingleProjects.size(); ++i) { const VCConfiguration &config = tool.SingleProjects.at(i).Configuration; const QString condition = generateCondition(config); @@ -708,7 +708,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool) } xml << closetag(); - for (int i = 0; i < tool.SingleProjects.count(); ++i) { + for (int i = 0; i < tool.SingleProjects.size(); ++i) { const VCConfiguration &config = tool.SingleProjects.at(i).Configuration; xml << tag("ItemDefinitionGroup") @@ -774,7 +774,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool) addFilters(tool, xmlFilter, "Deployment Files"); addFilters(tool, xmlFilter, "Distribution Files"); - for (int x = 0; x < tool.ExtraCompilers.count(); ++x) + for (int x = 0; x < tool.ExtraCompilers.size(); ++x) addFilters(tool, xmlFilter, tool.ExtraCompilers.at(x)); xmlFilter << closetag(); @@ -788,7 +788,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool) outputFilter(tool, xml, xmlFilter, "Resource Files"); outputFilter(tool, xml, xmlFilter, "Deployment Files"); outputFilter(tool, xml, xmlFilter, "Distribution Files"); - for (int x = 0; x < tool.ExtraCompilers.count(); ++x) { + for (int x = 0; x < tool.ExtraCompilers.size(); ++x) { outputFilter(tool, xml, xmlFilter, tool.ExtraCompilers.at(x)); } outputFilter(tool, xml, xmlFilter, "Root Files"); @@ -1737,7 +1737,7 @@ void VCXProjectWriter::addFilters(VCProject &project, XmlOutput &xmlFilter, cons { bool added = false; - for (int i = 0; i < project.SingleProjects.count(); ++i) { + for (int i = 0; i < project.SingleProjects.size(); ++i) { const VCFilter filter = project.SingleProjects.at(i).filterByName(filtername); if(!filter.Files.isEmpty() && !added) { xmlFilter << tag("Filter") @@ -1759,10 +1759,10 @@ void VCXProjectWriter::outputFilter(VCProject &project, XmlOutput &xml, XmlOutpu else root.reset(new XTreeNode); - for (int i = 0; i < project.SingleProjects.count(); ++i) { + for (int i = 0; i < project.SingleProjects.size(); ++i) { const VCFilter filter = project.SingleProjects.at(i).filterByName(filtername); // Merge all files in this filter to root tree - for (int x = 0; x < filter.Files.count(); ++x) + for (int x = 0; x < filter.Files.size(); ++x) root->addElement(filter.Files.at(x)); } @@ -1789,8 +1789,8 @@ void VCXProjectWriter::outputFileConfigs(VCProject &project, XmlOutput &xml, Xml // We need to check if the file has any custom build step. // If there is one then it has to be included with "CustomBuild Include" bool hasCustomBuildStep = false; - QVarLengthArray<OutputFilterData> data(project.SingleProjects.count()); - for (int i = 0; i < project.SingleProjects.count(); ++i) { + QVarLengthArray<OutputFilterData> data(project.SingleProjects.size()); + for (int i = 0; i < project.SingleProjects.size(); ++i) { data[i].filter = project.SingleProjects.at(i).filterByName(cleanFilterName); if (!data[i].filter.Config) // only if the filter is not empty continue; @@ -1812,7 +1812,7 @@ void VCXProjectWriter::outputFileConfigs(VCProject &project, XmlOutput &xml, Xml } bool fileAdded = false; - for (int i = 0; i < project.SingleProjects.count(); ++i) { + for (int i = 0; i < project.SingleProjects.size(); ++i) { OutputFilterData *d = &data[i]; if (!d->filter.Config) // only if the filter is not empty continue; diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index 7e0eb4ed41..1e21afd1c2 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -264,9 +264,9 @@ QStringList NmakeMakefileGenerator::sourceFilesForImplicitRulesFilter() { QStringList filter; const QChar wildcard = QLatin1Char('*'); - for (const QString &ext : qAsConst(Option::c_ext)) + for (const QString &ext : std::as_const(Option::c_ext)) filter << wildcard + ext; - for (const QString &ext : qAsConst(Option::cpp_ext)) + for (const QString &ext : std::as_const(Option::cpp_ext)) filter << wildcard + ext; return filter; } @@ -290,7 +290,7 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t) for (int y = 0; directories[y]; y++) { QString dirTemp = project->first(directories[y]).toQString(); if (dirTemp.endsWith("\\")) - dirTemp.truncate(dirTemp.length()-1); + dirTemp.truncate(dirTemp.size()-1); if(!dirTemp.isEmpty()) source_directories.insert(dirTemp); } @@ -314,7 +314,7 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t) const QStringList sourceFilesFilter = sourceFilesForImplicitRulesFilter(); QStringList fixifiedSourceDirs = fileFixify(QList<QString>(source_directories.constBegin(), source_directories.constEnd()), FileFixifyAbsolute); fixifiedSourceDirs.removeDuplicates(); - for (const QString &sourceDir : qAsConst(fixifiedSourceDirs)) { + for (const QString &sourceDir : std::as_const(fixifiedSourceDirs)) { QDirIterator dit(sourceDir, sourceFilesFilter, QDir::Files | QDir::NoDotAndDotDot); while (dit.hasNext()) { const QFileInfo fi = dit.nextFileInfo(); @@ -339,7 +339,7 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t) project->variables().remove("QMAKE_RUN_CXX"); project->variables().remove("QMAKE_RUN_CC"); - for (const QString &sourceDir : qAsConst(source_directories)) { + for (const QString &sourceDir : std::as_const(source_directories)) { if (sourceDir.isEmpty()) continue; QString objDir = var("OBJECTS_DIR"); diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index 62214bb66a..b5639c0108 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -1478,7 +1478,8 @@ bool VCLinkerTool::parseOption(const char* option) EnableUAC = _True; break; case 0x3389797: // /DEBUG[:{FASTLINK|FULL|NONE}] - if (config->CompilerVersion >= NET2015) { + DebugInfoOption = linkerDebugOptionEnabled; + if (config->CompilerVersion >= NET2015 && *(option + 6) == ':') { const char *str = option + 7; if (qstricmp(str, "fastlink") == 0) DebugInfoOption = linkerDebugOptionFastLink; @@ -1539,7 +1540,7 @@ bool VCLinkerTool::parseOption(const char* option) { QStringList both = QString(option+6).split(","); HeapReserveSize = both[0].toLongLong(); - if(both.count() == 2) + if(both.size() == 2) HeapCommitSize = both[1].toLongLong(); } break; @@ -1728,7 +1729,7 @@ bool VCLinkerTool::parseOption(const char* option) { QStringList both = QString(option+7).split(","); StackReserveSize = both[0].toLongLong(); - if(both.count() == 2) + if(both.size() == 2) StackCommitSize = both[1].toLongLong(); } break; @@ -2231,13 +2232,13 @@ void VCFilter::addFile(const VCFilterFile& fileInfo) void VCFilter::addFiles(const QStringList& fileList) { - for (int i = 0; i < fileList.count(); ++i) + for (int i = 0; i < fileList.size(); ++i) addFile(fileList.at(i)); } void VCFilter::addFiles(const ProStringList& fileList) { - for (int i = 0; i < fileList.count(); ++i) + for (int i = 0; i < fileList.size(); ++i) addFile(fileList.at(i).toQString()); } @@ -2271,7 +2272,7 @@ void VCFilter::modifyPCHstage(QString str) lines << "* WARNING: All changes made in this file will be lost."; lines << "--------------------------------------------------------------------*/"; lines << "#include \"" + Project->precompHFilename + "\""; - for (const QString &line : qAsConst(lines)) + for (const QString &line : std::as_const(lines)) CustomBuildTool.CommandLine += "echo " + line + ">>" + toFile; return; } @@ -2304,7 +2305,7 @@ void VCFilter::modifyPCHstage(QString str) VCFilterFile VCFilter::findFile(const QString &filePath, bool *found) const { - for (int i = 0; i < Files.count(); ++i) { + for (int i = 0; i < Files.size(); ++i) { const VCFilterFile &f = Files.at(i); if (f.file == filePath) { *found = true; @@ -2330,7 +2331,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) hasBuiltIn = Project->hasBuiltinCompiler(objectMappedFile); // Remove the fake file suffix we've added initially to generate correct command lines. - inFile.chop(Project->customBuildToolFilterFileSuffix.length()); + inFile.chop(Project->customBuildToolFilterFileSuffix.size()); // qDebug("*** Extra compiler file has object mapped file '%s' => '%s'", qPrintable(inFile), qPrintable(objectMappedFile.join(' '))); } @@ -2342,7 +2343,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) CustomBuildTool.ToolPath.clear(); CustomBuildTool.ToolName = QLatin1String(_VCCustomBuildTool); - for (int x = 0; x < extraCompilers.count(); ++x) { + for (int x = 0; x < extraCompilers.size(); ++x) { const QString &extraCompilerName = extraCompilers.at(x); if (!Project->verifyExtraCompiler(extraCompilerName, inFile) && !hasBuiltIn) @@ -2387,7 +2388,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) configs.contains("dep_existing_only"), true /* checkCommandAvailability */); } - for (int i = 0; i < deps.count(); ++i) + for (int i = 0; i < deps.size(); ++i) deps[i] = Option::fixPathToTargetOS( Project->replaceExtraCompilerVariables( deps.at(i), inFile, out, MakefileGenerator::NoShell), @@ -2396,9 +2397,9 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) if (combined) { // Add dependencies for each file const ProStringList &tmp_in = Project->project->values(ProKey(extraCompilerName + ".input")); - for (int a = 0; a < tmp_in.count(); ++a) { + for (int a = 0; a < tmp_in.size(); ++a) { const ProStringList &files = Project->project->values(tmp_in.at(a).toKey()); - for (int b = 0; b < files.count(); ++b) { + for (int b = 0; b < files.size(); ++b) { QString file = files.at(b).toQString(); deps += Project->findDependencies(file); inputs += Option::fixPathToTargetOS(file, false); @@ -2432,7 +2433,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) } // Fixify paths - for (int i = 0; i < deps.count(); ++i) + for (int i = 0; i < deps.size(); ++i) deps[i] = Option::fixPathToTargetOS(deps[i], false); @@ -2450,7 +2451,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) deps += CustomBuildTool.AdditionalDependencies; // Make sure that all deps are only once QStringList uniqDeps; - for (int c = 0; c < deps.count(); ++c) { + for (int c = 0; c < deps.size(); ++c) { QString aDep = deps.at(c); if (!aDep.isEmpty()) uniqDeps << aDep; @@ -2461,7 +2462,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) // Ensure that none of the output files are also dependencies. Or else, the custom buildstep // will be rebuild every time, even if nothing has changed. - for (const QString &output : qAsConst(CustomBuildTool.Outputs)) + for (const QString &output : std::as_const(CustomBuildTool.Outputs)) CustomBuildTool.AdditionalDependencies.removeAll(output); useCustomBuildTool = !CustomBuildTool.CommandLine.isEmpty(); @@ -2496,7 +2497,7 @@ const VCFilter &VCProjectSingleConfig::filterByName(const QString &name) const const VCFilter &VCProjectSingleConfig::filterForExtraCompiler(const QString &compilerName) const { - for (int i = 0; i < ExtraCompilersFiles.count(); ++i) + for (int i = 0; i < ExtraCompilersFiles.size(); ++i) if (ExtraCompilersFiles.at(i).Name == compilerName) return ExtraCompilersFiles.at(i); @@ -2576,7 +2577,7 @@ void VCProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool) outputFilter(tempProj, xml, "Distribution Files"); QSet<QString> extraCompilersInProject; - for (int i = 0; i < tool.ExtraCompilersFiles.count(); ++i) { + for (int i = 0; i < tool.ExtraCompilersFiles.size(); ++i) { const QString &compilerName = tool.ExtraCompilersFiles.at(i).Name; if (!extraCompilersInProject.contains(compilerName)) { extraCompilersInProject += compilerName; @@ -2584,7 +2585,7 @@ void VCProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool) } } - for (int x = 0; x < tempProj.ExtraCompilers.count(); ++x) { + for (int x = 0; x < tempProj.ExtraCompilers.size(); ++x) { outputFilter(tempProj, xml, tempProj.ExtraCompilers.at(x)); } outputFilter(tempProj, xml, "Root Files"); @@ -2595,7 +2596,7 @@ void VCProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool) void VCProjectWriter::write(XmlOutput &xml, VCProject &tool) { - if (tool.SingleProjects.count() == 0) { + if (tool.SingleProjects.size() == 0) { warn_msg(WarnLogic, "Generator: .NET: no single project in merge project, no output"); return; } @@ -2615,7 +2616,7 @@ void VCProjectWriter::write(XmlOutput &xml, VCProject &tool) << closetag(_Platforms) << tag(_Configurations); // Output each configuration - for (int i = 0; i < tool.SingleProjects.count(); ++i) + for (int i = 0; i < tool.SingleProjects.size(); ++i) write(xml, tool.SingleProjects.at(i).Configuration); xml << closetag(_Configurations) << tag(q_Files); @@ -2628,7 +2629,7 @@ void VCProjectWriter::write(XmlOutput &xml, VCProject &tool) outputFilter(tool, xml, "Resource Files"); outputFilter(tool, xml, "Deployment Files"); outputFilter(tool, xml, "Distribution Files"); - for (int x = 0; x < tool.ExtraCompilers.count(); ++x) { + for (int x = 0; x < tool.ExtraCompilers.size(); ++x) { outputFilter(tool, xml, tool.ExtraCompilers.at(x)); } outputFilter(tool, xml, "Root Files"); @@ -2930,7 +2931,7 @@ void VCProjectWriter::write(XmlOutput &xml, const VCConfiguration &tool) void VCProjectWriter::write(XmlOutput &xml, VCFilter &tool) { - if(!tool.Files.count()) + if(!tool.Files.size()) return; if (!tool.Name.isEmpty()) { @@ -2940,7 +2941,7 @@ void VCProjectWriter::write(XmlOutput &xml, VCFilter &tool) << attrS(_UniqueIdentifier, tool.Guid) << attrT(_ParseFiles, tool.ParseFiles); } - for (int i = 0; i < tool.Files.count(); ++i) { + for (int i = 0; i < tool.Files.size(); ++i) { const VCFilterFile &info = tool.Files.at(i); xml << tag(q_File) << attrS(_RelativePath, Option::fixPathToTargetOS(info.file)) @@ -2964,11 +2965,11 @@ void VCProjectWriter::outputFilter(VCProject &project, XmlOutput &xml, const QSt QString name, extfilter, guid; triState parse = unset; - for (int i = 0; i < project.SingleProjects.count(); ++i) { + for (int i = 0; i < project.SingleProjects.size(); ++i) { const VCFilter filter = project.SingleProjects.at(i).filterByName(filtername); // Merge all files in this filter to root tree - for (int x = 0; x < filter.Files.count(); ++x) + for (int x = 0; x < filter.Files.size(); ++x) root->addElement(filter.Files.at(x)); // Save filter setting from first filter. Next filters @@ -3003,7 +3004,7 @@ void VCProjectWriter::outputFileConfigs(VCProject &project, XmlOutput &xml, cons { xml << tag(q_File) << attrS(_RelativePath, Option::fixPathToTargetOS(info.file)); - for (int i = 0; i < project.SingleProjects.count(); ++i) { + for (int i = 0; i < project.SingleProjects.size(); ++i) { VCFilter filter = project.SingleProjects.at(i).filterByName(filtername); if (filter.Config) // only if the filter is not empty outputFileConfig(filter, xml, info.file); diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h index f0869d510f..190d6c727f 100644 --- a/qmake/generators/win32/msvc_objectmodel.h +++ b/qmake/generators/win32/msvc_objectmodel.h @@ -258,6 +258,7 @@ enum inlineExpansionOption { }; enum linkerDebugOption { linkerDebugOptionNone, + linkerDebugOptionEnabled, // represents /DEBUG without further options linkerDebugOptionFastLink, linkerDebugOptionFull }; diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 6116ed9376..ac50253a44 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -142,24 +142,24 @@ bool VcprojGenerator::writeProjectMakefile() // Generate project file if(project->first("TEMPLATE") == "vcapp" || project->first("TEMPLATE") == "vclib") { - if (!mergedProjects.count()) { + if (!mergedProjects.size()) { warn_msg(WarnLogic, "Generator: MSVC.NET: no single configuration created, cannot output project!"); return false; } debug_msg(1, "Generator: MSVC.NET: Writing project file"); VCProject mergedProject; - for (int i = 0; i < mergedProjects.count(); ++i) { + for (int i = 0; i < mergedProjects.size(); ++i) { VCProjectSingleConfig *singleProject = &(mergedProjects.at(i)->vcProject); mergedProject.SingleProjects += *singleProject; - for (int j = 0; j < singleProject->ExtraCompilersFiles.count(); ++j) { + for (int j = 0; j < singleProject->ExtraCompilersFiles.size(); ++j) { const QString &compilerName = singleProject->ExtraCompilersFiles.at(j).Name; if (!mergedProject.ExtraCompilers.contains(compilerName)) mergedProject.ExtraCompilers += compilerName; } } - if(mergedProjects.count() > 1 && + if(mergedProjects.size() > 1 && mergedProjects.at(0)->vcProject.Name == mergedProjects.at(1)->vcProject.Name) mergedProjects.at(0)->writePrlFile(); @@ -349,7 +349,7 @@ ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash<QSt collectedSubdirs.append(qMakePair(tmpdir.toQString(), proj->values(ProKey(tmp_proj_subdirs.at(x) + ".depends")))); projLookup.insert(tmp_proj_subdirs.at(x).toQString(), tmpdir.toQString()); } - for (const auto &subdir : qAsConst(collectedSubdirs)) { + for (const auto &subdir : std::as_const(collectedSubdirs)) { QString profile = subdir.first; QFileInfo fi(fileInfo(Option::normalizePath(profile))); if (fi.exists()) { @@ -418,7 +418,7 @@ ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash<QSt newDep->uuid = tmp_proj.isEmpty("QMAKE_UUID") ? getProjectUUID(Option::fixPathToLocalOS(vcprojDir + QDir::separator() + vcproj)).toString().toUpper(): tmp_proj.first("QMAKE_UUID").toQString(); // We want to store it as the .lib name. if (newDep->target.endsWith(".dll")) - newDep->target = newDep->target.left(newDep->target.length()-3) + "lib"; + newDep->target = newDep->target.left(newDep->target.size()-3) + "lib"; projGuids.insert(newDep->projectName, newDep->target); if (tmpList.size()) { @@ -634,10 +634,10 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) bool VcprojGenerator::hasBuiltinCompiler(const QString &file) { // Source files - for (int i = 0; i < Option::cpp_ext.count(); ++i) + for (int i = 0; i < Option::cpp_ext.size(); ++i) if (file.endsWith(Option::cpp_ext.at(i))) return true; - for (int i = 0; i < Option::c_ext.count(); ++i) + for (int i = 0; i < Option::c_ext.size(); ++i) if (file.endsWith(Option::c_ext.at(i))) return true; if (file.endsWith(".rc") @@ -767,8 +767,8 @@ void VcprojGenerator::init() if (autogenPrecompSource) { precompSource = precompH + (pchIsCFile - ? (Option::c_ext.count() ? Option::c_ext.at(0) : QLatin1String(".c")) - : (Option::cpp_ext.count() ? Option::cpp_ext.at(0) : QLatin1String(".cpp"))); + ? (Option::c_ext.size() ? Option::c_ext.at(0) : QLatin1String(".c")) + : (Option::cpp_ext.size() ? Option::cpp_ext.at(0) : QLatin1String(".cpp"))); project->values("GENERATED_SOURCES") += precompSource; } else if (!precompSource.isEmpty()) { project->values("SOURCES") += precompSource; @@ -1213,7 +1213,7 @@ void VcprojGenerator::initDeploymentTool() continue; // We want to deploy .dlls not .libs if (dllName.endsWith(QLatin1String(".lib"))) - dllName.replace(dllName.length() - 3, 3, QLatin1String("dll")); + dllName.replace(dllName.size() - 3, 3, QLatin1String("dll")); // Use only the file name and check in Qt's install path and LIBPATHs to check for existence dllName.remove(0, dllName.lastIndexOf(QLatin1Char('/')) + 1); QFileInfo info; @@ -1553,7 +1553,7 @@ void VcprojGenerator::initExtraCompilerOutputs() } else if (!inputVars.isEmpty()) { // One output file per input const ProStringList &tmp_in = project->values(inputVars.first().toKey()); - for (int i = 0; i < tmp_in.count(); ++i) { + for (int i = 0; i < tmp_in.size(); ++i) { const QString &filename = tmp_in.at(i).toQString(); if (extraCompilerSources.contains(filename) && !otherFiltersContain(filename)) extraCompile.addFile(Option::fixPathToTargetOS( @@ -1568,7 +1568,7 @@ void VcprojGenerator::initExtraCompilerOutputs() for (const ProString &inputVar : inputVars) { if (!otherFilters.contains(inputVar)) { const ProStringList &tmp_in = project->values(inputVar.toKey()); - for (int i = 0; i < tmp_in.count(); ++i) { + for (int i = 0; i < tmp_in.size(); ++i) { const QString &filename = tmp_in.at(i).toQString(); if (extraCompilerSources.contains(filename) && !otherFiltersContain(filename)) extraCompile.addFile(Option::fixPathToTargetOS( diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index 4f56bad28a..c8317389f5 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -174,9 +174,9 @@ bool Win32MakefileGenerator::processPrlFileBase(QString &origFile, QStringView o { if (MakefileGenerator::processPrlFileBase(origFile, origName, fixedBase, slashOff)) return true; - for (int off = fixedBase.length(); off > slashOff; off--) { + for (int off = fixedBase.size(); off > slashOff; off--) { if (!fixedBase.at(off - 1).isDigit()) { - if (off != fixedBase.length()) { + if (off != fixedBase.size()) { return MakefileGenerator::processPrlFileBase( origFile, origName, fixedBase.left(off), slashOff); } @@ -479,8 +479,8 @@ void Win32MakefileGenerator::writeCleanParts(QTextStream &t) const int commandlineLimit = 2047; // NT limit, expanded for (ProStringList::ConstIterator it = list.begin(); it != list.end(); ++it) { file = ' ' + escapeFilePath(Option::fixPathToTargetOS((*it).toQString())); - if(del_statement.length() + files.length() + - qMax(fixEnvVariables(file).length(), file.length()) > commandlineLimit) { + if(del_statement.size() + files.size() + + qMax(fixEnvVariables(file).size(), file.size()) > commandlineLimit) { t << "\n\t" << del_statement << files; files.clear(); } @@ -508,8 +508,8 @@ void Win32MakefileGenerator::writeCleanParts(QTextStream &t) const int commandlineLimit = 2047; // NT limit, expanded for (ProStringList::ConstIterator it = list.begin(); it != list.end(); ++it) { file = " " + escapeFilePath(Option::fixPathToTargetOS((*it).toQString())); - if(del_statement.length() + files.length() + - qMax(fixEnvVariables(file).length(), file.length()) > commandlineLimit) { + if(del_statement.size() + files.size() + + qMax(fixEnvVariables(file).size(), file.size()) > commandlineLimit) { t << "\n\t" << del_statement << files; files.clear(); } @@ -686,7 +686,7 @@ void Win32MakefileGenerator::writeRcFilePart(QTextStream &t) const ProStringList rcIncPaths = project->values("RC_INCLUDEPATH"); QString incPathStr; - for (int i = 0; i < rcIncPaths.count(); ++i) { + for (int i = 0; i < rcIncPaths.size(); ++i) { const ProString &path = rcIncPaths.at(i); if (path.isEmpty()) continue; @@ -749,7 +749,7 @@ QString Win32MakefileGenerator::defaultInstall(const QString &t) QString dst_prl = Option::fixPathToTargetOS(project->first("QMAKE_INTERNAL_PRL_FILE").toQString()); int slsh = dst_prl.lastIndexOf(Option::dir_sep); if(slsh != -1) - dst_prl = dst_prl.right(dst_prl.length() - slsh - 1); + dst_prl = dst_prl.right(dst_prl.size() - slsh - 1); dst_prl = filePrefixRoot(root, targetdir + dst_prl); if (!ret.isEmpty()) ret += "\n\t"; diff --git a/qmake/generators/xmloutput.cpp b/qmake/generators/xmloutput.cpp index 713c1eca44..be64176f33 100644 --- a/qmake/generators/xmloutput.cpp +++ b/qmake/generators/xmloutput.cpp @@ -240,9 +240,9 @@ void XmlOutput::closeTag() { switch(currentState) { case Bare: - if (tagStack.count()) + if (tagStack.size()) //warn_msg(WarnLogic, "<Root>: Cannot close tag in Bare state, %d tags on stack", tagStack.count()); - qDebug("<Root>: Cannot close tag in Bare state, %d tags on stack", int(tagStack.count())); + qDebug("<Root>: Cannot close tag in Bare state, %d tags on stack", int(tagStack.size())); else //warn_msg(WarnLogic, "<Root>: Cannot close tag, no tags on stack"); qDebug("<Root>: Cannot close tag, no tags on stack"); @@ -271,7 +271,7 @@ void XmlOutput::closeTo(const QString &tag) qDebug("<%s>: Cannot close to tag <%s>, not on stack", tagStack.last().toLatin1().constData(), tag.toLatin1().constData()); return; } - int left = tagStack.count(); + int left = tagStack.size(); while (left-- && cont) { cont = tagStack.last().compare(tag) != 0; closeTag(); @@ -280,7 +280,7 @@ void XmlOutput::closeTo(const QString &tag) void XmlOutput::closeAll() { - if (!tagStack.count()) + if (!tagStack.size()) return; closeTo(QString()); } @@ -315,7 +315,7 @@ void XmlOutput::addAttribute(const QString &attribute, const QString &value) case Tag: //warn_msg(WarnLogic, "<%s>: Cannot add attribute since tags not open", tagStack.last().toLatin1().constData()); qDebug("<%s>: Cannot add attribute (%s) since tag's not open", - (tagStack.count() ? tagStack.last().toLatin1().constData() : "Root"), + (tagStack.size() ? tagStack.last().toLatin1().constData() : "Root"), attribute.toLatin1().constData()); return; case Attribute: @@ -333,7 +333,7 @@ void XmlOutput::addAttributeTag(const QString &attribute, const QString &value) case Tag: //warn_msg(WarnLogic, "<%s>: Cannot add attribute since tags not open", tagStack.last().toLatin1().constData()); qDebug("<%s>: Cannot add attribute (%s) since tag's not open", - (tagStack.count() ? tagStack.last().toLatin1().constData() : "Root"), + (tagStack.size() ? tagStack.last().toLatin1().constData() : "Root"), attribute.toLatin1().constData()); return; case Attribute: |