From a0b5d6e60f96359d88352e0b1c000678cdc80988 Mon Sep 17 00:00:00 2001 From: Jani Heikkinen Date: Thu, 4 Apr 2019 15:05:16 +0300 Subject: Revert "Let "qmake -install qinstall" set default permissions 0644 and 0755" This reverts commit 3cdf46059a668f588fe237aa881c300dd76cbf9e. It seems change is causing regression & is reverted now to be able to proceed with releases Task-number: QTBUG-74912 Change-Id: Ib2365b96ee98fbbcc8853cc7f8726c157c1913a7 Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Joerg Bornemann --- qmake/main.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'qmake') diff --git a/qmake/main.cpp b/qmake/main.cpp index e5f7032554..a4ef79227b 100644 --- a/qmake/main.cpp +++ b/qmake/main.cpp @@ -260,25 +260,31 @@ static int installFile(const QString &source, const QString &target, bool exe = return 3; } - QFileDevice::Permissions targetPermissions = QFileDevice::ReadOwner | QFileDevice::WriteOwner - | QFileDevice::ReadUser | QFileDevice::WriteUser - | QFileDevice::ReadGroup | QFileDevice::ReadOther; if (exe) { - targetPermissions |= QFileDevice::ExeOwner | QFileDevice::ExeUser | - QFileDevice::ExeGroup | QFileDevice::ExeOther; - } - if (!targetFile.setPermissions(targetPermissions)) { - fprintf(stderr, "Error setting permissions on %s: %s\n", - qPrintable(target), qPrintable(targetFile.errorString())); - return 3; + if (!targetFile.setPermissions(sourceFile.permissions() | QFileDevice::ExeOwner | QFileDevice::ExeUser | + QFileDevice::ExeGroup | QFileDevice::ExeOther)) { + fprintf(stderr, "Error setting execute permissions on %s: %s\n", + qPrintable(target), qPrintable(targetFile.errorString())); + return 3; + } } // Copy file times QString error; +#ifdef Q_OS_WIN + const QFile::Permissions permissions = targetFile.permissions(); + const bool readOnly = !(permissions & QFile::WriteUser); + if (readOnly) + targetFile.setPermissions(permissions | QFile::WriteUser); +#endif if (!IoUtils::touchFile(target, sourceFile.fileName(), &error)) { fprintf(stderr, "%s", qPrintable(error)); return 3; } +#ifdef Q_OS_WIN + if (readOnly) + targetFile.setPermissions(permissions); +#endif return 0; } -- cgit v1.2.3 From 5f7b0e5ff4410a596168ee667b71afaa7b18eee8 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 4 Apr 2019 16:47:29 +0200 Subject: qmake: Remove dead code Silences a clang warning Change-Id: I5ade49326afcce964ffb5c24b5708977950d123e Reviewed-by: Joerg Bornemann --- qmake/generators/mac/pbuilder_pbx.cpp | 2 +- qmake/generators/makefile.cpp | 2 +- qmake/generators/unix/unixmake2.cpp | 2 +- qmake/meta.cpp | 7 ------- qmake/meta.h | 2 -- 5 files changed, 3 insertions(+), 12 deletions(-) (limited to 'qmake') diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index 5407ed6c69..07832041a7 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -856,7 +856,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) QString lib_file = QMakeMetaInfo::checkLib(Option::normalizePath( (*lit) + Option::dir_sep + lib + Option::prl_ext)); if (!lib_file.isEmpty()) { - QMakeMetaInfo libinfo(project); + QMakeMetaInfo libinfo; if(libinfo.readLib(lib_file)) { if(!libinfo.isEmpty("QMAKE_PRL_TARGET")) { library = (*lit) + Option::dir_sep + libinfo.first("QMAKE_PRL_TARGET"); diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index ab261d02f1..e9dccf0c46 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -912,7 +912,7 @@ MakefileGenerator::processPrlFileCore(QString &origFile, const QStringRef &origN const QString meta_file = QMakeMetaInfo::checkLib(fixedFile); if (meta_file.isEmpty()) return false; - QMakeMetaInfo libinfo(project); + QMakeMetaInfo libinfo; debug_msg(1, "Processing PRL file: %s", meta_file.toLatin1().constData()); if (!libinfo.readLib(meta_file)) { fprintf(stderr, "Error processing meta file %s\n", meta_file.toLatin1().constData()); diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 4b33713a75..24215ae7b0 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -407,7 +407,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) const ProStringList &l = project->values("QMAKE_PRL_INTERNAL_FILES"); ProStringList::ConstIterator it; for(it = l.begin(); it != l.end(); ++it) { - QMakeMetaInfo libinfo(project); + QMakeMetaInfo libinfo; if (libinfo.readLib((*it).toQString()) && !libinfo.isEmpty("QMAKE_PRL_BUILD_DIR")) { ProString dir; int slsh = (*it).lastIndexOf(Option::dir_sep); diff --git a/qmake/meta.cpp b/qmake/meta.cpp index 2e8759b8ba..c5c14d9b56 100644 --- a/qmake/meta.cpp +++ b/qmake/meta.cpp @@ -35,13 +35,6 @@ QT_BEGIN_NAMESPACE QHash QMakeMetaInfo::cache_vars; -QMakeMetaInfo::QMakeMetaInfo(QMakeProject *_conf) - : conf(_conf) -{ - -} - - bool QMakeMetaInfo::readLib(const QString &meta_file) { diff --git a/qmake/meta.h b/qmake/meta.h index 4721085fd2..5f41a37df0 100644 --- a/qmake/meta.h +++ b/qmake/meta.h @@ -41,11 +41,9 @@ class QMakeProject; class QMakeMetaInfo { - QMakeProject *conf; ProValueMap vars; static QHash cache_vars; public: - QMakeMetaInfo(QMakeProject *_conf); // These functions expect the path to be normalized static QString checkLib(const QString &lib); -- cgit v1.2.3 From 8cd0a39dd79a48697c181c3754cada4ffd832214 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 5 Apr 2019 09:53:22 +0200 Subject: qmake: Remove special-handling of cl.exe's -Gm option The comment hints that it's fixing an issue in Visual Studio 2013, which we don't support anymore. In all supported Visual Studio Versions -Gm is actually deprecated anyhow, and not set anymore by default. So I guess it's safe to remove the special handling here. Change-Id: I2e8ff85350ba651d9a763aabba7b6494ba88d82e Reviewed-by: Joerg Bornemann --- qmake/generators/win32/msvc_nmake.cpp | 8 -------- qmake/generators/win32/msvc_vcproj.cpp | 10 ---------- 2 files changed, 18 deletions(-) (limited to 'qmake') diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index f295705e2e..af6d3c5aff 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -171,15 +171,7 @@ QString NmakeMakefileGenerator::var(const ProKey &value) const .arg(precompH_f, precompH_f, escapeFilePath(isRunC ? precompPchC : precompPch)); QString p = MakefileGenerator::var(value); p.replace(QLatin1String("-c"), precompRule); - // Cannot use -Gm with -FI & -Yu, as this gives an - // internal compiler error, on the newer compilers - // ### work-around for a VS 2003 bug. Move to some prf file or remove completely. - p.remove("-Gm"); return p; - } else if (value == "QMAKE_CXXFLAGS") { - // Remove internal compiler error option - // ### work-around for a VS 2003 bug. Move to some prf file or remove completely. - return MakefileGenerator::var(value).remove("-Gm"); } } diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 06a96f7538..fd53ec2a6e 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -1063,16 +1063,6 @@ void VcprojGenerator::initCompilerTool() conf.compiler.PrecompiledHeaderFile = "$(IntDir)\\" + precompPch; conf.compiler.PrecompiledHeaderThrough = project->first("PRECOMPILED_HEADER").toQString(); conf.compiler.ForcedIncludeFiles = project->values("PRECOMPILED_HEADER").toQStringList(); - - if (conf.CompilerVersion <= NET2003) { - // Minimal build option triggers an Internal Compiler Error - // when used in conjunction with /FI and /Yu, so remove it - // ### work-around for a VS 2003 bug. Move to some prf file or remove completely. - project->values("QMAKE_CFLAGS_DEBUG").removeAll("-Gm"); - project->values("QMAKE_CFLAGS_DEBUG").removeAll("/Gm"); - project->values("QMAKE_CXXFLAGS_DEBUG").removeAll("-Gm"); - project->values("QMAKE_CXXFLAGS_DEBUG").removeAll("/Gm"); - } } conf.compiler.parseOptions(project->values("QMAKE_CXXFLAGS")); -- cgit v1.2.3 From eaf20420f8a4d72c804a9d3725c3e294b34c78c8 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 3 Apr 2019 12:59:51 +0200 Subject: Fix precompiled headers with clang-cl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Clang-cl couldn't find the header given to it by -FI when it isn't in any of the included directories. Additionally clang-cl 8 has a bug with exported templated classes with inline methods that causes it to have missing symbols at link time. We work around this. Fixes: QTBUG-74563 Change-Id: I7becf05fa8edb07bd4cefe12bee3737e5e1dfa14 Reviewed-by: Yuhang Zhao <2546789017@qq.com> Reviewed-by: MÃ¥rten Nordheim Reviewed-by: Kai Koehne --- qmake/generators/win32/msvc_nmake.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'qmake') diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index af6d3c5aff..63d89a5388 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -165,10 +165,14 @@ QString NmakeMakefileGenerator::var(const ProKey &value) const || value == "QMAKE_RUN_CXX_IMP" || value == "QMAKE_RUN_CXX"); if ((isRunCpp && usePCH) || (isRunC && usePCHC)) { - QFileInfo precompHInfo(fileInfo(precompH)); - QString precompH_f = escapeFilePath(precompHInfo.fileName()); + QString precompH_f = escapeFilePath(fileFixify(precompH, FileFixifyBackwards)); QString precompRule = QString("-c -FI%1 -Yu%2 -Fp%3") .arg(precompH_f, precompH_f, escapeFilePath(isRunC ? precompPchC : precompPch)); + // ### For clang_cl 8 we force inline methods to be compiled here instead + // linking them from a pch.o file. We do this by pretending we are also doing + // the pch.o generation step. + if (project->isActiveConfig("clang_cl")) + precompRule += QString(" -Xclang -building-pch-with-obj"); QString p = MakefileGenerator::var(value); p.replace(QLatin1String("-c"), precompRule); return p; @@ -230,7 +234,10 @@ void NmakeMakefileGenerator::init() precompObj = var("PRECOMPILED_DIR") + project->first("TARGET") + "_pch" + Option::obj_ext; precompPch = var("PRECOMPILED_DIR") + project->first("TARGET") + "_pch.pch"; // Add linking of precompObj (required for whole precompiled classes) - project->values("OBJECTS") += precompObj; + // ### For clang_cl we currently let inline methods be generated in the normal objects, + // since the PCH object is buggy (as of clang 8.0.0) + if (!project->isActiveConfig("clang_cl")) + project->values("OBJECTS") += precompObj; // Add pch file to cleanup project->values("QMAKE_CLEAN") += precompPch; // Return to variable pool @@ -240,7 +247,8 @@ void NmakeMakefileGenerator::init() if (usePCHC) { precompObjC = var("PRECOMPILED_DIR") + project->first("TARGET") + "_pch_c" + Option::obj_ext; precompPchC = var("PRECOMPILED_DIR") + project->first("TARGET") + "_pch_c.pch"; - project->values("OBJECTS") += precompObjC; + if (!project->isActiveConfig("clang_cl")) + project->values("OBJECTS") += precompObjC; project->values("QMAKE_CLEAN") += precompPchC; project->values("PRECOMPILED_OBJECT_C") = ProStringList(precompObjC); project->values("PRECOMPILED_PCH_C") = ProStringList(precompPchC); -- cgit v1.2.3