Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArsentiy Milchakov <milcars@mapswithme.com>2017-04-06 20:02:53 +0300
committerSergey Yershov <syershov@maps.me>2017-04-19 22:04:09 +0300
commitde1c29b3761c4a91d6b3a4f83b746c7947fb850d (patch)
tree25348c8442a2630e16239744d9c934d629370d61
parenta51f90985ae6d37c2a9c8397aad1a1bf79beeedd (diff)
preparation for std migration
-rw-r--r--base/condition.cpp3
-rw-r--r--base/math.hpp10
-rw-r--r--base/timer.cpp3
-rw-r--r--coding/read_write_utils.hpp4
-rw-r--r--coding/reader.hpp4
-rw-r--r--common.pri1
-rw-r--r--indexer/displacement_manager.hpp4
-rw-r--r--indexer/indexer_tests/trie_test.cpp4
-rw-r--r--std/cmath.hpp10
-rw-r--r--std/cstdint.hpp2
-rw-r--r--std/cstdlib.hpp15
-rw-r--r--std/iomanip.hpp57
-rw-r--r--std/iostream.hpp7
-rw-r--r--std/systime.hpp22
-rw-r--r--std/type_traits.hpp6
-rw-r--r--xcode/omim.xcworkspace/contents.xcworkspacedata3
16 files changed, 21 insertions, 134 deletions
diff --git a/base/condition.cpp b/base/condition.cpp
index 2be49f0e27..e2a60f0753 100644
--- a/base/condition.cpp
+++ b/base/condition.cpp
@@ -2,7 +2,6 @@
#include "base/mutex.hpp"
#include "std/target_os.hpp"
-#include "std/systime.hpp"
#include <pthread.h>
@@ -10,6 +9,8 @@
#include <cstdint>
#include <limits>
+#include <sys/time.h>
+
namespace threads
{
namespace impl
diff --git a/base/math.hpp b/base/math.hpp
index c54f74843c..01c31a0c43 100644
--- a/base/math.hpp
+++ b/base/math.hpp
@@ -11,10 +11,18 @@
#include <boost/integer.hpp>
+namespace math
+{
+ double constexpr pi = 3.14159265358979323846;
+ double constexpr pi2 = pi / 2.;
+ double constexpr pi4 = pi / 4.;
+ double constexpr twicePi = 2. * pi;
+
+ template <class T> T sqr(T t) { return (t*t); }
+}
namespace my
{
-
template <typename T> inline T Abs(T x)
{
return (x < 0 ? -x : x);
diff --git a/base/timer.cpp b/base/timer.cpp
index 706dde5fcb..cf69719581 100644
--- a/base/timer.cpp
+++ b/base/timer.cpp
@@ -3,7 +3,6 @@
#include "base/timegm.hpp"
#include "base/timer.hpp"
-#include "std/systime.hpp"
#include "std/target_os.hpp"
#include <algorithm>
@@ -12,6 +11,8 @@
#include <iomanip>
#include <sstream>
+#include <sys/time.h>
+
#ifndef OMIM_OS_LINUX
using std::get_time;
using std::put_time;
diff --git a/coding/read_write_utils.hpp b/coding/read_write_utils.hpp
index 0536894a91..43ada6eefb 100644
--- a/coding/read_write_utils.hpp
+++ b/coding/read_write_utils.hpp
@@ -93,7 +93,7 @@ namespace rw
/// This assert fails on std::pair<int, int> and OsmID class.
/// @todo Review this logic in future with new compiler abilities.
/// https://trello.com/c/hzCc9bzN/1254-is-trivial-copy-read-write-utils-hpp
- //static_assert(is_trivially_copyable<ValueT>::value, "");
+ //static_assert(std::is_trivially_copyable<ValueT>::value, "");
uint32_t const count = ReadVarUint<uint32_t>(src);
if (count > 0)
@@ -110,7 +110,7 @@ namespace rw
/// This assert fails on std::pair<int, int> and OsmID class.
/// @todo Review this logic in future with new compiler abilities.
/// https://trello.com/c/hzCc9bzN/1254-is-trivial-copy-read-write-utils-hpp
- //static_assert(is_trivially_copyable<ValueT>::value, "");
+ //static_assert(std::is_trivially_copyable<ValueT>::value, "");
uint32_t const count = static_cast<uint32_t>(v.size());
WriteVarUint(sink, count);
diff --git a/coding/reader.hpp b/coding/reader.hpp
index 34d2d98ac0..52a7b750d7 100644
--- a/coding/reader.hpp
+++ b/coding/reader.hpp
@@ -255,7 +255,7 @@ template <typename TPrimitive, class TReader>
inline TPrimitive ReadPrimitiveFromPos(TReader const & reader, uint64_t pos)
{
#ifndef OMIM_OS_LINUX
- static_assert(is_trivially_copyable<TPrimitive>::value, "");
+ static_assert(std::is_trivially_copyable<TPrimitive>::value, "");
#endif
TPrimitive primitive;
ReadFromPos(reader, pos, &primitive, sizeof(primitive));
@@ -266,7 +266,7 @@ template <typename TPrimitive, class TSource>
TPrimitive ReadPrimitiveFromSource(TSource & source)
{
#ifndef OMIM_OS_LINUX
- static_assert(is_trivially_copyable<TPrimitive>::value, "");
+ static_assert(std::is_trivially_copyable<TPrimitive>::value, "");
#endif
TPrimitive primitive;
source.Read(&primitive, sizeof(primitive));
diff --git a/common.pri b/common.pri
index 669cdd8c87..953c8dc7da 100644
--- a/common.pri
+++ b/common.pri
@@ -266,7 +266,6 @@ HEADERS += \
$$ROOT_DIR/std/sstream.hpp \
$$ROOT_DIR/std/stack.hpp \
$$ROOT_DIR/std/string.hpp \
- $$ROOT_DIR/std/systime.hpp \
$$ROOT_DIR/std/target_os.hpp \
$$ROOT_DIR/std/thread.hpp \
$$ROOT_DIR/std/transform_iterator.hpp \
diff --git a/indexer/displacement_manager.hpp b/indexer/displacement_manager.hpp
index 6e7f43b19b..ba1e8112cc 100644
--- a/indexer/displacement_manager.hpp
+++ b/indexer/displacement_manager.hpp
@@ -56,7 +56,7 @@ private:
};
static_assert(sizeof(CellFeaturePair) == 12, "");
#ifndef OMIM_OS_LINUX
-static_assert(is_trivially_copyable<CellFeaturePair>::value, "");
+static_assert(std::is_trivially_copyable<CellFeaturePair>::value, "");
#endif
class CellFeatureBucketTuple
@@ -82,7 +82,7 @@ private:
};
static_assert(sizeof(CellFeatureBucketTuple) == 16, "");
#ifndef OMIM_OS_LINUX
-static_assert(is_trivially_copyable<CellFeatureBucketTuple>::value, "");
+static_assert(std::is_trivially_copyable<CellFeatureBucketTuple>::value, "");
#endif
/// Displacement manager filters incoming single-point features to simplify runtime
diff --git a/indexer/indexer_tests/trie_test.cpp b/indexer/indexer_tests/trie_test.cpp
index 38265302bd..495e0d6762 100644
--- a/indexer/indexer_tests/trie_test.cpp
+++ b/indexer/indexer_tests/trie_test.cpp
@@ -46,7 +46,7 @@ class SingleValueSerializer
{
public:
#if !defined(OMIM_OS_LINUX)
- static_assert(is_trivially_copyable<TPrimitive>::value, "");
+ static_assert(std::is_trivially_copyable<TPrimitive>::value, "");
#endif
template <typename TWriter>
@@ -64,7 +64,7 @@ public:
using TSerializer = SingleValueSerializer<TValue>;
#if !defined(OMIM_OS_LINUX)
- static_assert(is_trivially_copyable<TPrimitive>::value, "");
+ static_assert(std::is_trivially_copyable<TPrimitive>::value, "");
#endif
ValueList() = default;
diff --git a/std/cmath.hpp b/std/cmath.hpp
index 4bcc07885a..aa43ca7352 100644
--- a/std/cmath.hpp
+++ b/std/cmath.hpp
@@ -16,13 +16,3 @@ using std::cos;
using std::isfinite;
using std::sin;
using std::log10;
-
-namespace math
-{
- double constexpr pi = 3.14159265358979323846;
- double constexpr pi2 = pi / 2.;
- double constexpr pi4 = pi / 4.;
- double constexpr twicePi = 2. * pi;
-
- template <class T> T sqr(T t) { return (t*t); }
-}
diff --git a/std/cstdint.hpp b/std/cstdint.hpp
index 724ef01c02..7ddc522906 100644
--- a/std/cstdint.hpp
+++ b/std/cstdint.hpp
@@ -5,7 +5,6 @@
#endif
#include <cstdint>
-#include <cstddef>
using std::int8_t;
using std::uint8_t;
@@ -15,7 +14,6 @@ using std::int32_t;
using std::uint32_t;
using std::int64_t;
using std::uint64_t;
-using std::size_t;
#ifdef DEBUG_NEW
#define new DEBUG_NEW
diff --git a/std/cstdlib.hpp b/std/cstdlib.hpp
index 8268726dcf..e119843d52 100644
--- a/std/cstdlib.hpp
+++ b/std/cstdlib.hpp
@@ -1,26 +1,11 @@
#pragma once
-#include "target_os.hpp"
-
#ifdef new
#undef new
#endif
#include <cstdlib>
-// setenv is absent in MSVC.
-#ifdef OMIM_OS_WINDOWS_NATIVE
-#include <cstdio> // Need it for snprintf.
-inline int setenv(char const * name, char const * value, int /*overwrite*/)
-{
- char buffer[255];
- int const err = ::snprintf(buffer, sizeof(buffer), "%s=%s", name, value);
- if (err < 0 || err >= sizeof(buffer))
- return -1;
- return ::_putenv(buffer);
-}
-#endif
-
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
diff --git a/std/iomanip.hpp b/std/iomanip.hpp
index ca0a576fc3..44335b367e 100644
--- a/std/iomanip.hpp
+++ b/std/iomanip.hpp
@@ -1,5 +1,4 @@
#pragma once
-#include "target_os.hpp"
#ifdef new
#undef new
@@ -12,65 +11,9 @@ using std::left;
using std::setfill;
using std::setprecision;
using std::setw;
-
-// TODO: Should we force clang/libc++ here?
-#ifndef OMIM_OS_LINUX
using std::get_time;
using std::put_time;
-#else
-#include <cassert>
-
-namespace detail
-{
- template <class _CharT> struct get_time_manip
- {
- tm* __tm_;
- const _CharT* __fmt_;
-
- get_time_manip(tm* __tm, const _CharT* __fmt)
- : __tm_(__tm), __fmt_(__fmt) {}
- };
-
- template <class _CharT, class _Traits>
- class stream_buf_impl : public std::basic_streambuf<_CharT, _Traits>
- {
- typedef std::basic_streambuf<_CharT, _Traits> base_t;
- public:
- bool parse(const get_time_manip<_CharT>& __x)
- {
- // Workaround works only for a stream buffer under null-terminated string.
- assert(*base_t::egptr() == 0);
-
- char * res = ::strptime(base_t::gptr(), __x.__fmt_, __x.__tm_);
- if (res == 0)
- return false;
- else
- {
- base_t::setg(base_t::eback(), res, base_t::egptr());
- return true;
- }
- }
- };
-
- template <class _CharT, class _Traits>
- std::basic_istream<_CharT, _Traits>&
- operator>>(std::basic_istream<_CharT, _Traits>& __is, const get_time_manip<_CharT>& __x)
- {
- if (!reinterpret_cast<stream_buf_impl<_CharT, _Traits>*>(__is.rdbuf())->parse(__x))
- __is.setstate(std::ios_base::failbit);
- return __is;
- }
-}
-
-template <class _CharT>
-detail::get_time_manip<_CharT> get_time(tm* __tm, const _CharT* __fmt)
-{
- return detail::get_time_manip<_CharT>(__tm, __fmt);
-}
-
-#endif
-
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
diff --git a/std/iostream.hpp b/std/iostream.hpp
index d9b6d0db8d..65ae380120 100644
--- a/std/iostream.hpp
+++ b/std/iostream.hpp
@@ -1,5 +1,4 @@
#pragma once
-#include "target_os.hpp"
#ifdef new
#undef new
@@ -16,12 +15,6 @@ using std::ostream;
using std::ios_base;
-#ifndef OMIM_OS_ANDROID
- using std::wcin;
- using std::wcout;
- using std::wcerr;
-#endif
-
using std::endl;
using std::flush;
diff --git a/std/systime.hpp b/std/systime.hpp
deleted file mode 100644
index bc6f52e09f..0000000000
--- a/std/systime.hpp
+++ /dev/null
@@ -1,22 +0,0 @@
-#pragma once
-
-#include "target_os.hpp"
-#include "ctime.hpp"
-
-#ifdef new
-#undef new
-#endif
-
-// for gettimeofday and GetSystemTimeAsFileTime
-#ifdef OMIM_OS_WINDOWS
- #include "windows.hpp"
- #ifdef OMIM_OS_WINDOWS_MINGW
- #define gettimeofday mingw_gettimeofday
- #endif
-#else
- #include <sys/time.h>
-#endif
-
-#ifdef DEBUG_NEW
-#define new DEBUG_NEW
-#endif
diff --git a/std/type_traits.hpp b/std/type_traits.hpp
index 0a8c78401e..df4d4565d2 100644
--- a/std/type_traits.hpp
+++ b/std/type_traits.hpp
@@ -1,5 +1,4 @@
#pragma once
-#include "target_os.hpp"
#ifdef new
#undef new
@@ -31,11 +30,6 @@ using std::result_of;
using std::false_type;
using std::true_type;
-/// @todo clang on linux doesn't have is_trivially_copyable.
-#ifndef OMIM_OS_LINUX
-using std::is_trivially_copyable;
-#endif
-
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
diff --git a/xcode/omim.xcworkspace/contents.xcworkspacedata b/xcode/omim.xcworkspace/contents.xcworkspacedata
index 508e37df1c..712c73dee4 100644
--- a/xcode/omim.xcworkspace/contents.xcworkspacedata
+++ b/xcode/omim.xcworkspace/contents.xcworkspacedata
@@ -140,9 +140,6 @@
location = "group:../std/string.hpp">
</FileRef>
<FileRef
- location = "group:../std/systime.hpp">
- </FileRef>
- <FileRef
location = "group:../std/target_os.hpp">
</FileRef>
<FileRef