From d70bdaf450f61b2d6f27bfbb8bbfa170b02d59aa Mon Sep 17 00:00:00 2001 From: Sune Vuorela Date: Tue, 3 Feb 2015 08:34:38 +0100 Subject: [PATCH] Make Qt Creator build with -Werror=date-time As a part of making the Qt Creator build reproducible, ensure that the build time isn't by default encoded into the binaries. Change-Id: I92bc3c2e832d5397bc1e2599214ef3ba911fed0b Reviewed-by: Eike Ziller --- src/libs/qtcreatorcdbext/qtcreatorcdbextension.cpp | 6 +++--- src/plugins/coreplugin/coreplugin.pro | 4 ++++ src/plugins/coreplugin/versiondialog.cpp | 13 +++++++++---- .../qtcreatorcrashhandler/crashhandlerdialog.cpp | 4 ++-- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/libs/qtcreatorcdbext/qtcreatorcdbextension.cpp b/src/libs/qtcreatorcdbext/qtcreatorcdbextension.cpp index d66854b8524..f67c871424b 100644 --- a/src/libs/qtcreatorcdbext/qtcreatorcdbextension.cpp +++ b/src/libs/qtcreatorcdbext/qtcreatorcdbextension.cpp @@ -279,8 +279,8 @@ extern "C" HRESULT CALLBACK pid(CIDebugClient *client, PCSTR args) int token; commandTokens(args, &token); - dprintf("Qt Creator CDB extension version 3.3 %d bit built %s.\n", - sizeof(void *) * 8, __DATE__); + dprintf("Qt Creator CDB extension version 3.3 %d bit.\n", + sizeof(void *) * 8); if (const ULONG pid = currentProcessId(client)) ExtensionContext::instance().report('R', token, 0, "pid", "%u", pid); else @@ -940,7 +940,7 @@ extern "C" HRESULT CALLBACK setparameter(CIDebugClient *, PCSTR args) extern "C" HRESULT CALLBACK help(CIDebugClient *, PCSTR) { std::ostringstream str; - str << "### Qt Creator CDB extension built " << __DATE__ << "\n\n"; + str << "### Qt Creator CDB extension" << "\n\n"; const size_t commandCount = sizeof(commandDescriptions)/sizeof(CommandDescription); std::copy(commandDescriptions, commandDescriptions + commandCount, diff --git a/src/plugins/coreplugin/coreplugin.pro b/src/plugins/coreplugin/coreplugin.pro index 1ecac8020a8..08f9f34a5a3 100644 --- a/src/plugins/coreplugin/coreplugin.pro +++ b/src/plugins/coreplugin/coreplugin.pro @@ -5,6 +5,10 @@ QT += help \ script \ sql +# embedding build time information prevents repeatedly binary exact versions from same source code +isEmpty(QTC_SHOW_BUILD_DATE): QTC_SHOW_BUILD_DATE = $$(QTC_SHOW_BUILD_DATE) +!isEmpty(QTC_SHOW_BUILD_DATE): DEFINES += QTC_SHOW_BUILD_DATE + include(../../qtcreatorplugin.pri) win32-msvc*:QMAKE_CXXFLAGS += -wd4251 -wd4290 -wd4250 SOURCES += corejsextensions.cpp \ diff --git a/src/plugins/coreplugin/versiondialog.cpp b/src/plugins/coreplugin/versiondialog.cpp index 4511850c9a4..7d52bacde6f 100644 --- a/src/plugins/coreplugin/versiondialog.cpp +++ b/src/plugins/coreplugin/versiondialog.cpp @@ -63,23 +63,28 @@ VersionDialog::VersionDialog(QWidget *parent) //: This gets conditionally inserted as argument %8 into the description string. ideRev = tr("From revision %1
").arg(QString::fromLatin1(Constants::IDE_REVISION_STR).left(10)); #endif + QString buildDateInfo; +#ifdef QTC_SHOW_BUILD_DATE + buildDateInfo = tr("Built on %1 %2
").arg(QLatin1String(__DATE__), QLatin1String(__TIME__)); +#endif + const QString description = tr( "

%1

" "%2
" "
" - "Built on %3 at %4
" + "%3" "
" - "%5" + "%4" "
" - "Copyright 2008-%6 %7. All rights reserved.
" + "Copyright 2008-%5 %6. All rights reserved.
" "
" "The program is provided AS IS with NO WARRANTY OF ANY KIND, " "INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A " "PARTICULAR PURPOSE.
") .arg(ICore::versionString(), ICore::buildCompatibilityString(), - QLatin1String(__DATE__), QLatin1String(__TIME__), + buildDateInfo, ideRev, QLatin1String(Constants::IDE_YEAR), QLatin1String(Constants::IDE_AUTHOR)); diff --git a/src/tools/qtcreatorcrashhandler/crashhandlerdialog.cpp b/src/tools/qtcreatorcrashhandler/crashhandlerdialog.cpp index a9377f3ca1c..5bbfc9d1b2b 100644 --- a/src/tools/qtcreatorcrashhandler/crashhandlerdialog.cpp +++ b/src/tools/qtcreatorcrashhandler/crashhandlerdialog.cpp @@ -138,9 +138,9 @@ void CrashHandlerDialog::setApplicationInfo(const QString &signalName) revision = QLatin1Char(' ') + tr("from revision %1").arg(QString::fromLatin1(Core::Constants::IDE_REVISION_STR).left(10)); #endif const QString versionInformation = tr( - "%1 %2%3, built on %4 at %5, based on Qt %6 (%7 bit)\n") + "%1 %2%3, based on Qt %4 (%5 bit)\n") .arg(ideName, QLatin1String(Core::Constants::IDE_VERSION_LONG), revision, - QLatin1String(__DATE__), QLatin1String(__TIME__), QLatin1String(QT_VERSION_STR), + QLatin1String(QT_VERSION_STR), QString::number(QSysInfo::WordSize)); m_ui->debugInfoEdit->append(versionInformation); }