From bc2b6b91f26336289b3dcccfa6ff9e633bb92c9e Mon Sep 17 00:00:00 2001 From: "coord.e" Date: Mon, 4 Feb 2019 03:41:37 +0000 Subject: [PATCH 01/12] Add: Add own optional type --- include/flom/optional.hpp | 40 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 include/flom/optional.hpp diff --git a/include/flom/optional.hpp b/include/flom/optional.hpp new file mode 100644 index 0000000..0f35d91 --- /dev/null +++ b/include/flom/optional.hpp @@ -0,0 +1,40 @@ +// +// Copyright 2018 coord.e +// +// This file is part of Flom. +// +// Flom is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flom is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Flom. If not, see . +// + +#ifndef FLOM_OPTIONAL_HPP +#define FLOM_OPTIONAL_HPP + +#include "flom/compat/optional.hpp" + +namespace flom::optional { + +static inline auto nullopt = compat::nullopt; +using nullopt_t = decltype(nullopt); + +template class optional : public compat::optional { +public: + using base_type = compat::optional; + + using base_type::base_type; + using base_type::operator=; +}; + +} // namespace flom::optional + +#endif From f620477bbf2cdac9ce6a9c1813151a7d8115f6cd Mon Sep 17 00:00:00 2001 From: "coord.e" Date: Mon, 4 Feb 2019 03:41:57 +0000 Subject: [PATCH 02/12] Change: Use the new optional type --- include/flom/effector.hpp | 34 +++++++++++++++++----------------- include/flom/effector_type.hpp | 18 +++++++++--------- include/flom/proto_util.hpp | 6 +++--- lib/effector.cpp | 31 ++++++++++++++++--------------- lib/effector_type.cpp | 16 ++++++++-------- lib/proto_util.cpp | 6 +++--- 6 files changed, 56 insertions(+), 55 deletions(-) diff --git a/include/flom/effector.hpp b/include/flom/effector.hpp index 9756c82..a2c8010 100644 --- a/include/flom/effector.hpp +++ b/include/flom/effector.hpp @@ -20,7 +20,7 @@ #ifndef FLOM_EFFECTOR_HPP #define FLOM_EFFECTOR_HPP -#include "flom/compat/optional.hpp" +#include "flom/optional.hpp" #include #include @@ -118,8 +118,8 @@ class EffectorDifference EffectorDifference, boost::multipliable>> { private: - compat::optional location_; - compat::optional rotation_; + optional::optional location_; + optional::optional rotation_; public: EffectorDifference(const Effector &, const Effector &); @@ -132,11 +132,11 @@ class EffectorDifference EffectorDifference &operator=(const EffectorDifference &) = default; EffectorDifference &operator=(EffectorDifference &&) = default; - const compat::optional &location() const &; - compat::optional location() &&; + const optional::optional &location() const &; + optional::optional location() &&; - const compat::optional &rotation() const &; - compat::optional rotation() &&; + const optional::optional &rotation() const &; + optional::optional rotation() &&; EffectorDifference &operator*=(std::size_t); EffectorDifference &operator+=(const EffectorDifference &); @@ -148,24 +148,24 @@ bool operator==(const EffectorDifference &, const EffectorDifference &); struct Effector : boost::addable { private: - compat::optional location_; - compat::optional rotation_; + optional::optional location_; + optional::optional rotation_; public: Effector(); - Effector(const compat::optional &, - const compat::optional &); + Effector(const optional::optional &, + const optional::optional &); - const compat::optional &location() const &; - compat::optional location() &&; + const optional::optional &location() const &; + optional::optional location() &&; - void set_location(const compat::optional &); + void set_location(const optional::optional &); void clear_location(); - const compat::optional &rotation() const &; - compat::optional rotation() &&; + const optional::optional &rotation() const &; + optional::optional rotation() &&; - void set_rotation(const compat::optional &); + void set_rotation(const optional::optional &); void clear_rotation(); Effector new_compatible_effector() const; diff --git a/include/flom/effector_type.hpp b/include/flom/effector_type.hpp index 649b916..b034340 100644 --- a/include/flom/effector_type.hpp +++ b/include/flom/effector_type.hpp @@ -24,7 +24,7 @@ #include -#include "flom/compat/optional.hpp" +#include "flom/optional.hpp" namespace flom { @@ -32,20 +32,20 @@ enum class CoordinateSystem { World, Local }; struct EffectorType : boost::operators { private: - compat::optional location_; - compat::optional rotation_; + optional::optional location_; + optional::optional rotation_; public: EffectorType() = delete; - EffectorType(compat::optional location, - compat::optional rotation); + EffectorType(optional::optional location, + optional::optional rotation); - compat::optional location() const; - compat::optional rotation() const; + optional::optional location() const; + optional::optional rotation() const; - void set_location(compat::optional); + void set_location(optional::optional); void clear_location(); - void set_rotation(compat::optional); + void set_rotation(optional::optional); void clear_rotation(); Effector new_effector() const; diff --git a/include/flom/proto_util.hpp b/include/flom/proto_util.hpp index edefc51..c8c9032 100644 --- a/include/flom/proto_util.hpp +++ b/include/flom/proto_util.hpp @@ -28,7 +28,7 @@ #include "motion.pb.h" #include "rotation.pb.h" -#include "flom/compat/optional.hpp" +#include "flom/optional.hpp" namespace flom::proto_util { @@ -46,10 +46,10 @@ Rotation unpack_rotation(proto::Rotation const &); void pack_effector_type(EffectorType const &, proto::EffectorType *); proto::EffectorType::Type -pack_coord_system(compat::optional const &); +pack_coord_system(optional::optional const &); EffectorType unpack_effector_type(proto::EffectorType const &); -compat::optional +optional::optional unpack_coord_system(proto::EffectorType::Type const &); void pack_effector_weight(EffectorWeight const &, proto::EffectorWeight *); diff --git a/lib/effector.cpp b/lib/effector.cpp index 461d81a..05ecfc7 100644 --- a/lib/effector.cpp +++ b/lib/effector.cpp @@ -189,17 +189,17 @@ Effector &Effector::operator+=(const EffectorDifference &other) { return *this; } -const compat::optional &EffectorDifference::location() const & { +const optional::optional &EffectorDifference::location() const & { return this->location_; } -compat::optional EffectorDifference::location() && { +optional::optional EffectorDifference::location() && { return std::move(this->location_); } -const compat::optional &EffectorDifference::rotation() const & { +const optional::optional &EffectorDifference::rotation() const & { return this->rotation_; } -compat::optional EffectorDifference::rotation() && { +optional::optional EffectorDifference::rotation() && { return std::move(this->rotation_); } @@ -222,36 +222,37 @@ Effector interpolate(double t, Effector const &a, Effector const &b) { return e; } -Effector::Effector() : location_(compat::nullopt), rotation_(compat::nullopt) {} -Effector::Effector(const compat::optional &location, - const compat::optional &rotation) +Effector::Effector() + : location_(optional::nullopt), rotation_(optional::nullopt) {} +Effector::Effector(const optional::optional &location, + const optional::optional &rotation) : location_(location), rotation_(rotation) {} -const compat::optional &Effector::location() const & { +const optional::optional &Effector::location() const & { return this->location_; } -compat::optional Effector::location() && { +optional::optional Effector::location() && { return std::move(this->location_); } -void Effector::set_location(const compat::optional &location) { +void Effector::set_location(const optional::optional &location) { this->location_ = location; } -void Effector::clear_location() { this->set_location(compat::nullopt); } +void Effector::clear_location() { this->set_location(optional::nullopt); } -const compat::optional &Effector::rotation() const & { +const optional::optional &Effector::rotation() const & { return this->rotation_; } -compat::optional Effector::rotation() && { +optional::optional Effector::rotation() && { return std::move(this->rotation_); } -void Effector::set_rotation(const compat::optional &rotation) { +void Effector::set_rotation(const optional::optional &rotation) { this->rotation_ = rotation; } -void Effector::clear_rotation() { this->set_rotation(compat::nullopt); } +void Effector::clear_rotation() { this->set_rotation(optional::nullopt); } Effector Effector::new_compatible_effector() const { Effector e; diff --git a/lib/effector_type.cpp b/lib/effector_type.cpp index 5580b9d..3cf6c29 100644 --- a/lib/effector_type.cpp +++ b/lib/effector_type.cpp @@ -2,25 +2,25 @@ namespace flom { -EffectorType::EffectorType(compat::optional location, - compat::optional rotation) +EffectorType::EffectorType(optional::optional location, + optional::optional rotation) : location_(location), rotation_(rotation) {} -compat::optional EffectorType::location() const { +optional::optional EffectorType::location() const { return this->location_; } -compat::optional EffectorType::rotation() const { +optional::optional EffectorType::rotation() const { return this->rotation_; } -void EffectorType::set_location(compat::optional location) { +void EffectorType::set_location(optional::optional location) { this->location_ = location; } -void EffectorType::clear_location() { this->set_location(compat::nullopt); } -void EffectorType::set_rotation(compat::optional rotation) { +void EffectorType::clear_location() { this->set_location(optional::nullopt); } +void EffectorType::set_rotation(optional::optional rotation) { this->rotation_ = rotation; } -void EffectorType::clear_rotation() { this->set_rotation(compat::nullopt); } +void EffectorType::clear_rotation() { this->set_rotation(optional::nullopt); } Effector EffectorType::new_effector() const { Effector e; diff --git a/lib/proto_util.cpp b/lib/proto_util.cpp index 649ad87..ad46be8 100644 --- a/lib/proto_util.cpp +++ b/lib/proto_util.cpp @@ -70,7 +70,7 @@ void pack_rotation(Rotation const &rot, proto::Rotation *rot_proto) { } proto::EffectorType::Type -pack_coord_system(compat::optional const &c) { +pack_coord_system(optional::optional const &c) { if (!c) { return proto::EffectorType::Type::EffectorType_Type_None; } @@ -92,10 +92,10 @@ EffectorType unpack_effector_type(proto::EffectorType const &proto) { unpack_coord_system(proto.rotation())}; } -compat::optional +optional::optional unpack_coord_system(proto::EffectorType::Type const &proto) { if (proto == proto::EffectorType::Type::EffectorType_Type_None) { - return compat::nullopt; + return optional::nullopt; } else if (proto == proto::EffectorType::Type::EffectorType_Type_World) { return CoordinateSystem::World; } else if (proto == proto::EffectorType::Type::EffectorType_Type_Local) { From 581a5e20c5e509cc01acd418fd7acb9da01eb665 Mon Sep 17 00:00:00 2001 From: "coord.e" Date: Mon, 4 Feb 2019 03:44:21 +0000 Subject: [PATCH 03/12] Fix: Use flom::optional::optional in tests --- test/include/generators.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/include/generators.hpp b/test/include/generators.hpp index 55ce536..a435a29 100644 --- a/test/include/generators.hpp +++ b/test/include/generators.hpp @@ -70,7 +70,7 @@ template <> struct Arbitrary { static auto arbitrary() -> decltype(auto) { return gen::apply( [](Maybe const &l, Maybe const &r) { - flom::Effector e{flom::compat::nullopt, flom::compat::nullopt}; + flom::Effector e{flom::optional::nullopt, flom::optional::nullopt}; if (l) { e.set_location(*l); } @@ -103,7 +103,7 @@ template <> struct Arbitrary { static auto arbitrary() -> decltype(auto) { return gen::apply( [](Maybe l, Maybe r) { - flom::compat::optional loc, rot; + flom::optional::optional loc, rot; if (l) { loc = *l; } From 93d5a90eeb03495c0c514c645e553ab19912c0ca Mon Sep 17 00:00:00 2001 From: "coord.e" Date: Mon, 4 Feb 2019 03:56:40 +0000 Subject: [PATCH 04/12] Add: Add a comment describing the situation --- include/flom/optional.hpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/flom/optional.hpp b/include/flom/optional.hpp index 0f35d91..4213ede 100644 --- a/include/flom/optional.hpp +++ b/include/flom/optional.hpp @@ -27,6 +27,19 @@ namespace flom::optional { static inline auto nullopt = compat::nullopt; using nullopt_t = decltype(nullopt); +// +// a class template for an optional contained value of T +// +// expected to work as if this is an alias of std::optional +// +// Background: +// the real signature of compat::optional changes +// depending on the language processor. +// If libflom.so is compiled with std::optional, +// that cannot be linked with libflom.so with boost::optional. +// With this class, signature is always `flom::optional::optional` +// and linking failure cannot be happen. +// template class optional : public compat::optional { public: using base_type = compat::optional; From c2b6691a0f8ceb421f47a31cd784ba2f2e27982a Mon Sep 17 00:00:00 2001 From: "coord.e" Date: Mon, 4 Feb 2019 04:06:02 +0000 Subject: [PATCH 05/12] Change: Temporalily enable deployment --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9901dd1..0312037 100644 --- a/.travis.yml +++ b/.travis.yml @@ -60,7 +60,6 @@ deploy: on: condition: "$BUILD_TYPE = Release" all_branches: true - condition: "$TRAVIS_BRANCH =~ ^develop|master$" - provider: releases api_key: $GITHUB_OAUTH_TOKEN skip_cleanup: true From c82179ddc7768d7ba3afd29b9adbf402d2c7736c Mon Sep 17 00:00:00 2001 From: "coord.e" Date: Mon, 4 Feb 2019 05:16:03 +0000 Subject: [PATCH 06/12] Revert "Add: Add a comment describing the situation" This reverts commit 93d5a90eeb03495c0c514c645e553ab19912c0ca. --- include/flom/optional.hpp | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/include/flom/optional.hpp b/include/flom/optional.hpp index 4213ede..0f35d91 100644 --- a/include/flom/optional.hpp +++ b/include/flom/optional.hpp @@ -27,19 +27,6 @@ namespace flom::optional { static inline auto nullopt = compat::nullopt; using nullopt_t = decltype(nullopt); -// -// a class template for an optional contained value of T -// -// expected to work as if this is an alias of std::optional -// -// Background: -// the real signature of compat::optional changes -// depending on the language processor. -// If libflom.so is compiled with std::optional, -// that cannot be linked with libflom.so with boost::optional. -// With this class, signature is always `flom::optional::optional` -// and linking failure cannot be happen. -// template class optional : public compat::optional { public: using base_type = compat::optional; From 568b7232642c527d19fb30bc934e9fa03c2b4e14 Mon Sep 17 00:00:00 2001 From: "coord.e" Date: Mon, 4 Feb 2019 05:16:06 +0000 Subject: [PATCH 07/12] Revert "Fix: Use flom::optional::optional in tests" This reverts commit 581a5e20c5e509cc01acd418fd7acb9da01eb665. --- test/include/generators.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/include/generators.hpp b/test/include/generators.hpp index a435a29..55ce536 100644 --- a/test/include/generators.hpp +++ b/test/include/generators.hpp @@ -70,7 +70,7 @@ template <> struct Arbitrary { static auto arbitrary() -> decltype(auto) { return gen::apply( [](Maybe const &l, Maybe const &r) { - flom::Effector e{flom::optional::nullopt, flom::optional::nullopt}; + flom::Effector e{flom::compat::nullopt, flom::compat::nullopt}; if (l) { e.set_location(*l); } @@ -103,7 +103,7 @@ template <> struct Arbitrary { static auto arbitrary() -> decltype(auto) { return gen::apply( [](Maybe l, Maybe r) { - flom::optional::optional loc, rot; + flom::compat::optional loc, rot; if (l) { loc = *l; } From 32db55330a01493bbab85f1cd1381516f169069d Mon Sep 17 00:00:00 2001 From: "coord.e" Date: Mon, 4 Feb 2019 05:16:07 +0000 Subject: [PATCH 08/12] Revert "Change: Use the new optional type" This reverts commit f620477bbf2cdac9ce6a9c1813151a7d8115f6cd. --- include/flom/effector.hpp | 34 +++++++++++++++++----------------- include/flom/effector_type.hpp | 18 +++++++++--------- include/flom/proto_util.hpp | 6 +++--- lib/effector.cpp | 31 +++++++++++++++---------------- lib/effector_type.cpp | 16 ++++++++-------- lib/proto_util.cpp | 6 +++--- 6 files changed, 55 insertions(+), 56 deletions(-) diff --git a/include/flom/effector.hpp b/include/flom/effector.hpp index a2c8010..9756c82 100644 --- a/include/flom/effector.hpp +++ b/include/flom/effector.hpp @@ -20,7 +20,7 @@ #ifndef FLOM_EFFECTOR_HPP #define FLOM_EFFECTOR_HPP -#include "flom/optional.hpp" +#include "flom/compat/optional.hpp" #include #include @@ -118,8 +118,8 @@ class EffectorDifference EffectorDifference, boost::multipliable>> { private: - optional::optional location_; - optional::optional rotation_; + compat::optional location_; + compat::optional rotation_; public: EffectorDifference(const Effector &, const Effector &); @@ -132,11 +132,11 @@ class EffectorDifference EffectorDifference &operator=(const EffectorDifference &) = default; EffectorDifference &operator=(EffectorDifference &&) = default; - const optional::optional &location() const &; - optional::optional location() &&; + const compat::optional &location() const &; + compat::optional location() &&; - const optional::optional &rotation() const &; - optional::optional rotation() &&; + const compat::optional &rotation() const &; + compat::optional rotation() &&; EffectorDifference &operator*=(std::size_t); EffectorDifference &operator+=(const EffectorDifference &); @@ -148,24 +148,24 @@ bool operator==(const EffectorDifference &, const EffectorDifference &); struct Effector : boost::addable { private: - optional::optional location_; - optional::optional rotation_; + compat::optional location_; + compat::optional rotation_; public: Effector(); - Effector(const optional::optional &, - const optional::optional &); + Effector(const compat::optional &, + const compat::optional &); - const optional::optional &location() const &; - optional::optional location() &&; + const compat::optional &location() const &; + compat::optional location() &&; - void set_location(const optional::optional &); + void set_location(const compat::optional &); void clear_location(); - const optional::optional &rotation() const &; - optional::optional rotation() &&; + const compat::optional &rotation() const &; + compat::optional rotation() &&; - void set_rotation(const optional::optional &); + void set_rotation(const compat::optional &); void clear_rotation(); Effector new_compatible_effector() const; diff --git a/include/flom/effector_type.hpp b/include/flom/effector_type.hpp index b034340..649b916 100644 --- a/include/flom/effector_type.hpp +++ b/include/flom/effector_type.hpp @@ -24,7 +24,7 @@ #include -#include "flom/optional.hpp" +#include "flom/compat/optional.hpp" namespace flom { @@ -32,20 +32,20 @@ enum class CoordinateSystem { World, Local }; struct EffectorType : boost::operators { private: - optional::optional location_; - optional::optional rotation_; + compat::optional location_; + compat::optional rotation_; public: EffectorType() = delete; - EffectorType(optional::optional location, - optional::optional rotation); + EffectorType(compat::optional location, + compat::optional rotation); - optional::optional location() const; - optional::optional rotation() const; + compat::optional location() const; + compat::optional rotation() const; - void set_location(optional::optional); + void set_location(compat::optional); void clear_location(); - void set_rotation(optional::optional); + void set_rotation(compat::optional); void clear_rotation(); Effector new_effector() const; diff --git a/include/flom/proto_util.hpp b/include/flom/proto_util.hpp index c8c9032..edefc51 100644 --- a/include/flom/proto_util.hpp +++ b/include/flom/proto_util.hpp @@ -28,7 +28,7 @@ #include "motion.pb.h" #include "rotation.pb.h" -#include "flom/optional.hpp" +#include "flom/compat/optional.hpp" namespace flom::proto_util { @@ -46,10 +46,10 @@ Rotation unpack_rotation(proto::Rotation const &); void pack_effector_type(EffectorType const &, proto::EffectorType *); proto::EffectorType::Type -pack_coord_system(optional::optional const &); +pack_coord_system(compat::optional const &); EffectorType unpack_effector_type(proto::EffectorType const &); -optional::optional +compat::optional unpack_coord_system(proto::EffectorType::Type const &); void pack_effector_weight(EffectorWeight const &, proto::EffectorWeight *); diff --git a/lib/effector.cpp b/lib/effector.cpp index 05ecfc7..461d81a 100644 --- a/lib/effector.cpp +++ b/lib/effector.cpp @@ -189,17 +189,17 @@ Effector &Effector::operator+=(const EffectorDifference &other) { return *this; } -const optional::optional &EffectorDifference::location() const & { +const compat::optional &EffectorDifference::location() const & { return this->location_; } -optional::optional EffectorDifference::location() && { +compat::optional EffectorDifference::location() && { return std::move(this->location_); } -const optional::optional &EffectorDifference::rotation() const & { +const compat::optional &EffectorDifference::rotation() const & { return this->rotation_; } -optional::optional EffectorDifference::rotation() && { +compat::optional EffectorDifference::rotation() && { return std::move(this->rotation_); } @@ -222,37 +222,36 @@ Effector interpolate(double t, Effector const &a, Effector const &b) { return e; } -Effector::Effector() - : location_(optional::nullopt), rotation_(optional::nullopt) {} -Effector::Effector(const optional::optional &location, - const optional::optional &rotation) +Effector::Effector() : location_(compat::nullopt), rotation_(compat::nullopt) {} +Effector::Effector(const compat::optional &location, + const compat::optional &rotation) : location_(location), rotation_(rotation) {} -const optional::optional &Effector::location() const & { +const compat::optional &Effector::location() const & { return this->location_; } -optional::optional Effector::location() && { +compat::optional Effector::location() && { return std::move(this->location_); } -void Effector::set_location(const optional::optional &location) { +void Effector::set_location(const compat::optional &location) { this->location_ = location; } -void Effector::clear_location() { this->set_location(optional::nullopt); } +void Effector::clear_location() { this->set_location(compat::nullopt); } -const optional::optional &Effector::rotation() const & { +const compat::optional &Effector::rotation() const & { return this->rotation_; } -optional::optional Effector::rotation() && { +compat::optional Effector::rotation() && { return std::move(this->rotation_); } -void Effector::set_rotation(const optional::optional &rotation) { +void Effector::set_rotation(const compat::optional &rotation) { this->rotation_ = rotation; } -void Effector::clear_rotation() { this->set_rotation(optional::nullopt); } +void Effector::clear_rotation() { this->set_rotation(compat::nullopt); } Effector Effector::new_compatible_effector() const { Effector e; diff --git a/lib/effector_type.cpp b/lib/effector_type.cpp index 3cf6c29..5580b9d 100644 --- a/lib/effector_type.cpp +++ b/lib/effector_type.cpp @@ -2,25 +2,25 @@ namespace flom { -EffectorType::EffectorType(optional::optional location, - optional::optional rotation) +EffectorType::EffectorType(compat::optional location, + compat::optional rotation) : location_(location), rotation_(rotation) {} -optional::optional EffectorType::location() const { +compat::optional EffectorType::location() const { return this->location_; } -optional::optional EffectorType::rotation() const { +compat::optional EffectorType::rotation() const { return this->rotation_; } -void EffectorType::set_location(optional::optional location) { +void EffectorType::set_location(compat::optional location) { this->location_ = location; } -void EffectorType::clear_location() { this->set_location(optional::nullopt); } -void EffectorType::set_rotation(optional::optional rotation) { +void EffectorType::clear_location() { this->set_location(compat::nullopt); } +void EffectorType::set_rotation(compat::optional rotation) { this->rotation_ = rotation; } -void EffectorType::clear_rotation() { this->set_rotation(optional::nullopt); } +void EffectorType::clear_rotation() { this->set_rotation(compat::nullopt); } Effector EffectorType::new_effector() const { Effector e; diff --git a/lib/proto_util.cpp b/lib/proto_util.cpp index ad46be8..649ad87 100644 --- a/lib/proto_util.cpp +++ b/lib/proto_util.cpp @@ -70,7 +70,7 @@ void pack_rotation(Rotation const &rot, proto::Rotation *rot_proto) { } proto::EffectorType::Type -pack_coord_system(optional::optional const &c) { +pack_coord_system(compat::optional const &c) { if (!c) { return proto::EffectorType::Type::EffectorType_Type_None; } @@ -92,10 +92,10 @@ EffectorType unpack_effector_type(proto::EffectorType const &proto) { unpack_coord_system(proto.rotation())}; } -optional::optional +compat::optional unpack_coord_system(proto::EffectorType::Type const &proto) { if (proto == proto::EffectorType::Type::EffectorType_Type_None) { - return optional::nullopt; + return compat::nullopt; } else if (proto == proto::EffectorType::Type::EffectorType_Type_World) { return CoordinateSystem::World; } else if (proto == proto::EffectorType::Type::EffectorType_Type_Local) { From 9e8f74c52264ff3234f96f4091cb664b163cf91e Mon Sep 17 00:00:00 2001 From: "coord.e" Date: Mon, 4 Feb 2019 05:16:08 +0000 Subject: [PATCH 09/12] Revert "Add: Add own optional type" This reverts commit bc2b6b91f26336289b3dcccfa6ff9e633bb92c9e. --- include/flom/optional.hpp | 40 --------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 include/flom/optional.hpp diff --git a/include/flom/optional.hpp b/include/flom/optional.hpp deleted file mode 100644 index 0f35d91..0000000 --- a/include/flom/optional.hpp +++ /dev/null @@ -1,40 +0,0 @@ -// -// Copyright 2018 coord.e -// -// This file is part of Flom. -// -// Flom is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Flom is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Flom. If not, see . -// - -#ifndef FLOM_OPTIONAL_HPP -#define FLOM_OPTIONAL_HPP - -#include "flom/compat/optional.hpp" - -namespace flom::optional { - -static inline auto nullopt = compat::nullopt; -using nullopt_t = decltype(nullopt); - -template class optional : public compat::optional { -public: - using base_type = compat::optional; - - using base_type::base_type; - using base_type::operator=; -}; - -} // namespace flom::optional - -#endif From 198b1f1237a47fce8618a213c1d91d740f01ad73 Mon Sep 17 00:00:00 2001 From: "coord.e" Date: Mon, 4 Feb 2019 05:17:00 +0000 Subject: [PATCH 10/12] Change: Always use boost::optional --- include/flom/compat/optional.hpp | 34 -------------------------------- 1 file changed, 34 deletions(-) diff --git a/include/flom/compat/optional.hpp b/include/flom/compat/optional.hpp index 15cbfff..f8418f8 100644 --- a/include/flom/compat/optional.hpp +++ b/include/flom/compat/optional.hpp @@ -22,16 +22,6 @@ #include - -#if defined(__GLIBCXX__) && (__GLIBCXX__ < 20190108) -// -// some libstdc++ implementation of std::optional doesn't allow -// to hold a type with non-trivial copy ctor, so use boost::optional instead -// -// fixed in PR libstdc++/87854 -// https://github.com/gcc-mirror/gcc/commit/58e897da03b9a1aaf6861951806c7a8e15de1546 -// - #include namespace flom::compat { @@ -40,28 +30,4 @@ using optional = boost::optional; static inline auto nullopt = boost::none; } -#elif __has_include() - -#include - -namespace flom::compat { -template -using optional = std::optional; -inline constexpr auto nullopt = std::nullopt; -} - -#elif __has_include() - -#include - -namespace flom::compat { -template -using optional = std::experimental::optional; -inline constexpr auto nullopt = std::experimental::nullopt; -} - -#else -#error Could not find optional header -#endif - #endif From 8a91cf7f65faf818ceaf6fe4c44c0f25bbb65ba5 Mon Sep 17 00:00:00 2001 From: "coord.e" Date: Mon, 4 Feb 2019 05:55:42 +0000 Subject: [PATCH 11/12] fix: Disable deployments again --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 0312037..9901dd1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -60,6 +60,7 @@ deploy: on: condition: "$BUILD_TYPE = Release" all_branches: true + condition: "$TRAVIS_BRANCH =~ ^develop|master$" - provider: releases api_key: $GITHUB_OAUTH_TOKEN skip_cleanup: true From 9b8a02c69bd2bbcab28728875dc619779e16cbca Mon Sep 17 00:00:00 2001 From: "coord.e" Date: Mon, 4 Feb 2019 09:30:17 +0000 Subject: [PATCH 12/12] Fix: Increase time limitation --- ci/scripts/linux/script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/scripts/linux/script.sh b/ci/scripts/linux/script.sh index fcbdac5..9248de8 100644 --- a/ci/scripts/linux/script.sh +++ b/ci/scripts/linux/script.sh @@ -18,4 +18,4 @@ # along with Flom. If not, see . # -travis_wait 30 docker run --rm -v $(pwd):/source -v $(pwd)/build:/build -e BUILD_TYPE=${BUILD_TYPE} -e CXX=${COMPILER} -e ENABLE_TEST=${ENABLE_TEST} -e RC_PARAMS="${RC_PARAMS}" test +travis_wait 45 docker run --rm -v $(pwd):/source -v $(pwd)/build:/build -e BUILD_TYPE=${BUILD_TYPE} -e CXX=${COMPILER} -e ENABLE_TEST=${ENABLE_TEST} -e RC_PARAMS="${RC_PARAMS}" test