diff options
author | Oswald Buddenhagen <oswald.buddenhagen@digia.com> | 2013-07-04 11:25:16 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-07-04 18:13:18 +0200 |
commit | 51980595e100a1f124e77f35ddfdd5cfd2f0722b (patch) | |
tree | 36ce52c00e45c7614681078e42ac934113053d4e /qmake/generators/win32 | |
parent | d149ceef4a3549ddd2a3267ec160bab1d9f939e8 (diff) |
merge string literals
makes for less visual noise and a tiny bit more efficient code.
Change-Id: I587707fa4e2dc9bead9435bf5caf3a98ab680725
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'qmake/generators/win32')
-rw-r--r-- | qmake/generators/win32/mingw_make.cpp | 32 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_nmake.cpp | 22 | ||||
-rw-r--r-- | qmake/generators/win32/winmakefile.cpp | 98 |
3 files changed, 76 insertions, 76 deletions
diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index be4f203f01..38e6c56bb5 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -115,10 +115,10 @@ bool MingwMakefileGenerator::writeMakefile(QTextStream &t) { writeHeader(t); if(!project->values("QMAKE_FAILED_REQUIREMENTS").isEmpty()) { - t << "all clean:" << "\n\t" + t << "all clean:\n\t" << "@echo \"Some of the required modules (" - << var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"" << "\n\t" - << "@echo \"Skipped.\"" << endl << endl; + << var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"\n\t" + << "@echo \"Skipped.\"\n\n"; writeMakeQmake(t); return true; } @@ -134,10 +134,10 @@ bool MingwMakefileGenerator::writeMakefile(QTextStream &t) const ProStringList &qut = project->values("QMAKE_EXTRA_TARGETS"); for (ProStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it) t << *it << " "; - t << "first all clean install distclean uninstall: qmake" << endl - << "qmake_all:" << endl; + t << "first all clean install distclean uninstall: qmake\n" + << "qmake_all:\n"; writeMakeQmake(t); - t << "FORCE:" << endl << endl; + t << "FORCE:\n\n"; return true; } writeMingwParts(t); @@ -156,7 +156,7 @@ void createLdObjectScriptFile(const QString &fileName, const ProStringList &objL QFile file(filePath); if (file.open(QIODevice::WriteOnly | QIODevice::Text)) { QTextStream t(&file); - t << "INPUT(" << endl; + t << "INPUT(\n"; for (ProStringList::ConstIterator it = objList.constBegin(); it != objList.constEnd(); ++it) { QString path = (*it).toQString(); if (QDir::isRelativePath(path)) @@ -164,7 +164,7 @@ void createLdObjectScriptFile(const QString &fileName, const ProStringList &objL else t << path << endl; } - t << ");" << endl; + t << ");\n"; t.flush(); file.close(); } @@ -180,7 +180,7 @@ void createArObjectScriptFile(const QString &fileName, const QString &target, co for (ProStringList::ConstIterator it = objList.constBegin(); it != objList.constEnd(); ++it) { t << "ADDMOD " << *it << endl; } - t << "SAVE" << endl; + t << "SAVE\n"; t.flush(); file.close(); } @@ -214,13 +214,13 @@ void MingwMakefileGenerator::writeMingwParts(QTextStream &t) t << escapeDependencyPath(cHeader) << ": " << escapeDependencyPath(header) << " " << escapeDependencyPaths(findDependencies(header)).join(" \\\n\t\t") << "\n\t" << mkdir_p_asstring(preCompHeaderOut) - << "\n\t" << "$(CC) -x c-header -c $(CFLAGS) $(INCPATH) -o " << cHeader << " " << header + << "\n\t$(CC) -x c-header -c $(CFLAGS) $(INCPATH) -o " << cHeader << " " << header << endl << endl; QString cppHeader = preCompHeaderOut + Option::dir_sep + "c++"; t << escapeDependencyPath(cppHeader) << ": " << escapeDependencyPath(header) << " " << escapeDependencyPaths(findDependencies(header)).join(" \\\n\t\t") << "\n\t" << mkdir_p_asstring(preCompHeaderOut) - << "\n\t" << "$(CXX) -x c++-header -c $(CXXFLAGS) $(INCPATH) -o " << cppHeader << " " << header + << "\n\t$(CXX) -x c++-header -c $(CXXFLAGS) $(INCPATH) -o " << cppHeader << " " << header << endl << endl; } } @@ -393,19 +393,19 @@ void MingwMakefileGenerator::writeObjectsPart(QTextStream &t) void MingwMakefileGenerator::writeBuildRulesPart(QTextStream &t) { - t << "first: all" << endl; - t << "all: " << escapeDependencyPath(fileFixify(Option::output.fileName())) << " " << valGlue(escapeDependencyPaths(project->values("ALL_DEPS"))," "," "," ") << " $(DESTDIR_TARGET)" << endl << endl; + t << "first: all\n"; + t << "all: " << escapeDependencyPath(fileFixify(Option::output.fileName())) << " " << valGlue(escapeDependencyPaths(project->values("ALL_DEPS"))," "," "," ") << " $(DESTDIR_TARGET)\n\n"; t << "$(DESTDIR_TARGET): " << var("PRE_TARGETDEPS") << " $(OBJECTS) " << var("POST_TARGETDEPS"); if(!project->isEmpty("QMAKE_PRE_LINK")) t << "\n\t" <<var("QMAKE_PRE_LINK"); if(project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") { if (project->values("OBJECTS").count() < var("QMAKE_LINK_OBJECT_MAX").toInt()) { - t << "\n\t" << "$(LIB) $(DESTDIR_TARGET) " << objectsLinkLine << " " ; + t << "\n\t$(LIB) $(DESTDIR_TARGET) " << objectsLinkLine << " " ; } else { t << "\n\t" << objectsLinkLine << " " ; } } else if (project->first("TEMPLATE") != "aux") { - t << "\n\t" << "$(LINKER) $(LFLAGS) " << var("QMAKE_LINK_O_FLAG") << "$(DESTDIR_TARGET) " << objectsLinkLine << " " << " $(LIBS)"; + t << "\n\t$(LINKER) $(LFLAGS) " << var("QMAKE_LINK_O_FLAG") << "$(DESTDIR_TARGET) " << objectsLinkLine << " $(LIBS)"; } if(!project->isEmpty("QMAKE_POST_LINK")) t << "\n\t" <<var("QMAKE_POST_LINK"); @@ -432,7 +432,7 @@ void MingwMakefileGenerator::writeRcFilePart(QTextStream &t) if (!rc_file.isEmpty()) { t << escapeDependencyPath(var("RES_FILE")) << ": " << rc_file << "\n\t" << var("QMAKE_RC") << " -i " << rc_file << " -o " << var("RES_FILE") - << incPathStr << " $(DEFINES)" << endl << endl; + << incPathStr << " $(DEFINES)\n\n"; } } diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index e2c9fdbf37..8af80e572e 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -62,10 +62,10 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t) const ProStringList &qut = project->values("QMAKE_EXTRA_TARGETS"); for (ProStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it) t << *it << " "; - t << "all first clean:" << "\n\t" + t << "all first clean:\n\t" << "@echo \"Some of the required modules (" - << var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"" << "\n\t" - << "@echo \"Skipped.\"" << endl << endl; + << var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"\n\t" + << "@echo \"Skipped.\"\n\n"; writeMakeQmake(t); return true; } @@ -193,7 +193,7 @@ void NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) if(usePCH) { QString precompRule = QString("-c -Yc -Fp%1 -Fo%2").arg(precompPch).arg(precompObj); t << precompObj << ": " << precompH << " " << escapeDependencyPaths(findDependencies(precompH)).join(" \\\n\t\t") - << "\n\t" << "$(CXX) " + precompRule +" $(CXXFLAGS) $(INCPATH) -TP " << precompH << endl << endl; + << "\n\t$(CXX) " + precompRule +" $(CXXFLAGS) $(INCPATH) -TP " << precompH << endl << endl; } } @@ -359,10 +359,10 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t) objDir = ""; for(QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) t << "{" << it.key() << "}" << (*cppit) << "{" << objDir << "}" << Option::obj_ext << "::\n\t" - << var("QMAKE_RUN_CXX_IMP_BATCH").replace(QRegExp("\\$@"), var("OBJECTS_DIR")) << endl << "\t$<" << endl << "<<" << endl << endl; + << var("QMAKE_RUN_CXX_IMP_BATCH").replace(QRegExp("\\$@"), var("OBJECTS_DIR")) << endl << "\t$<\n<<\n\n"; for(QStringList::Iterator cit = Option::c_ext.begin(); cit != Option::c_ext.end(); ++cit) t << "{" << it.key() << "}" << (*cit) << "{" << objDir << "}" << Option::obj_ext << "::\n\t" - << var("QMAKE_RUN_CC_IMP_BATCH").replace(QRegExp("\\$@"), var("OBJECTS_DIR")) << endl << "\t$<" << endl << "<<" << endl << endl; + << var("QMAKE_RUN_CC_IMP_BATCH").replace(QRegExp("\\$@"), var("OBJECTS_DIR")) << endl << "\t$<\n<<\n\n"; } } else { for(QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) @@ -377,14 +377,14 @@ void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t) { const ProString templateName = project->first("TEMPLATE"); - t << "first: all" << endl; - t << "all: " << fileFixify(Option::output.fileName()) << " " << varGlue("ALL_DEPS"," "," "," ") << "$(DESTDIR_TARGET)" << endl << endl; + t << "first: all\n"; + t << "all: " << fileFixify(Option::output.fileName()) << " " << varGlue("ALL_DEPS"," "," "," ") << "$(DESTDIR_TARGET)\n\n"; t << "$(DESTDIR_TARGET): " << var("PRE_TARGETDEPS") << " $(OBJECTS) " << var("POST_TARGETDEPS"); if(!project->isEmpty("QMAKE_PRE_LINK")) t << "\n\t" <<var("QMAKE_PRE_LINK"); if(project->isActiveConfig("staticlib")) { - t << "\n\t" << "$(LIBAPP) $(LIBFLAGS) " << var("QMAKE_LINK_O_FLAG") << "$(DESTDIR_TARGET) @<<" << "\n\t " + t << "\n\t$(LIBAPP) $(LIBFLAGS) " << var("QMAKE_LINK_O_FLAG") << "$(DESTDIR_TARGET) @<<\n\t " << "$(OBJECTS)" << "\n<<"; } else if (templateName != "aux") { @@ -433,7 +433,7 @@ void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t) writeLinkCommand(t, extraLFlags, manifest_res); t << "\n\tif exist " << manifest_bak << " del " << manifest_bak; } else { - t << "\n\t" << "rc.exe /fo" << manifest_res << " " << manifest_rc; + t << "\n\trc.exe /fo" << manifest_res << " " << manifest_rc; t << "\n\t"; writeLinkCommand(t, extraLFlags, manifest_res); } @@ -441,7 +441,7 @@ void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t) // directly embed the manifest in the executable after linking t << "\n\t"; writeLinkCommand(t, extraLFlags); - t << "\n\t" << "mt.exe /nologo /manifest " << manifest + t << "\n\tmt.exe /nologo /manifest " << manifest << " /outputresource:$(DESTDIR_TARGET);" << resourceId; } } else { diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index 08674a323c..fe85efc8ba 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -423,56 +423,56 @@ void Win32MakefileGenerator::processRcFileVar() int rcLang = project->intValue("RC_LANG", 1033); // default: English(USA) int rcCodePage = project->intValue("RC_CODEPAGE", 1200); // default: Unicode - ts << "# if defined(UNDER_CE)" << endl; - ts << "# include <winbase.h>" << endl; - ts << "# else" << endl; - ts << "# include <winver.h>" << endl; - ts << "# endif" << endl; + ts << "# if defined(UNDER_CE)\n"; + ts << "# include <winbase.h>\n"; + ts << "# else\n"; + ts << "# include <winver.h>\n"; + ts << "# endif\n"; ts << endl; if (!rcIcons.isEmpty()) { for (int i = 0; i < rcIcons.size(); ++i) ts << QString("IDI_ICON%1\tICON\tDISCARDABLE\t%2").arg(i + 1).arg(cQuoted(rcIcons[i])) << endl; ts << endl; } - ts << "VS_VERSION_INFO VERSIONINFO" << endl; + ts << "VS_VERSION_INFO VERSIONINFO\n"; ts << "\tFILEVERSION " << QString(versionString).replace(".", ",") << endl; ts << "\tPRODUCTVERSION " << QString(versionString).replace(".", ",") << endl; - ts << "\tFILEFLAGSMASK 0x3fL" << endl; - ts << "#ifdef _DEBUG" << endl; - ts << "\tFILEFLAGS VS_FF_DEBUG" << endl; - ts << "#else" << endl; - ts << "\tFILEFLAGS 0x0L" << endl; - ts << "#endif" << endl; - ts << "\tFILEOS VOS__WINDOWS32" << endl; + ts << "\tFILEFLAGSMASK 0x3fL\n"; + ts << "#ifdef _DEBUG\n"; + ts << "\tFILEFLAGS VS_FF_DEBUG\n"; + ts << "#else\n"; + ts << "\tFILEFLAGS 0x0L\n"; + ts << "#endif\n"; + ts << "\tFILEOS VOS__WINDOWS32\n"; if (project->isActiveConfig("shared")) - ts << "\tFILETYPE VFT_DLL" << endl; + ts << "\tFILETYPE VFT_DLL\n"; else - ts << "\tFILETYPE VFT_APP" << endl; - ts << "\tFILESUBTYPE 0x0L" << endl; - ts << "\tBEGIN" << endl; - ts << "\t\tBLOCK \"StringFileInfo\"" << endl; - ts << "\t\tBEGIN" << endl; + ts << "\tFILETYPE VFT_APP\n"; + ts << "\tFILESUBTYPE 0x0L\n"; + ts << "\tBEGIN\n"; + ts << "\t\tBLOCK \"StringFileInfo\"\n"; + ts << "\t\tBEGIN\n"; ts << "\t\t\tBLOCK \"" << QString("%1%2").arg(rcLang, 4, 16, QLatin1Char('0')).arg(rcCodePage, 4, 16, QLatin1Char('0')) - << "\"" << endl; - ts << "\t\t\tBEGIN" << endl; - ts << "\t\t\t\tVALUE \"CompanyName\", \"" << companyName << "\\0\"" << endl; - ts << "\t\t\t\tVALUE \"FileDescription\", \"" << description << "\\0\"" << endl; - ts << "\t\t\t\tVALUE \"FileVersion\", \"" << versionString << "\\0\"" << endl; - ts << "\t\t\t\tVALUE \"LegalCopyright\", \"" << copyright << "\\0\"" << endl; - ts << "\t\t\t\tVALUE \"OriginalFilename\", \"" << originalName << "\\0\"" << endl; - ts << "\t\t\t\tVALUE \"ProductName\", \"" << productName << "\\0\"" << endl; - ts << "\t\t\t\tVALUE \"ProductVersion\", \"" << versionString << "\\0\"" << endl; - ts << "\t\t\tEND" << endl; - ts << "\t\tEND" << endl; - ts << "\t\tBLOCK \"VarFileInfo\"" << endl; - ts << "\t\tBEGIN" << endl; + << "\"\n"; + ts << "\t\t\tBEGIN\n"; + ts << "\t\t\t\tVALUE \"CompanyName\", \"" << companyName << "\\0\"\n"; + ts << "\t\t\t\tVALUE \"FileDescription\", \"" << description << "\\0\"\n"; + ts << "\t\t\t\tVALUE \"FileVersion\", \"" << versionString << "\\0\"\n"; + ts << "\t\t\t\tVALUE \"LegalCopyright\", \"" << copyright << "\\0\"\n"; + ts << "\t\t\t\tVALUE \"OriginalFilename\", \"" << originalName << "\\0\"\n"; + ts << "\t\t\t\tVALUE \"ProductName\", \"" << productName << "\\0\"\n"; + ts << "\t\t\t\tVALUE \"ProductVersion\", \"" << versionString << "\\0\"\n"; + ts << "\t\t\tEND\n"; + ts << "\t\tEND\n"; + ts << "\t\tBLOCK \"VarFileInfo\"\n"; + ts << "\t\tBEGIN\n"; ts << "\t\t\tVALUE \"Translation\", " << QString("0x%1").arg(rcLang, 4, 16, QLatin1Char('0')) << ", " << QString("%1").arg(rcCodePage, 4) << endl; - ts << "\t\tEND" << endl; - ts << "\tEND" << endl; - ts << "/* End of Version info */" << endl; + ts << "\t\tEND\n"; + ts << "\tEND\n"; + ts << "/* End of Version info */\n"; ts << endl; ts.flush(); @@ -598,7 +598,7 @@ void Win32MakefileGenerator::writeCleanParts(QTextStream &t) } } } - t << "\n\t-$(DEL_FILE) $(DESTDIR_TARGET)" << endl; + t << "\n\t-$(DEL_FILE) $(DESTDIR_TARGET)\n"; { QString ofile = Option::fixPathToTargetOS(fileFixify(Option::output.fileName())); if(!ofile.isEmpty()) @@ -617,7 +617,7 @@ void Win32MakefileGenerator::writeIncPart(QTextStream &t) inc.replace(QRegExp("\\\\$"), ""); inc.replace(QRegExp("\""), ""); if(!inc.isEmpty()) - t << "-I" << "\"" << inc << "\" "; + t << "-I\"" << inc << "\" "; } t << "-I\"" << specdir() << "\"" << endl; @@ -625,14 +625,14 @@ void Win32MakefileGenerator::writeIncPart(QTextStream &t) void Win32MakefileGenerator::writeStandardParts(QTextStream &t) { - t << "####### Compiler, tools and options" << endl << endl; + t << "####### Compiler, tools and options\n\n"; t << "CC = " << var("QMAKE_CC") << endl; t << "CXX = " << var("QMAKE_CXX") << endl; t << "DEFINES = " << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ") << varGlue("DEFINES","-D"," -D","") << endl; - t << "CFLAGS = " << var("QMAKE_CFLAGS") << " $(DEFINES)" << endl; - t << "CXXFLAGS = " << var("QMAKE_CXXFLAGS") << " $(DEFINES)" << endl; + t << "CFLAGS = " << var("QMAKE_CFLAGS") << " $(DEFINES)\n"; + t << "CXXFLAGS = " << var("QMAKE_CXXFLAGS") << " $(DEFINES)\n"; writeIncPart(t); writeLibsPart(t); @@ -659,14 +659,14 @@ void Win32MakefileGenerator::writeStandardParts(QTextStream &t) t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << endl; t << endl; - t << "####### Output directory" << endl << endl; + t << "####### Output directory\n\n"; if(!project->values("OBJECTS_DIR").isEmpty()) t << "OBJECTS_DIR = " << var("OBJECTS_DIR").replace(QRegExp("\\\\$"),"") << endl; else - t << "OBJECTS_DIR = . " << endl; + t << "OBJECTS_DIR = . \n"; t << endl; - t << "####### Files" << endl << endl; + t << "####### Files\n\n"; t << "SOURCES = " << valList(escapeFilePaths(project->values("SOURCES"))) << " " << valList(escapeFilePaths(project->values("GENERATED_SOURCES"))) << endl; @@ -688,21 +688,21 @@ void Win32MakefileGenerator::writeStandardParts(QTextStream &t) t << "QMAKE_TARGET = " << var("QMAKE_ORIG_TARGET") << endl; // The comment is important to maintain variable compatibility with Unix // Makefiles, while not interpreting a trailing-slash as a linebreak - t << "DESTDIR = " << escapeFilePath(destDir) << " #avoid trailing-slash linebreak" << endl; + t << "DESTDIR = " << escapeFilePath(destDir) << " #avoid trailing-slash linebreak\n"; t << "TARGET = " << escapeFilePath(target) << endl; t << "DESTDIR_TARGET = " << escapeFilePath(var("DEST_TARGET")) << endl; t << endl; - t << "####### Implicit rules" << endl << endl; + t << "####### Implicit rules\n\n"; writeImplicitRulesPart(t); - t << "####### Build rules" << endl << endl; + t << "####### Build rules\n\n"; writeBuildRulesPart(t); if(project->isActiveConfig("shared") && !project->values("DLLDESTDIR").isEmpty()) { const ProStringList &dlldirs = project->values("DLLDESTDIR"); for (ProStringList::ConstIterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir) { - t << "\t" << "-$(COPY_FILE) \"$(DESTDIR_TARGET)\" " + t << "\t-$(COPY_FILE) \"$(DESTDIR_TARGET)\" " << Option::fixPathToTargetOS((*dlldir).toQString(), false) << endl; } } @@ -725,8 +725,8 @@ void Win32MakefileGenerator::writeStandardParts(QTextStream &t) dist_files << ui_h; } } - t << "dist:" << "\n\t" - << "$(ZIP) " << var("QMAKE_ORIG_TARGET") << ".zip " << "$(SOURCES) $(DIST) " + t << "dist:\n\t" + << "$(ZIP) " << var("QMAKE_ORIG_TARGET") << ".zip $(SOURCES) $(DIST) " << dist_files.join(' ') << " " << var("TRANSLATIONS") << " "; if(!project->isEmpty("QMAKE_EXTRA_COMPILERS")) { const ProStringList &quc = project->values("QMAKE_EXTRA_COMPILERS"); |