Updated Xcode build for using standard library.

Also trying to use g++-6 for travis build.
This commit is contained in:
John Preston 2017-02-21 17:37:53 +03:00
parent ffc557a0f9
commit 755325fef3
24 changed files with 57 additions and 35 deletions

View file

@ -35,8 +35,8 @@ addons:
- dpatch - dpatch
- equivs - equivs
- fakeroot - fakeroot
- g++-4.9 - g++-6
- gcc-4.9 - gcc-6
- git - git
- gnome-common - gnome-common
- gobject-introspection - gobject-introspection
@ -62,8 +62,8 @@ addons:
before_install: before_install:
- "export TRAVIS_COMMIT_MSG=\"$(git log --format=%B --no-merges -n 1)\"" - "export TRAVIS_COMMIT_MSG=\"$(git log --format=%B --no-merges -n 1)\""
- .travis/check.sh - .travis/check.sh
- export CXX="g++-4.9" CC="gcc-4.9" - export CXX="g++-6" CC="gcc-6"
- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.9 - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6
- sudo update-alternatives --config gcc - sudo update-alternatives --config gcc
- g++ --version - g++ --version

View file

@ -155,7 +155,7 @@ QPixmap BoxContent::grabInnerCache() {
auto result = myGrab(this, _scroll->geometry()); auto result = myGrab(this, _scroll->geometry());
if (isTopShadowVisible) _topShadow->show(); if (isTopShadowVisible) _topShadow->show();
if (isBottomShadowVisible) _bottomShadow->show(); if (isBottomShadowVisible) _bottomShadow->show();
return std::move(result); return result;
} }
void BoxContent::resizeEvent(QResizeEvent *e) { void BoxContent::resizeEvent(QResizeEvent *e) {

View file

@ -425,7 +425,7 @@ QPixmap StickersBox::grabContentCache() {
_tabs->hide(); _tabs->hide();
auto result = grabInnerCache(); auto result = grabInnerCache();
_tabs->show(); _tabs->show();
return std::move(result); return result;
} }
void StickersBox::installSet(uint64 setId) { void StickersBox::installSet(uint64 setId) {

View file

@ -26,6 +26,21 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include <ctime> #include <ctime>
#include "core/build_config.h" #include "core/build_config.h"
#if defined COMPILER_CLANG || defined COMPILER_GCC
namespace std {
template <typename T>
constexpr std::add_const_t<T>& as_const(T& t) noexcept {
return t;
}
template <typename T>
void as_const(const T&&) = delete;
} // namespace std
#endif // COMPILER_CLANG || COMPILER_GCC
#include "core/ordered_set.h" #include "core/ordered_set.h"
//using uchar = unsigned char; // Qt has uchar //using uchar = unsigned char; // Qt has uchar

View file

@ -21,6 +21,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#pragma once #pragma once
#include <vector> #include <vector>
#include <deque>
#include "core/type_traits.h" #include "core/type_traits.h"
namespace base { namespace base {
@ -285,7 +286,7 @@ private:
UnregisterActiveObservable(&this->_callHandlers); UnregisterActiveObservable(&this->_callHandlers);
} }
std::vector<EventType> _events; std::deque<EventType> _events;
bool _handling = false; bool _handling = false;
}; };
@ -425,9 +426,10 @@ protected:
void unsubscribe(int index) { void unsubscribe(int index) {
if (!index) return; if (!index) return;
t_assert(index > 0 && index <= _subscriptions.size()); auto count = static_cast<int>(_subscriptions.size());
t_assert(index > 0 && index <= count);
_subscriptions[index - 1].destroy(); _subscriptions[index - 1].destroy();
if (index == _subscriptions.size()) { if (index == count) {
while (index > 0 && !_subscriptions[--index]) { while (index > 0 && !_subscriptions[--index]) {
_subscriptions.pop_back(); _subscriptions.pop_back();
} }

View file

@ -215,8 +215,8 @@ void DialogsInner::paintRegion(Painter &p, const QRegion &region, bool paintingO
} }
} else if (_state == FilteredState || _state == SearchedState) { } else if (_state == FilteredState || _state == SearchedState) {
if (!_hashtagResults.empty()) { if (!_hashtagResults.empty()) {
int32 from = floorclamp(r.y(), st::mentionHeight, 0, _hashtagResults.size()); auto from = floorclamp(r.y(), st::mentionHeight, 0, _hashtagResults.size());
int32 to = ceilclamp(r.y() + r.height(), st::mentionHeight, 0, _hashtagResults.size()); auto to = ceilclamp(r.y() + r.height(), st::mentionHeight, 0, _hashtagResults.size());
p.translate(0, from * st::mentionHeight); p.translate(0, from * st::mentionHeight);
if (from < _hashtagResults.size()) { if (from < _hashtagResults.size()) {
auto htagwidth = fullWidth - st::dialogsPadding.x() * 2; auto htagwidth = fullWidth - st::dialogsPadding.x() * 2;

View file

@ -150,7 +150,7 @@ QPixmap ItemBase::getResultContactAvatar(int width, int height) const {
if (result.height() != height * cIntRetinaFactor()) { if (result.height() != height * cIntRetinaFactor()) {
result = result.scaled(QSize(width, height) * cIntRetinaFactor(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); result = result.scaled(QSize(width, height) * cIntRetinaFactor(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
} }
return std::move(result); return result;
} }
return QPixmap(); return QPixmap();
} }

View file

@ -694,7 +694,7 @@ Widget::Step::CoverAnimation Widget::Step::prepareCoverAnimation(Step *after) {
result.description = Ui::FlatLabel::CrossFade(after->_description->entity(), _description->entity(), st::introBg, after->_description->pos(), _description->pos()); result.description = Ui::FlatLabel::CrossFade(after->_description->entity(), _description->entity(), st::introBg, after->_description->pos(), _description->pos());
result.contentSnapshotWas = after->prepareContentSnapshot(); result.contentSnapshotWas = after->prepareContentSnapshot();
result.contentSnapshotNow = prepareContentSnapshot(); result.contentSnapshotNow = prepareContentSnapshot();
return std::move(result); return result;
} }
QPixmap Widget::Step::prepareContentSnapshot() { QPixmap Widget::Step::prepareContentSnapshot() {

View file

@ -2217,10 +2217,10 @@ void MainWidget::ui_showPeerHistory(quint64 peerId, qint32 showAtMsgId, Ui::Show
} }
_stack.clear(); _stack.clear();
} else { } else {
for (int i = 0, s = _stack.size(); i < s; ++i) { for (auto i = 0, s = int(_stack.size()); i < s; ++i) {
if (_stack.at(i)->type() == HistoryStackItem && _stack.at(i)->peer->id == peerId) { if (_stack.at(i)->type() == HistoryStackItem && _stack.at(i)->peer->id == peerId) {
foundInStack = true; foundInStack = true;
while (_stack.size() > i + 1) { while (int(_stack.size()) > i + 1) {
clearBotStartToken(_stack.back()->peer); clearBotStartToken(_stack.back()->peer);
_stack.pop_back(); _stack.pop_back();
} }

View file

@ -115,7 +115,7 @@ QImage PreviewWindowSystemButton(QColor inner, QColor border) {
p.drawEllipse(QRectF(0.5, 0.5, fullSize - 1., fullSize - 1.)); p.drawEllipse(QRectF(0.5, 0.5, fullSize - 1., fullSize - 1.));
} }
result.setDevicePixelRatio(cRetinaFactor()); result.setDevicePixelRatio(cRetinaFactor());
return std::move(result); return result;
} }
void PreviewWindowTitle(Painter &p, const style::palette &palette, QRect body, int titleHeight, int outerWidth) { void PreviewWindowTitle(Painter &p, const style::palette &palette, QRect body, int titleHeight, int outerWidth) {

View file

@ -3317,7 +3317,7 @@ QImage EmojiPan::grabForPanelAnimation() {
_inPanelGrab = true; _inPanelGrab = true;
render(&result); render(&result);
_inPanelGrab = false; _inPanelGrab = false;
return std::move(result); return result;
} }
void EmojiPan::hideAnimated() { void EmojiPan::hideAnimated() {

View file

@ -99,7 +99,7 @@ QImage RoundShadowAnimation::cloneImage(const style::icon &source) {
Painter p(&result); Painter p(&result);
source.paint(p, 0, 0, source.width()); source.paint(p, 0, 0, source.width());
} }
return std::move(result); return result;
} }
void RoundShadowAnimation::paintCorner(Corner &corner, int left, int top) { void RoundShadowAnimation::paintCorner(Corner &corner, int left, int top) {

View file

@ -207,7 +207,7 @@ QImage RippleAnimation::maskByDrawer(QSize size, bool filled, base::lambda<void(
p.setBrush(QColor(255, 255, 255)); p.setBrush(QColor(255, 255, 255));
drawer(p); drawer(p);
} }
return std::move(result); return result;
} }
QImage RippleAnimation::rectMask(QSize size) { QImage RippleAnimation::rectMask(QSize size) {

View file

@ -266,7 +266,7 @@ QImage prepareColored(style::color add, QImage image) {
pix[i + 3] = uchar(a + ((aca * (0xFF - a)) >> 16)); pix[i + 3] = uchar(a + ((aca * (0xFF - a)) >> 16));
} }
} }
return std::move(image); return image;
} }
QImage prepareOpaque(QImage image) { QImage prepareOpaque(QImage image) {
@ -285,7 +285,7 @@ QImage prepareOpaque(QImage image) {
ints += addPerLine; ints += addPerLine;
} }
} }
return std::move(image); return image;
} }
QImage prepare(QImage img, int w, int h, Images::Options options, int outerw, int outerh) { QImage prepare(QImage img, int w, int h, Images::Options options, int outerw, int outerh) {
@ -337,7 +337,7 @@ QImage prepare(QImage img, int w, int h, Images::Options options, int outerw, in
t_assert(!img.isNull()); t_assert(!img.isNull());
} }
img.setDevicePixelRatio(cRetinaFactor()); img.setDevicePixelRatio(cRetinaFactor());
return std::move(img); return img;
} }
} // namespace Images } // namespace Images

View file

@ -71,7 +71,7 @@ inline QImage colorizeImage(const QImage &src, QColor c, QRect srcRect = QRect()
if (srcRect.isNull()) srcRect = src.rect(); if (srcRect.isNull()) srcRect = src.rect();
auto result = QImage(srcRect.size(), QImage::Format_ARGB32_Premultiplied); auto result = QImage(srcRect.size(), QImage::Format_ARGB32_Premultiplied);
colorizeImage(src, c, &result, srcRect); colorizeImage(src, c, &result, srcRect);
return std::move(result); return result;
} }
inline QImage colorizeImage(const QImage &src, const color &c, QRect srcRect = QRect()) { inline QImage colorizeImage(const QImage &src, const color &c, QRect srcRect = QRect()) {

View file

@ -223,20 +223,20 @@ QImage MonoIcon::instance(QColor colorOverride, DBIScale scale) const {
} else { } else {
colorizeImage(_maskImage, colorOverride, &result); colorizeImage(_maskImage, colorOverride, &result);
} }
return std::move(result); return result;
} }
auto size = readGeneratedSize(_mask, scale); auto size = readGeneratedSize(_mask, scale);
if (!size.isEmpty()) { if (!size.isEmpty()) {
auto result = QImage(size * cIntRetinaFactor(), QImage::Format_ARGB32_Premultiplied); auto result = QImage(size * cIntRetinaFactor(), QImage::Format_ARGB32_Premultiplied);
result.setDevicePixelRatio(cRetinaFactor()); result.setDevicePixelRatio(cRetinaFactor());
result.fill(colorOverride); result.fill(colorOverride);
return std::move(result); return result;
} }
auto mask = createIconMask(_mask, scale); auto mask = createIconMask(_mask, scale);
auto result = QImage(mask.size(), QImage::Format_ARGB32_Premultiplied); auto result = QImage(mask.size(), QImage::Format_ARGB32_Premultiplied);
result.setDevicePixelRatio(cRetinaFactor()); result.setDevicePixelRatio(cRetinaFactor());
colorizeImage(mask, colorOverride, &result); colorizeImage(mask, colorOverride, &result);
return std::move(result); return result;
} }
void MonoIcon::ensureLoaded() const { void MonoIcon::ensureLoaded() const {

View file

@ -77,7 +77,7 @@ QPixmap myGrab(TWidget *target, QRect rect, QColor bg) {
target->render(&result, QPoint(0, 0), rect, QWidget::DrawChildren | QWidget::IgnoreMask); target->render(&result, QPoint(0, 0), rect, QWidget::DrawChildren | QWidget::IgnoreMask);
target->grabFinish(); target->grabFinish();
return std::move(result); return result;
} }
QImage myGrabImage(TWidget *target, QRect rect, QColor bg) { QImage myGrabImage(TWidget *target, QRect rect, QColor bg) {
@ -94,7 +94,7 @@ QImage myGrabImage(TWidget *target, QRect rect, QColor bg) {
target->render(&result, QPoint(0, 0), rect, QWidget::DrawChildren | QWidget::IgnoreMask); target->render(&result, QPoint(0, 0), rect, QWidget::DrawChildren | QWidget::IgnoreMask);
target->grabFinish(); target->grabFinish();
return std::move(result); return result;
} }
void sendSynteticMouseEvent(QWidget *widget, QEvent::Type type, Qt::MouseButton button, const QPoint &globalPoint) { void sendSynteticMouseEvent(QWidget *widget, QEvent::Type type, Qt::MouseButton button, const QPoint &globalPoint) {

View file

@ -274,7 +274,7 @@ QImage InnerDropdown::grabForPanelAnimation() {
} }
} }
} }
return std::move(result); return result;
} }
void InnerDropdown::opacityAnimationCallback() { void InnerDropdown::opacityAnimationCallback() {

View file

@ -609,7 +609,7 @@ std::unique_ptr<CrossFadeAnimation> FlatLabel::CrossFade(FlatLabel *from, FlatLa
result.lineAddTop = addedHeight / 2; result.lineAddTop = addedHeight / 2;
result.lineHeight += addedHeight; result.lineHeight += addedHeight;
} }
return std::move(result); return result;
}; };
auto was = prepareData(from); auto was = prepareData(from);
auto now = prepareData(to); auto now = prepareData(to);
@ -643,13 +643,13 @@ std::unique_ptr<CrossFadeAnimation> FlatLabel::CrossFade(FlatLabel *from, FlatLa
} }
auto positionBase = position + label->pos(); auto positionBase = position + label->pos();
result.position = positionBase + QPoint(label->_st.margin.left() + left, label->_st.margin.top() + top); result.position = positionBase + QPoint(label->_st.margin.left() + left, label->_st.margin.top() + top);
return std::move(result); return result;
}; };
for (int i = 0; i != maxLines; ++i) { for (int i = 0; i != maxLines; ++i) {
result->addLine(preparePart(from, fromPosition, was, i, now), preparePart(to, toPosition, now, i, was)); result->addLine(preparePart(from, fromPosition, was, i, now), preparePart(to, toPosition, now, i, was));
} }
return std::move(result); return result;
} }
Text::StateResult FlatLabel::dragActionUpdate() { Text::StateResult FlatLabel::dragActionUpdate() {

View file

@ -408,7 +408,7 @@ QImage PopupMenu::grabForPanelAnimation() {
} }
} }
} }
return std::move(result); return result;
} }
void PopupMenu::deleteOnHide(bool del) { void PopupMenu::deleteOnHide(bool del) {

View file

@ -98,7 +98,7 @@ QPixmap Shadow::grab(TWidget *target, const style::Shadow &shadow, Sides sides)
target->render(&p, QPoint(extend.left(), extend.top()), rect, QWidget::DrawChildren | QWidget::IgnoreMask); target->render(&p, QPoint(extend.left(), extend.top()), rect, QWidget::DrawChildren | QWidget::IgnoreMask);
target->grabFinish(); target->grabFinish();
} }
return std::move(result); return result;
} }
} // namespace Ui } // namespace Ui

View file

@ -895,7 +895,7 @@ std::unique_ptr<Preview> GeneratePreview(const QString &filepath, const CurrentD
return std::unique_ptr<Preview>(); return std::unique_ptr<Preview>();
} }
result->preview = Generator(result->instance, data).generate(); result->preview = Generator(result->instance, data).generate();
return std::move(result); return result;
} }
int DefaultPreviewTitleHeight() { int DefaultPreviewTitleHeight() {

View file

@ -54,6 +54,7 @@
'-Wno-switch', '-Wno-switch',
'-Wno-comment', '-Wno-comment',
'-Wno-missing-field-initializers', '-Wno-missing-field-initializers',
'-Wno-sign-compare',
], ],
}, },
'xcode_settings': { 'xcode_settings': {

View file

@ -1,3 +1,7 @@
1.0.14 (20.02.17)
- Bug fixes and other minor improvements.
1.0.13 (20.02.17) 1.0.13 (20.02.17)
- Bug fixes and other minor improvements. - Bug fixes and other minor improvements.