| 1 |
/* { dg-do compile { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ |
| 2 |
// { dg-require-effective-target c++11 } |
| 3 |
// { dg-require-effective-target fpic } |
| 4 |
/* { dg-options "-O2 -fno-omit-frame-pointer -fPIC" } */ |
| 5 |
|
| 6 |
typedef int int32; |
| 7 |
typedef long long int64; |
| 8 |
typedef unsigned int uint32; |
| 9 |
typedef unsigned long long uint64; |
| 10 |
namespace std { |
| 11 |
typedef __SIZE_TYPE__ size_t; |
| 12 |
template<class _CharT> |
| 13 |
struct char_traits; |
| 14 |
template<typename _Tp> |
| 15 |
inline _Tp* __addressof(_Tp& __r) noexcept { |
| 16 |
return reinterpret_cast<_Tp*> (&const_cast<char&>(reinterpret_cast<const volatile char&>(__r))); |
| 17 |
} |
| 18 |
template<typename _Tp> |
| 19 |
struct remove_reference { |
| 20 |
typedef _Tp type; |
| 21 |
}; |
| 22 |
template<typename _Tp> |
| 23 |
constexpr _Tp&& forward(typename std::remove_reference<_Tp>::type& __t) noexcept { |
| 24 |
return static_cast<_Tp&&>(__t); |
| 25 |
} |
| 26 |
} |
| 27 |
typedef __SIZE_TYPE__ size_t; |
| 28 |
extern "C++" { |
| 29 |
inline void* operator new(std::size_t, void* __p) noexcept { |
| 30 |
return __p; |
| 31 |
} |
| 32 |
} |
| 33 |
namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) { |
| 34 |
template<typename _Tp> |
| 35 |
class new_allocator { |
| 36 |
public: |
| 37 |
typedef size_t size_type; |
| 38 |
typedef _Tp* pointer; |
| 39 |
}; |
| 40 |
} |
| 41 |
namespace std { |
| 42 |
template<typename _Tp> |
| 43 |
using __allocator_base = __gnu_cxx::new_allocator<_Tp>; |
| 44 |
template<typename _Tp> |
| 45 |
class allocator |
| 46 |
: public __allocator_base<_Tp> { |
| 47 |
public: |
| 48 |
typedef size_t size_type; |
| 49 |
template<typename _Tp1> |
| 50 |
struct rebind { |
| 51 |
typedef allocator<_Tp1> other; |
| 52 |
}; |
| 53 |
}; |
| 54 |
} |
| 55 |
namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) { |
| 56 |
template<typename _CharT, typename _Traits, typename _Alloc> |
| 57 |
class __sso_string_base; |
| 58 |
template<typename _CharT, typename _Traits = std::char_traits<_CharT>, typename _Alloc = std::allocator<_CharT>, template <typename, typename, typename> class _Base = __sso_string_base> |
| 59 |
class __versa_string; |
| 60 |
template<typename _CharT, typename _Traits, typename _Alloc> |
| 61 |
struct __vstring_utility { |
| 62 |
typedef typename _Alloc::template rebind<_CharT>::other _CharT_alloc_type; |
| 63 |
template<typename _Alloc1> |
| 64 |
struct _Alloc_hider |
| 65 |
: public _Alloc1 { |
| 66 |
_Alloc_hider(const _Alloc1& __a, _CharT* __ptr) |
| 67 |
: _Alloc1(__a), _M_p(__ptr) { |
| 68 |
} |
| 69 |
_CharT* _M_p; |
| 70 |
}; |
| 71 |
}; |
| 72 |
template<typename _CharT, typename _Traits, typename _Alloc> |
| 73 |
class __sso_string_base |
| 74 |
: protected __vstring_utility<_CharT, _Traits, _Alloc> { |
| 75 |
typedef __vstring_utility<_CharT, _Traits, _Alloc> _Util_Base; |
| 76 |
typedef typename _Util_Base::_CharT_alloc_type _CharT_alloc_type; |
| 77 |
typedef typename _CharT_alloc_type::size_type size_type; |
| 78 |
private: |
| 79 |
typename _Util_Base::template _Alloc_hider<_CharT_alloc_type> |
| 80 |
_M_dataplus; |
| 81 |
size_type _M_string_length; |
| 82 |
enum { |
| 83 |
_S_local_capacity = 15 }; |
| 84 |
union { |
| 85 |
_CharT _M_local_data[_S_local_capacity + 1]; |
| 86 |
}; |
| 87 |
template<typename _InIterator> |
| 88 |
void _M_construct(_InIterator __beg, _InIterator __end); |
| 89 |
public: |
| 90 |
size_type _M_max_size() const; |
| 91 |
_CharT* _M_data() const { |
| 92 |
return _M_dataplus._M_p; |
| 93 |
} |
| 94 |
size_type _M_length() const { |
| 95 |
return _M_string_length; |
| 96 |
} |
| 97 |
__sso_string_base(const __sso_string_base& __rcs); |
| 98 |
const _CharT_alloc_type& _M_get_allocator() const { |
| 99 |
static _CharT_alloc_type c; |
| 100 |
return c; |
| 101 |
} |
| 102 |
}; |
| 103 |
template<typename _CharT, typename _Traits, typename _Alloc> |
| 104 |
__sso_string_base<_CharT, _Traits, _Alloc>:: __sso_string_base(const __sso_string_base& __rcs) |
| 105 |
: _M_dataplus(__rcs._M_get_allocator(), _M_local_data) { |
| 106 |
_M_construct(__rcs._M_data(), __rcs._M_data() + __rcs._M_length()); |
| 107 |
} |
| 108 |
template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base> |
| 109 |
class __versa_string |
| 110 |
: private _Base<_CharT, _Traits, _Alloc> { |
| 111 |
}; |
| 112 |
} |
| 113 |
template<typename _CharT, typename _Traits = std::char_traits<_CharT>, typename _Alloc = std::allocator<_CharT> > |
| 114 |
class basic_string |
| 115 |
: public __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc> { |
| 116 |
}; |
| 117 |
typedef basic_string<char> string; |
| 118 |
namespace std __attribute__ ((__visibility__ ("default"))) { |
| 119 |
template<typename _Alloc, typename _Tp> |
| 120 |
class __alloctr_rebind_helper { |
| 121 |
public: |
| 122 |
static const bool __value = true; |
| 123 |
}; |
| 124 |
template<typename _Alloc, typename _Tp, bool = __alloctr_rebind_helper<_Alloc, _Tp>::__value> |
| 125 |
struct __alloctr_rebind; |
| 126 |
template<typename _Alloc, typename _Tp> struct __alloctr_rebind<_Alloc, _Tp, true> |
| 127 |
{ |
| 128 |
typedef typename _Alloc::template rebind<_Tp>::other __type; |
| 129 |
}; |
| 130 |
template<typename _Alloc> |
| 131 |
struct allocator_traits { |
| 132 |
private: |
| 133 |
template<typename _Tp> |
| 134 |
static typename _Tp::pointer _S_pointer_helper(_Tp*); |
| 135 |
typedef decltype(_S_pointer_helper((_Alloc*)0)) __pointer; |
| 136 |
public: |
| 137 |
typedef __pointer pointer; |
| 138 |
template<typename _Tp> |
| 139 |
using rebind_alloc = typename __alloctr_rebind<_Alloc, _Tp>::__type; |
| 140 |
}; |
| 141 |
} |
| 142 |
namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) { |
| 143 |
template<typename _Alloc> struct __alloc_traits |
| 144 |
: std::allocator_traits<_Alloc> |
| 145 |
{ |
| 146 |
typedef std::allocator_traits<_Alloc> _Base_type; |
| 147 |
template<typename _Tp> |
| 148 |
struct rebind { |
| 149 |
typedef typename _Base_type::template rebind_alloc<_Tp> |
| 150 |
other; |
| 151 |
}; |
| 152 |
}; |
| 153 |
} |
| 154 |
namespace std __attribute__ ((__visibility__ ("default"))) { |
| 155 |
template<typename _T1, typename... _Args> |
| 156 |
inline void _Construct(_T1* __p, _Args&&... __args) { |
| 157 |
::new(static_cast<void*>(__p)) _T1(std::forward<_Args>(__args)...); |
| 158 |
} |
| 159 |
template<typename _Tp, typename _Alloc> |
| 160 |
struct _Vector_base { |
| 161 |
typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template rebind<_Tp>::other _Tp_alloc_type; |
| 162 |
typedef typename __gnu_cxx::__alloc_traits<_Tp_alloc_type>::pointer pointer; |
| 163 |
struct _Vector_impl |
| 164 |
: public _Tp_alloc_type { |
| 165 |
pointer _M_start; |
| 166 |
pointer _M_finish; |
| 167 |
}; |
| 168 |
public: |
| 169 |
_Vector_impl _M_impl; |
| 170 |
}; |
| 171 |
template<typename _Tp, typename _Alloc = std::allocator<_Tp> > |
| 172 |
class vector |
| 173 |
: protected _Vector_base<_Tp, _Alloc> { |
| 174 |
typedef _Vector_base<_Tp, _Alloc> _Base; |
| 175 |
public: |
| 176 |
typedef _Tp value_type; |
| 177 |
typedef typename _Base::pointer pointer; |
| 178 |
typedef size_t size_type; |
| 179 |
size_type size() const; |
| 180 |
void push_back(const value_type& __x) { |
| 181 |
_M_emplace_back_aux(__x); |
| 182 |
} |
| 183 |
template<typename... _Args> |
| 184 |
void _M_emplace_back_aux(_Args&&... __args); |
| 185 |
size_type _M_check_len(); |
| 186 |
}; |
| 187 |
template<typename _Tp, typename _Alloc> template<typename... _Args> |
| 188 |
void vector<_Tp, _Alloc>:: _M_emplace_back_aux(_Args&&... __args) { |
| 189 |
const size_type __len = _M_check_len(); |
| 190 |
pointer __new_start(static_cast<pointer>(::operator new(__len * sizeof(_Tp)))); |
| 191 |
pointer __new_temp(__new_start + size()); |
| 192 |
::new((void *)__new_temp) _Tp(std::forward<_Args>(__args)...); |
| 193 |
pointer __cur = __new_start; |
| 194 |
pointer __first = this->_M_impl._M_start; |
| 195 |
pointer __last = this->_M_impl._M_finish; |
| 196 |
for (; |
| 197 |
__first != __last; |
| 198 |
++__first, ++__cur) std::_Construct(std::__addressof(*__cur), *__first); |
| 199 |
} |
| 200 |
} |
| 201 |
using std::vector; |
| 202 |
class DL { |
| 203 |
public: |
| 204 |
struct ChunkId { |
| 205 |
int64 disk_id; |
| 206 |
uint64 handle; |
| 207 |
uint64 version; |
| 208 |
string capability; |
| 209 |
ChunkId(); |
| 210 |
}; |
| 211 |
struct ChunkInfo { |
| 212 |
ChunkId id; |
| 213 |
uint64 mtime; |
| 214 |
uint32 length; |
| 215 |
int32 space_used; |
| 216 |
}; |
| 217 |
}; |
| 218 |
class FDB { |
| 219 |
void CollectChunk(const DL::ChunkInfo& chunk, const int& location); |
| 220 |
private: |
| 221 |
struct ChunkData { |
| 222 |
int location; |
| 223 |
DL::ChunkInfo chunk_info; |
| 224 |
}; |
| 225 |
vector<ChunkData> chunk_data_; |
| 226 |
}; |
| 227 |
void FDB::CollectChunk(const DL::ChunkInfo& chunk, const int& location) { |
| 228 |
ChunkData chunk_data; |
| 229 |
chunk_data_.push_back( chunk_data); |
| 230 |
} |