Move to Xcode 9.0 and fix errors in Clang build.

This commit is contained in:
John Preston 2017-09-26 23:14:56 +03:00
parent 7c4e4d7fa2
commit ed061252a5
12 changed files with 30 additions and 29 deletions

View File

@ -42,7 +42,7 @@ The source code is published under GPLv3 with OpenSSL exception, the license is
## Build instructions ## Build instructions
* [Visual Studio 2017][msvc] * [Visual Studio 2017][msvc]
* [Xcode 8][xcode] * [Xcode 9][xcode]
* [GYP/CMake on GNU/Linux][cmake] * [GYP/CMake on GNU/Linux][cmake]
[//]: # (LINKS) [//]: # (LINKS)

View File

@ -29,10 +29,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
using gsl::not_null; using gsl::not_null;
// Custom libc++ build used for old OS X versions already has this. #if defined COMPILER_GCC
#ifndef OS_MAC_OLD
#if defined COMPILER_CLANG || defined COMPILER_GCC
namespace std { namespace std {
template <typename T> template <typename T>
@ -44,9 +41,7 @@ template <typename T>
void as_const(const T&&) = delete; void as_const(const T&&) = delete;
} // namespace std } // namespace std
#endif // COMPILER_CLANG || COMPILER_GCC #endif // COMPILER_GCC
#endif // OS_MAC_OLD
#include "base/ordered_set.h" #include "base/ordered_set.h"

View File

@ -24,9 +24,12 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
namespace Data { namespace Data {
template <typename FlagsType>
using FlagsUnderlying = typename FlagsType::Type;
template < template <
typename FlagsType, typename FlagsType,
typename FlagsType::Type kEssential = -1> FlagsUnderlying<FlagsType> kEssential = FlagsUnderlying<FlagsType>(-1)>
class Flags { class Flags {
public: public:
using Type = FlagsType; using Type = FlagsType;

View File

@ -370,7 +370,7 @@ public:
void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_flags) { void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_flags) {
if (from + 1 > end) throw mtpErrorInsufficient(); if (from + 1 > end) throw mtpErrorInsufficient();
if (cons != mtpc_flags) throw mtpErrorUnexpected(cons, "MTPflags"); if (cons != mtpc_flags) throw mtpErrorUnexpected(cons, "MTPflags");
v = Flags::from_raw(static_cast<Flags::Type>(*(from++))); v = Flags::from_raw(static_cast<typename Flags::Type>(*(from++)));
} }
void write(mtpBuffer &to) const { void write(mtpBuffer &to) const {
to.push_back(static_cast<mtpPrime>(v.value())); to.push_back(static_cast<mtpPrime>(v.value()));

View File

@ -21,6 +21,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#pragma once #pragma once
#include "base/optional.h" #include "base/optional.h"
#include <rpl/map.h>
#include <rpl/producer.h> #include <rpl/producer.h>
#include <rpl/details/type_list.h> #include <rpl/details/type_list.h>
#include <rpl/details/callable.h> #include <rpl/details/callable.h>

View File

@ -42,7 +42,7 @@ public:
return std::move(initial).start( return std::move(initial).start(
[consumer, previous](auto &&value) { [consumer, previous](auto &&value) {
if (auto exists = *previous) { if (auto exists = *previous) {
&existing = *exists; auto &existing = *exists;
auto next = std::make_tuple( auto next = std::make_tuple(
std::move(existing), std::move(existing),
value); value);

View File

@ -23,20 +23,12 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "base/build_config.h" #include "base/build_config.h"
#include <tuple> #include <tuple>
// Custom libc++ build used for old OS X versions already has this.
#ifndef OS_MAC_OLD
#if defined COMPILER_CLANG || defined COMPILER_GCC
namespace std {
#ifdef COMPILER_GCC #ifdef COMPILER_GCC
namespace std {
template <bool Value> template <bool Value>
using bool_constant = integral_constant<bool, Value>; using bool_constant = integral_constant<bool, Value>;
#endif // COMPILER_GCC
template <typename ...Args> template <typename ...Args>
constexpr auto tuple_size_v = std::tuple_size<Args...>::value; constexpr auto tuple_size_v = std::tuple_size<Args...>::value;
@ -70,9 +62,7 @@ constexpr decltype(auto) apply(Method &&method, Tuple&& tuple) {
} }
} // namespace std } // namespace std
#endif // COMPILER_CLANG || COMPILER_GCC #endif // COMPILER_GCC
#endif // OS_MAC_OLD
namespace rpl { namespace rpl {
namespace details { namespace details {

View File

@ -56,6 +56,18 @@ inline producer<Value, Error> vector(std::vector<Value> &&values) {
}; };
} }
template <typename Error = no_error>
inline producer<bool, Error> vector(std::vector<bool> &&values) {
return [values = std::move(values)](
const consumer<bool, Error> &consumer) mutable {
for (auto value : values) {
consumer.put_next_copy(value);
}
consumer.put_done();
return lifetime();
};
}
template <typename Value, typename Error = no_error, typename Range> template <typename Value, typename Error = no_error, typename Range>
inline producer<Value, Error> range(Range &&range) { inline producer<Value, Error> range(Range &&range) {
return vector(std::vector<Value>( return vector(std::vector<Value>(

View File

@ -41,7 +41,7 @@ public:
rpl::producer<QRect> geometryValue() const { rpl::producer<QRect> geometryValue() const {
auto &stream = eventStreams().geometry; auto &stream = eventStreams().geometry;
return stream.events_starting_with_copy(geometry()); return stream.events_starting_with_copy(this->geometry());
} }
rpl::producer<QSize> sizeValue() const { rpl::producer<QSize> sizeValue() const {
return geometryValue() return geometryValue()
@ -88,7 +88,7 @@ public:
void showOn(rpl::producer<bool> &&shown) { void showOn(rpl::producer<bool> &&shown) {
std::move(shown) std::move(shown)
| rpl::start([this](bool visible) { | rpl::start([this](bool visible) {
setVisible(visible); this->setVisible(visible);
}, lifetime()); }, lifetime());
} }
@ -103,7 +103,7 @@ protected:
case QEvent::Resize: case QEvent::Resize:
if (auto streams = _eventStreams.get()) { if (auto streams = _eventStreams.get()) {
auto that = weak(this); auto that = weak(this);
streams->geometry.fire_copy(geometry()); streams->geometry.fire_copy(this->geometry());
if (!that) { if (!that) {
return true; return true;
} }

View File

@ -28,7 +28,7 @@ else
#gyp --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp --format=xcode-ninja #gyp --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp --format=xcode-ninja
#gyp --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp --format=xcode #gyp --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp --format=xcode
# use patched gyp with Xcode project generator # use patched gyp with Xcode project generator
../../../Libraries/gyp/gyp --depth=. --generator-output=.. -Goutput_dir=../out -Gxcode_upgrade_check_project_version=830 -Dofficial_build_target=$BuildTarget Telegram.gyp --format=xcode ../../../Libraries/gyp/gyp --depth=. --generator-output=.. -Goutput_dir=../out -Gxcode_upgrade_check_project_version=900 -Dofficial_build_target=$BuildTarget Telegram.gyp --format=xcode
fi fi
cd ../.. cd ../..

View File

@ -1,4 +1,4 @@
## Build instructions for Xcode 7.2.1 ## Build instructions for Xcode 9.0
**NB** These are outdated, please refer to [Building using Xcode][xcode] instructions. **NB** These are outdated, please refer to [Building using Xcode][xcode] instructions.

View File

@ -1,4 +1,4 @@
## Build instructions for Xcode 8.0 ## Build instructions for Xcode 9.0
### Prepare folder ### Prepare folder