add ProStringList::join(ProString) overload and make use of it

this introduces an ambiguity, so some char* arguments need explicit
QString construction now.

Change-Id: Ic3919a1fa9419bbb3b57dd1aa7eb95643ee59e53
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Oswald Buddenhagen 2016-05-13 15:21:05 +02:00
parent 4c56466f43
commit e45a9fe457
6 changed files with 19 additions and 11 deletions

View File

@ -318,8 +318,8 @@ MakefileGenerator::findFilesInVPATH(ProStringList l, uchar flags, const QString
QDir::NoDotAndDotDot | QDir::AllEntries);
if(files.isEmpty()) {
debug_msg(1, "%s:%d Failure to find %s in vpath (%s)",
__FILE__, __LINE__,
val.toLatin1().constData(), vpath.join("::").toLatin1().constData());
__FILE__, __LINE__, val.toLatin1().constData(),
vpath.join(QString("::")).toLatin1().constData());
if(flags & VPATH_RemoveMissingFiles)
remove_file = true;
else if(flags & VPATH_WarnMissingFiles)
@ -780,7 +780,8 @@ MakefileGenerator::init()
for (ProStringList::Iterator it = incDirs.begin(); it != incDirs.end(); ++it)
deplist.append(QMakeLocalFileName((*it).toQString()));
QMakeSourceFileInfo::setDependencyPaths(deplist);
debug_msg(1, "Dependency Directories: %s", incDirs.join(" :: ").toLatin1().constData());
debug_msg(1, "Dependency Directories: %s",
incDirs.join(QString(" :: ")).toLatin1().constData());
//cache info
if(project->isActiveConfig("qmake_cache")) {
QString cache_file;
@ -2183,7 +2184,7 @@ MakefileGenerator::writeExtraVariables(QTextStream &t)
}
if (!outlist.isEmpty()) {
t << "####### Custom Variables\n";
t << outlist.join("\n") << endl << endl;
t << outlist.join('\n') << endl << endl;
}
}
@ -2727,7 +2728,7 @@ MakefileGenerator::writeMakeQmake(QTextStream &t, bool noDummyQmakeAll)
t << escapeDependencyPath(specdir() + Option::dir_sep + "qmake.conf") << " ";
}
const ProStringList &included = escapeDependencyPaths(project->values("QMAKE_INTERNAL_INCLUDED_FILES"));
t << included.join(" \\\n\t\t") << "\n\t"
t << included.join(QString(" \\\n\t\t")) << "\n\t"
<< qmake << endl;
for(int include = 0; include < included.size(); ++include) {
const ProString &i = included.at(include);

View File

@ -241,13 +241,14 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
t << "\\\n\t\t" << (*objit);
}
if(incrs_out.count() == objs.count()) { //we just switched places, no real incrementals to be done!
t << escapeFilePaths(incrs_out).join(" \\\n\t\t") << endl;
t << escapeFilePaths(incrs_out).join(QString(" \\\n\t\t")) << endl;
} else if(!incrs_out.count()) {
t << endl;
} else {
src_incremental = true;
t << endl;
t << "INCREMENTAL_OBJECTS = " << escapeFilePaths(incrs_out).join(" \\\n\t\t") << endl;
t << "INCREMENTAL_OBJECTS = "
<< escapeFilePaths(incrs_out).join(QString(" \\\n\t\t")) << endl;
}
} else {
// Used all over the place in both deps and commands.

View File

@ -490,7 +490,8 @@ ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash<QSt
// Check if all requirements are fulfilled
if (!tmp_proj.isEmpty("QMAKE_FAILED_REQUIREMENTS")) {
fprintf(stderr, "Project file(%s) not added to Solution because all requirements not met:\n\t%s\n",
fn.toLatin1().constData(), tmp_proj.values("QMAKE_FAILED_REQUIREMENTS").join(" ").toLatin1().constData());
fn.toLatin1().constData(),
tmp_proj.values("QMAKE_FAILED_REQUIREMENTS").join(' ').toLatin1().constData());
qmake_setpwd(oldpwd);
Option::output_dir = oldoutpwd;
continue;

View File

@ -365,6 +365,11 @@ static QString ProStringList_join(const ProStringList &this_, const QChar *sep,
return res;
}
QString ProStringList::join(const ProString &sep) const
{
return ProStringList_join(*this, sep.constData(), sep.size());
}
QString ProStringList::join(const QString &sep) const
{
return ProStringList_join(*this, sep.constData(), sep.size());

View File

@ -233,6 +233,7 @@ public:
int length() const { return size(); }
QString join(const ProString &sep) const;
QString join(const QString &sep) const;
QString join(QChar sep) const;

View File

@ -596,10 +596,9 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
if (args.count() < 1 || args.count() > 4) {
evalError(fL1S("join(var, glue, before, after) requires one to four arguments."));
} else {
QString glue;
ProString before, after;
ProString glue, before, after;
if (args.count() >= 2)
glue = args.at(1).toQString(m_tmp1);
glue = args.at(1);
if (args.count() >= 3)
before = args[2];
if (args.count() == 4)