aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2018-05-14 09:44:43 +0200
committerEike Ziller <eike.ziller@qt.io>2018-05-14 09:44:43 +0200
commit2278ebed1e0d290861a5616f4238eeec68607443 (patch)
treee1e475b97c1cbe461c38a502c23afb8c9c49b2b1 /src
parentb67db8bc221a9b2a413cf9748ab0239a17ccb683 (diff)
parent3cfc715d7d33b724ad896c540af4a914d922e9bc (diff)
Merge remote-tracking branch 'origin/4.6' into 4.7
Conflicts: qbs/modules/qtc/qtc.qbs qtcreator.pri src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp Change-Id: I873a2fa112321225e7b478739fc017b01d24ce18
Diffstat (limited to 'src')
-rw-r--r--src/plugins/coreplugin/locator/commandlocator.cpp8
-rw-r--r--src/plugins/coreplugin/menubarfilter.cpp9
-rw-r--r--src/plugins/cpptools/compileroptionsbuilder.cpp12
-rw-r--r--src/plugins/debugger/debuggerplugin.cpp11
-rw-r--r--src/plugins/projectexplorer/abstractmsvctoolchain.cpp18
-rw-r--r--src/plugins/projectexplorer/runconfiguration.cpp6
-rw-r--r--src/plugins/projectexplorer/runconfiguration.h1
7 files changed, 51 insertions, 14 deletions
diff --git a/src/plugins/coreplugin/locator/commandlocator.cpp b/src/plugins/coreplugin/locator/commandlocator.cpp
index 2768dca3a3..7546d0f9b0 100644
--- a/src/plugins/coreplugin/locator/commandlocator.cpp
+++ b/src/plugins/coreplugin/locator/commandlocator.cpp
@@ -31,6 +31,7 @@
#include <utils/stringutils.h>
#include <QAction>
+#include <QTimer>
namespace Core {
@@ -104,8 +105,11 @@ void CommandLocator::accept(LocatorFilterEntry entry,
const int index = entry.internalData.toInt();
QTC_ASSERT(index >= 0 && index < d->commands.size(), return);
QAction *action = d->commands.at(index)->action();
- QTC_ASSERT(action->isEnabled(), return);
- action->trigger();
+ // avoid nested stack trace and blocking locator by delayed triggering
+ QTimer::singleShot(0, action, [action] {
+ if (action->isEnabled())
+ action->trigger();
+ });
}
void CommandLocator::refresh(QFutureInterface<void> &)
diff --git a/src/plugins/coreplugin/menubarfilter.cpp b/src/plugins/coreplugin/menubarfilter.cpp
index 029b8f2253..6a82d8676e 100644
--- a/src/plugins/coreplugin/menubarfilter.cpp
+++ b/src/plugins/coreplugin/menubarfilter.cpp
@@ -36,6 +36,7 @@
#include <QMenuBar>
#include <QPointer>
#include <QRegularExpression>
+#include <QTimer>
using namespace Core::Internal;
using namespace Core;
@@ -77,8 +78,12 @@ void MenuBarFilter::accept(LocatorFilterEntry selection, QString *newText,
Q_UNUSED(newText);
Q_UNUSED(selectionStart);
Q_UNUSED(selectionLength);
- if (auto action = selection.internalData.value<QPointer<QAction>>())
- action->trigger();
+ if (auto action = selection.internalData.value<QPointer<QAction>>()) {
+ QTimer::singleShot(0, action, [action] {
+ if (action->isEnabled())
+ action->trigger();
+ });
+ }
}
void MenuBarFilter::refresh(QFutureInterface<void> &future)
diff --git a/src/plugins/cpptools/compileroptionsbuilder.cpp b/src/plugins/cpptools/compileroptionsbuilder.cpp
index 57f937fb18..d6921b07ff 100644
--- a/src/plugins/cpptools/compileroptionsbuilder.cpp
+++ b/src/plugins/cpptools/compileroptionsbuilder.cpp
@@ -53,6 +53,11 @@ QStringList CompilerOptionsBuilder::build(CppTools::ProjectFile::Kind fileKind,
{
m_options.clear();
+ if (fileKind == ProjectFile::CHeader || fileKind == ProjectFile::CSource) {
+ QTC_ASSERT(m_projectPart.languageVersion <= ProjectPart::LatestCVersion,
+ return QStringList(););
+ }
+
addWordWidth();
addTargetTriple();
addExtraCodeModelFlags();
@@ -118,7 +123,8 @@ void CompilerOptionsBuilder::addExtraCodeModelFlags()
void CompilerOptionsBuilder::enableExceptions()
{
- add(QLatin1String("-fcxx-exceptions"));
+ if (m_projectPart.languageVersion > ProjectPart::LatestCVersion)
+ add(QLatin1String("-fcxx-exceptions"));
add(QLatin1String("-fexceptions"));
}
@@ -286,6 +292,7 @@ void CompilerOptionsBuilder::addOptionsForLanguage(bool checkForBorlandExtension
QStringList opts;
const ProjectPart::LanguageExtensions languageExtensions = m_projectPart.languageExtensions;
const bool gnuExtensions = languageExtensions & ProjectPart::GnuExtensions;
+
switch (m_projectPart.languageVersion) {
case ProjectPart::C89:
opts << (gnuExtensions ? QLatin1String("-std=gnu89") : QLatin1String("-std=c89"));
@@ -471,8 +478,7 @@ QString CompilerOptionsBuilder::includeOption() const
bool CompilerOptionsBuilder::excludeDefineDirective(const ProjectExplorer::Macro &macro) const
{
- // This is a quick fix for QTCREATORBUG-11501.
- // TODO: do a proper fix, see QTCREATORBUG-11709.
+ // TODO: Remove in QtCreator 4.7
if (macro.key == "__cplusplus")
return true;
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index 9f683f3ec8..f92b55d6ea 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -1188,7 +1188,8 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
if (!kit)
kit = guessKitFromAbis(Abi::abisOfBinary(FileName::fromString(executable)));
- auto runControl = new RunControl(nullptr, ProjectExplorer::Constants::DEBUG_RUN_MODE);
+ IDevice::ConstPtr device = DeviceKitInformation::device(kit);
+ auto runControl = new RunControl(device, ProjectExplorer::Constants::DEBUG_RUN_MODE);
auto debugger = new DebuggerRunTool(runControl, kit);
debugger->setInferiorExecutable(executable);
if (pid) {
@@ -1953,7 +1954,8 @@ void DebuggerPluginPrivate::attachCore()
setConfigValue("LastExternalStartScript", dlg.overrideStartScript());
setConfigValue("LastForceLocalCoreFile", dlg.forcesLocalCoreFile());
- auto runControl = new RunControl(nullptr, ProjectExplorer::Constants::DEBUG_RUN_MODE);
+ IDevice::ConstPtr device = DeviceKitInformation::device(dlg.kit());
+ auto runControl = new RunControl(device, ProjectExplorer::Constants::DEBUG_RUN_MODE);
auto debugger = new DebuggerRunTool(runControl, dlg.kit());
debugger->setInferiorExecutable(dlg.localExecutableFile());
debugger->setCoreFileName(dlg.localCoreFile());
@@ -1980,7 +1982,8 @@ void DebuggerPluginPrivate::startRemoteCdbSession()
return;
setConfigValue(connectionKey, dlg.connection());
- auto runControl = new RunControl(nullptr, ProjectExplorer::Constants::DEBUG_RUN_MODE);
+ IDevice::ConstPtr device = DeviceKitInformation::device(kit);
+ auto runControl = new RunControl(device, ProjectExplorer::Constants::DEBUG_RUN_MODE);
auto debugger = new DebuggerRunTool(runControl, kit);
debugger->setStartMode(AttachToRemoteServer);
debugger->setCloseMode(KillAtClose);
@@ -2038,7 +2041,7 @@ void DebuggerPluginPrivate::attachToRunningApplication()
if (device->type() == PE::DESKTOP_DEVICE_TYPE) {
attachToRunningProcess(kit, process, false);
} else {
- auto runControl = new RunControl(nullptr, ProjectExplorer::Constants::DEBUG_RUN_MODE);
+ auto runControl = new RunControl(device, ProjectExplorer::Constants::DEBUG_RUN_MODE);
auto debugger = new RemoteAttachRunner(runControl, kit, process.pid);
debugger->startRunControl();
}
diff --git a/src/plugins/projectexplorer/abstractmsvctoolchain.cpp b/src/plugins/projectexplorer/abstractmsvctoolchain.cpp
index 12c5a15316..fd2948c458 100644
--- a/src/plugins/projectexplorer/abstractmsvctoolchain.cpp
+++ b/src/plugins/projectexplorer/abstractmsvctoolchain.cpp
@@ -133,15 +133,27 @@ ToolChain::CompilerFlags AbstractMsvcToolChain::compilerFlags(const QStringList
if (cxxflags.contains(QLatin1String("/Za")))
flags &= ~MicrosoftExtensions;
+ bool cLanguage = (language() == ProjectExplorer::Constants::C_LANGUAGE_ID);
+
switch (m_abi.osFlavor()) {
case Abi::WindowsMsvc2010Flavor:
- case Abi::WindowsMsvc2012Flavor: flags |= StandardCxx11;
+ case Abi::WindowsMsvc2012Flavor:
+ if (cLanguage)
+ flags |= StandardC99;
+ else
+ flags |= StandardCxx11;
break;
case Abi::WindowsMsvc2013Flavor:
- case Abi::WindowsMsvc2015Flavor: flags |= StandardCxx14;
+ case Abi::WindowsMsvc2015Flavor:
+ if (cLanguage)
+ flags |= StandardC99;
+ else
+ flags |= StandardCxx14;
break;
case Abi::WindowsMsvc2017Flavor:
- if (cxxflags.contains("/std:c++17") || cxxflags.contains("/std:c++latest"))
+ if (cLanguage)
+ flags |= StandardC11;
+ else if (cxxflags.contains("/std:c++17") || cxxflags.contains("/std:c++latest"))
flags |= StandardCxx17;
else
flags |= StandardCxx14;
diff --git a/src/plugins/projectexplorer/runconfiguration.cpp b/src/plugins/projectexplorer/runconfiguration.cpp
index a77478a52c..c29e1807e6 100644
--- a/src/plugins/projectexplorer/runconfiguration.cpp
+++ b/src/plugins/projectexplorer/runconfiguration.cpp
@@ -921,6 +921,12 @@ RunControl::RunControl(RunConfiguration *runConfiguration, Core::Id mode) :
#endif
}
+RunControl::RunControl(const IDevice::ConstPtr &device, Core::Id mode)
+ : RunControl(nullptr, mode)
+{
+ d->device = device;
+}
+
RunControl::~RunControl()
{
#ifdef WITH_JOURNALD
diff --git a/src/plugins/projectexplorer/runconfiguration.h b/src/plugins/projectexplorer/runconfiguration.h
index 8a918a9773..292ac59d2e 100644
--- a/src/plugins/projectexplorer/runconfiguration.h
+++ b/src/plugins/projectexplorer/runconfiguration.h
@@ -461,6 +461,7 @@ class PROJECTEXPLORER_EXPORT RunControl : public QObject
public:
RunControl(RunConfiguration *runConfiguration, Core::Id mode);
+ RunControl(const IDevice::ConstPtr &device, Core::Id mode);
~RunControl() override;
void initiateStart();