Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 6553 → Rev 6554

/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/chrono.cc
0,0 → 1,105
// chrono -*- C++ -*-
 
// Copyright (C) 2008-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
#include <bits/c++config.h>
#include <chrono>
 
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
 
// Conditional inclusion of sys/time.h for gettimeofday
#if !defined(_GLIBCXX_USE_CLOCK_MONOTONIC) && \
!defined(_GLIBCXX_USE_CLOCK_REALTIME) && \
defined(_GLIBCXX_USE_GETTIMEOFDAY)
#include <sys/time.h>
#endif
 
#ifdef _GLIBCXX_USE_CLOCK_GETTIME_SYSCALL
#include <unistd.h>
#include <sys/syscall.h>
#endif
 
namespace std _GLIBCXX_VISIBILITY(default)
{
namespace chrono
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
// XXX GLIBCXX_ABI Deprecated
inline namespace _V2 {
 
constexpr bool system_clock::is_steady;
 
system_clock::time_point
system_clock::now() noexcept
{
#ifdef _GLIBCXX_USE_CLOCK_REALTIME
timespec tp;
// -EINVAL, -EFAULT
#ifdef _GLIBCXX_USE_CLOCK_GETTIME_SYSCALL
syscall(SYS_clock_gettime, CLOCK_REALTIME, &tp);
#else
clock_gettime(CLOCK_REALTIME, &tp);
#endif
return time_point(duration(chrono::seconds(tp.tv_sec)
+ chrono::nanoseconds(tp.tv_nsec)));
#elif defined(_GLIBCXX_USE_GETTIMEOFDAY)
timeval tv;
// EINVAL, EFAULT
gettimeofday(&tv, 0);
return time_point(duration(chrono::seconds(tv.tv_sec)
+ chrono::microseconds(tv.tv_usec)));
#else
std::time_t __sec = std::time(0);
return system_clock::from_time_t(__sec);
#endif
}
 
constexpr bool steady_clock::is_steady;
 
steady_clock::time_point
steady_clock::now() noexcept
{
#ifdef _GLIBCXX_USE_CLOCK_MONOTONIC
timespec tp;
// -EINVAL, -EFAULT
#ifdef _GLIBCXX_USE_CLOCK_GETTIME_SYSCALL
syscall(SYS_clock_gettime, CLOCK_MONOTONIC, &tp);
#else
clock_gettime(CLOCK_MONOTONIC, &tp);
#endif
return time_point(duration(chrono::seconds(tp.tv_sec)
+ chrono::nanoseconds(tp.tv_nsec)));
#else
return time_point(system_clock::now().time_since_epoch());
#endif
}
 
} // end inline namespace _V2
 
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace chrono
} // namespace std
 
#endif // _GLIBCXX_USE_C99_STDINT_TR1
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/codecvt.cc
0,0 → 1,1453
// Locale support (codecvt) -*- C++ -*-
 
// Copyright (C) 2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
#include <codecvt>
#include <cstring> // std::memcpy, std::memcmp
#include <bits/stl_algobase.h> // std::max
 
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
namespace
{
// Largest code point that fits in a single UTF-16 code unit.
const char32_t max_single_utf16_unit = 0xFFFF;
 
const char32_t max_code_point = 0x10FFFF;
 
// The functions below rely on maxcode < incomplete_mb_character
// (which is enforced by the codecvt_utf* classes on construction).
const char32_t incomplete_mb_character = char32_t(-2);
const char32_t invalid_mb_sequence = char32_t(-1);
 
template<typename Elem>
struct range
{
Elem* next;
Elem* end;
 
Elem operator*() const { return *next; }
 
range& operator++() { ++next; return *this; }
 
size_t size() const { return end - next; }
};
 
// Multibyte sequences can have "header" consisting of Byte Order Mark
const unsigned char utf8_bom[3] = { 0xEF, 0xBB, 0xBF };
const unsigned char utf16_bom[4] = { 0xFE, 0xFF };
const unsigned char utf16le_bom[4] = { 0xFF, 0xFE };
 
template<size_t N>
inline bool
write_bom(range<char>& to, const unsigned char (&bom)[N])
{
if (to.size() < N)
return false;
memcpy(to.next, bom, N);
to.next += N;
return true;
}
 
// If generate_header is set in mode write out UTF-8 BOM.
bool
write_utf8_bom(range<char>& to, codecvt_mode mode)
{
if (mode & generate_header)
return write_bom(to, utf8_bom);
return true;
}
 
// If generate_header is set in mode write out the UTF-16 BOM indicated
// by whether little_endian is set in mode.
bool
write_utf16_bom(range<char16_t>& to, codecvt_mode mode)
{
if (mode & generate_header)
{
if (!to.size())
return false;
auto* bom = (mode & little_endian) ? utf16le_bom : utf16_bom;
std::memcpy(to.next, bom, 2);
++to.next;
}
return true;
}
 
template<size_t N>
inline bool
read_bom(range<const char>& from, const unsigned char (&bom)[N])
{
if (from.size() >= N && !memcmp(from.next, bom, N))
{
from.next += N;
return true;
}
return false;
}
 
// If consume_header is set in mode update from.next to after any BOM.
void
read_utf8_bom(range<const char>& from, codecvt_mode mode)
{
if (mode & consume_header)
read_bom(from, utf8_bom);
}
 
// If consume_header is set in mode update from.next to after any BOM.
// Return little_endian iff the UTF-16LE BOM was present.
codecvt_mode
read_utf16_bom(range<const char16_t>& from, codecvt_mode mode)
{
if (mode & consume_header && from.size())
{
if (*from.next == 0xFEFF)
++from.next;
else if (*from.next == 0xFFFE)
{
++from.next;
return little_endian;
}
}
return {};
}
 
// Read a codepoint from a UTF-8 multibyte sequence.
// Updates from.next if the codepoint is not greater than maxcode.
// Returns invalid_mb_sequence, incomplete_mb_character or the code point.
char32_t
read_utf8_code_point(range<const char>& from, unsigned long maxcode)
{
const size_t avail = from.size();
if (avail == 0)
return incomplete_mb_character;
unsigned char c1 = from.next[0];
// https://en.wikipedia.org/wiki/UTF-8#Sample_code
if (c1 < 0x80)
{
++from.next;
return c1;
}
else if (c1 < 0xC2) // continuation or overlong 2-byte sequence
return invalid_mb_sequence;
else if (c1 < 0xE0) // 2-byte sequence
{
if (avail < 2)
return incomplete_mb_character;
unsigned char c2 = from.next[1];
if ((c2 & 0xC0) != 0x80)
return invalid_mb_sequence;
char32_t c = (c1 << 6) + c2 - 0x3080;
if (c <= maxcode)
from.next += 2;
return c;
}
else if (c1 < 0xF0) // 3-byte sequence
{
if (avail < 3)
return incomplete_mb_character;
unsigned char c2 = from.next[1];
if ((c2 & 0xC0) != 0x80)
return invalid_mb_sequence;
if (c1 == 0xE0 && c2 < 0xA0) // overlong
return invalid_mb_sequence;
unsigned char c3 = from.next[2];
if ((c3 & 0xC0) != 0x80)
return invalid_mb_sequence;
char32_t c = (c1 << 12) + (c2 << 6) + c3 - 0xE2080;
if (c <= maxcode)
from.next += 3;
return c;
}
else if (c1 < 0xF5) // 4-byte sequence
{
if (avail < 4)
return incomplete_mb_character;
unsigned char c2 = from.next[1];
if ((c2 & 0xC0) != 0x80)
return invalid_mb_sequence;
if (c1 == 0xF0 && c2 < 0x90) // overlong
return invalid_mb_sequence;
if (c1 == 0xF4 && c2 >= 0x90) // > U+10FFFF
return invalid_mb_sequence;
unsigned char c3 = from.next[2];
if ((c3 & 0xC0) != 0x80)
return invalid_mb_sequence;
unsigned char c4 = from.next[3];
if ((c4 & 0xC0) != 0x80)
return invalid_mb_sequence;
char32_t c = (c1 << 18) + (c2 << 12) + (c3 << 6) + c4 - 0x3C82080;
if (c <= maxcode)
from.next += 4;
return c;
}
else // > U+10FFFF
return invalid_mb_sequence;
}
 
bool
write_utf8_code_point(range<char>& to, char32_t code_point)
{
if (code_point < 0x80)
{
if (to.size() < 1)
return false;
*to.next++ = code_point;
}
else if (code_point <= 0x7FF)
{
if (to.size() < 2)
return false;
*to.next++ = (code_point >> 6) + 0xC0;
*to.next++ = (code_point & 0x3F) + 0x80;
}
else if (code_point <= 0xFFFF)
{
if (to.size() < 3)
return false;
*to.next++ = (code_point >> 12) + 0xE0;
*to.next++ = ((code_point >> 6) & 0x3F) + 0x80;
*to.next++ = (code_point & 0x3F) + 0x80;
}
else if (code_point <= 0x10FFFF)
{
if (to.size() < 4)
return false;
*to.next++ = (code_point >> 18) + 0xF0;
*to.next++ = ((code_point >> 12) & 0x3F) + 0x80;
*to.next++ = ((code_point >> 6) & 0x3F) + 0x80;
*to.next++ = (code_point & 0x3F) + 0x80;
}
else
return false;
return true;
}
 
inline char16_t
adjust_byte_order(char16_t c, codecvt_mode mode)
{
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
return (mode & little_endian) ? __builtin_bswap16(c) : c;
#else
return (mode & little_endian) ? c : __builtin_bswap16(c);
#endif
}
 
// Return true if c is a high-surrogate (aka leading) code point.
inline bool
is_high_surrogate(char32_t c)
{
return c >= 0xD800 && c <= 0xDBFF;
}
 
// Return true if c is a low-surrogate (aka trailing) code point.
inline bool
is_low_surrogate(char32_t c)
{
return c >= 0xDC00 && c <= 0xDFFF;
}
 
inline char32_t
surrogate_pair_to_code_point(char32_t high, char32_t low)
{
return (high << 10) + low - 0x35FDC00;
}
 
// Read a codepoint from a UTF-16 multibyte sequence.
// The sequence's endianness is indicated by (mode & little_endian).
// Updates from.next if the codepoint is not greater than maxcode.
// Returns invalid_mb_sequence, incomplete_mb_character or the code point.
char32_t
read_utf16_code_point(range<const char16_t>& from, unsigned long maxcode,
codecvt_mode mode)
{
const size_t avail = from.size();
if (avail == 0)
return incomplete_mb_character;
int inc = 1;
char32_t c = adjust_byte_order(from.next[0], mode);
if (is_high_surrogate(c))
{
if (avail < 2)
return incomplete_mb_character;
const char16_t c2 = adjust_byte_order(from.next[1], mode);
if (is_low_surrogate(c2))
{
c = surrogate_pair_to_code_point(c, c2);
inc = 2;
}
else
return invalid_mb_sequence;
}
else if (is_low_surrogate(c))
return invalid_mb_sequence;
if (c <= maxcode)
from.next += inc;
return c;
}
 
template<typename C>
bool
write_utf16_code_point(range<C>& to, char32_t codepoint, codecvt_mode mode)
{
static_assert(sizeof(C) >= 2, "a code unit must be at least 16-bit");
 
if (codepoint < max_single_utf16_unit)
{
if (to.size() > 0)
{
*to.next = adjust_byte_order(codepoint, mode);
++to.next;
return true;
}
}
else if (to.size() > 1)
{
// Algorithm from http://www.unicode.org/faq/utf_bom.html#utf16-4
const char32_t LEAD_OFFSET = 0xD800 - (0x10000 >> 10);
char16_t lead = LEAD_OFFSET + (codepoint >> 10);
char16_t trail = 0xDC00 + (codepoint & 0x3FF);
to.next[0] = adjust_byte_order(lead, mode);
to.next[1] = adjust_byte_order(trail, mode);
to.next += 2;
return true;
}
return false;
}
 
// utf8 -> ucs4
codecvt_base::result
ucs4_in(range<const char>& from, range<char32_t>& to,
unsigned long maxcode = max_code_point, codecvt_mode mode = {})
{
read_utf8_bom(from, mode);
while (from.size() && to.size())
{
const char32_t codepoint = read_utf8_code_point(from, maxcode);
if (codepoint == incomplete_mb_character)
return codecvt_base::partial;
if (codepoint > maxcode)
return codecvt_base::error;
*to.next++ = codepoint;
}
return from.size() ? codecvt_base::partial : codecvt_base::ok;
}
 
// ucs4 -> utf8
codecvt_base::result
ucs4_out(range<const char32_t>& from, range<char>& to,
unsigned long maxcode = max_code_point, codecvt_mode mode = {})
{
if (!write_utf8_bom(to, mode))
return codecvt_base::partial;
while (from.size())
{
const char32_t c = from.next[0];
if (c > maxcode)
return codecvt_base::error;
if (!write_utf8_code_point(to, c))
return codecvt_base::partial;
++from.next;
}
return codecvt_base::ok;
}
 
// utf16 -> ucs4
codecvt_base::result
ucs4_in(range<const char16_t>& from, range<char32_t>& to,
unsigned long maxcode = max_code_point, codecvt_mode mode = {})
{
if (read_utf16_bom(from, mode) == little_endian)
mode = codecvt_mode(mode & little_endian);
while (from.size() && to.size())
{
const char32_t codepoint = read_utf16_code_point(from, maxcode, mode);
if (codepoint == incomplete_mb_character)
return codecvt_base::partial;
if (codepoint > maxcode)
return codecvt_base::error;
*to.next++ = codepoint;
}
return from.size() ? codecvt_base::partial : codecvt_base::ok;
}
 
// ucs4 -> utf16
codecvt_base::result
ucs4_out(range<const char32_t>& from, range<char16_t>& to,
unsigned long maxcode = max_code_point, codecvt_mode mode = {})
{
if (!write_utf16_bom(to, mode))
return codecvt_base::partial;
while (from.size())
{
const char32_t c = from.next[0];
if (c > maxcode)
return codecvt_base::error;
if (!write_utf16_code_point(to, c, mode))
return codecvt_base::partial;
++from.next;
}
return codecvt_base::ok;
}
 
// utf8 -> utf16
template<typename C>
codecvt_base::result
utf16_in(range<const char>& from, range<C>& to,
unsigned long maxcode = max_code_point, codecvt_mode mode = {})
{
read_utf8_bom(from, mode);
while (from.size() && to.size())
{
const char* const first = from.next;
const char32_t codepoint = read_utf8_code_point(from, maxcode);
if (codepoint == incomplete_mb_character)
return codecvt_base::partial;
if (codepoint > maxcode)
return codecvt_base::error;
if (!write_utf16_code_point(to, codepoint, mode))
{
from.next = first;
return codecvt_base::partial;
}
}
return codecvt_base::ok;
}
 
// utf16 -> utf8
template<typename C>
codecvt_base::result
utf16_out(range<const C>& from, range<char>& to,
unsigned long maxcode = max_code_point, codecvt_mode mode = {})
{
if (!write_utf8_bom(to, mode))
return codecvt_base::partial;
while (from.size())
{
char32_t c = from.next[0];
int inc = 1;
if (is_high_surrogate(c))
{
if (from.size() < 2)
return codecvt_base::ok; // stop converting at this point
 
const char32_t c2 = from.next[1];
if (is_low_surrogate(c2))
{
c = surrogate_pair_to_code_point(c, c2);
inc = 2;
}
else
return codecvt_base::error;
}
else if (is_low_surrogate(c))
return codecvt_base::error;
if (c > maxcode)
return codecvt_base::error;
if (!write_utf8_code_point(to, c))
return codecvt_base::partial;
from.next += inc;
}
return codecvt_base::ok;
}
 
// return pos such that [begin,pos) is valid UTF-16 string no longer than max
const char*
utf16_span(const char* begin, const char* end, size_t max,
char32_t maxcode = max_code_point, codecvt_mode mode = {})
{
range<const char> from{ begin, end };
read_utf8_bom(from, mode);
size_t count = 0;
while (count+1 < max)
{
char32_t c = read_utf8_code_point(from, maxcode);
if (c > maxcode)
return from.next;
else if (c > max_single_utf16_unit)
++count;
++count;
}
if (count+1 == max) // take one more character if it fits in a single unit
read_utf8_code_point(from, std::max(max_single_utf16_unit, maxcode));
return from.next;
}
 
// utf8 -> ucs2
codecvt_base::result
ucs2_in(range<const char>& from, range<char16_t>& to,
char32_t maxcode = max_code_point, codecvt_mode mode = {})
{
return utf16_in(from, to, std::max(max_single_utf16_unit, maxcode), mode);
}
 
// ucs2 -> utf8
codecvt_base::result
ucs2_out(range<const char16_t>& from, range<char>& to,
char32_t maxcode = max_code_point, codecvt_mode mode = {})
{
return utf16_out(from, to, std::max(max_single_utf16_unit, maxcode), mode);
}
 
// ucs2 -> utf16
codecvt_base::result
ucs2_out(range<const char16_t>& from, range<char16_t>& to,
char32_t maxcode = max_code_point, codecvt_mode mode = {})
{
if (!write_utf16_bom(to, mode))
return codecvt_base::partial;
while (from.size() && to.size())
{
char16_t c = from.next[0];
if (is_high_surrogate(c))
return codecvt_base::error;
if (c > maxcode)
return codecvt_base::error;
*to.next++ = adjust_byte_order(c, mode);
++from.next;
}
return from.size() == 0 ? codecvt_base::ok : codecvt_base::partial;
}
 
// utf16 -> ucs2
codecvt_base::result
ucs2_in(range<const char16_t>& from, range<char16_t>& to,
char32_t maxcode = max_code_point, codecvt_mode mode = {})
{
if (read_utf16_bom(from, mode) == little_endian)
mode = codecvt_mode(mode & little_endian);
maxcode = std::max(max_single_utf16_unit, maxcode);
while (from.size() && to.size())
{
const char32_t c = read_utf16_code_point(from, maxcode, mode);
if (c == incomplete_mb_character)
return codecvt_base::partial;
if (c > maxcode)
return codecvt_base::error;
*to.next++ = c;
}
return from.size() == 0 ? codecvt_base::ok : codecvt_base::partial;
}
 
const char16_t*
ucs2_span(const char16_t* begin, const char16_t* end, size_t max,
char32_t maxcode, codecvt_mode mode)
{
range<const char16_t> from{ begin, end };
if (read_utf16_bom(from, mode) == little_endian)
mode = codecvt_mode(mode & little_endian);
maxcode = std::max(max_single_utf16_unit, maxcode);
char32_t c = 0;
while (max-- && c <= maxcode)
c = read_utf16_code_point(from, maxcode, mode);
return from.next;
}
 
const char*
ucs2_span(const char* begin, const char* end, size_t max,
char32_t maxcode, codecvt_mode mode)
{
range<const char> from{ begin, end };
read_utf8_bom(from, mode);
maxcode = std::max(max_single_utf16_unit, maxcode);
char32_t c = 0;
while (max-- && c <= maxcode)
c = read_utf8_code_point(from, maxcode);
return from.next;
}
 
// return pos such that [begin,pos) is valid UCS-4 string no longer than max
const char*
ucs4_span(const char* begin, const char* end, size_t max,
char32_t maxcode = max_code_point, codecvt_mode mode = {})
{
range<const char> from{ begin, end };
read_utf8_bom(from, mode);
char32_t c = 0;
while (max-- && c <= maxcode)
c = read_utf8_code_point(from, maxcode);
return from.next;
}
 
// return pos such that [begin,pos) is valid UCS-4 string no longer than max
const char16_t*
ucs4_span(const char16_t* begin, const char16_t* end, size_t max,
char32_t maxcode = max_code_point, codecvt_mode mode = {})
{
range<const char16_t> from{ begin, end };
if (read_utf16_bom(from, mode) == little_endian)
mode = codecvt_mode(mode & little_endian);
char32_t c = 0;
while (max-- && c <= maxcode)
c = read_utf16_code_point(from, maxcode, mode);
return from.next;
}
}
 
// Define members of codecvt<char16_t, char, mbstate_t> specialization.
// Converts from UTF-8 to UTF-16.
 
locale::id codecvt<char16_t, char, mbstate_t>::id;
 
codecvt<char16_t, char, mbstate_t>::~codecvt() { }
 
codecvt_base::result
codecvt<char16_t, char, mbstate_t>::
do_out(state_type&,
const intern_type* __from,
const intern_type* __from_end, const intern_type*& __from_next,
extern_type* __to, extern_type* __to_end,
extern_type*& __to_next) const
{
range<const char16_t> from{ __from, __from_end };
range<char> to{ __to, __to_end };
auto res = utf16_out(from, to);
__from_next = from.next;
__to_next = to.next;
return res;
}
 
codecvt_base::result
codecvt<char16_t, char, mbstate_t>::
do_unshift(state_type&, extern_type* __to, extern_type*,
extern_type*& __to_next) const
{
__to_next = __to;
return noconv; // we don't use mbstate_t for the unicode facets
}
 
codecvt_base::result
codecvt<char16_t, char, mbstate_t>::
do_in(state_type&, const extern_type* __from, const extern_type* __from_end,
const extern_type*& __from_next,
intern_type* __to, intern_type* __to_end,
intern_type*& __to_next) const
{
range<const char> from{ __from, __from_end };
range<char16_t> to{ __to, __to_end };
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
codecvt_mode mode = {};
#else
codecvt_mode mode = little_endian;
#endif
auto res = utf16_in(from, to, max_code_point, mode);
__from_next = from.next;
__to_next = to.next;
return res;
}
 
int
codecvt<char16_t, char, mbstate_t>::do_encoding() const throw()
{ return 0; }
 
bool
codecvt<char16_t, char, mbstate_t>::do_always_noconv() const throw()
{ return false; }
 
int
codecvt<char16_t, char, mbstate_t>::
do_length(state_type&, const extern_type* __from,
const extern_type* __end, size_t __max) const
{
__end = utf16_span(__from, __end, __max);
return __end - __from;
}
 
int
codecvt<char16_t, char, mbstate_t>::do_max_length() const throw()
{
// Any valid UTF-8 sequence of 3 bytes fits in a single 16-bit code unit,
// whereas 4 byte sequences require two 16-bit code units.
return 3;
}
 
// Define members of codecvt<char32_t, char, mbstate_t> specialization.
// Converts from UTF-8 to UTF-32 (aka UCS-4).
 
locale::id codecvt<char32_t, char, mbstate_t>::id;
 
codecvt<char32_t, char, mbstate_t>::~codecvt() { }
 
codecvt_base::result
codecvt<char32_t, char, mbstate_t>::
do_out(state_type&, const intern_type* __from, const intern_type* __from_end,
const intern_type*& __from_next,
extern_type* __to, extern_type* __to_end,
extern_type*& __to_next) const
{
range<const char32_t> from{ __from, __from_end };
range<char> to{ __to, __to_end };
auto res = ucs4_out(from, to);
__from_next = from.next;
__to_next = to.next;
return res;
}
 
codecvt_base::result
codecvt<char32_t, char, mbstate_t>::
do_unshift(state_type&, extern_type* __to, extern_type*,
extern_type*& __to_next) const
{
__to_next = __to;
return noconv;
}
 
codecvt_base::result
codecvt<char32_t, char, mbstate_t>::
do_in(state_type&, const extern_type* __from, const extern_type* __from_end,
const extern_type*& __from_next,
intern_type* __to, intern_type* __to_end,
intern_type*& __to_next) const
{
range<const char> from{ __from, __from_end };
range<char32_t> to{ __to, __to_end };
auto res = ucs4_in(from, to);
__from_next = from.next;
__to_next = to.next;
return res;
}
 
int
codecvt<char32_t, char, mbstate_t>::do_encoding() const throw()
{ return 0; }
 
bool
codecvt<char32_t, char, mbstate_t>::do_always_noconv() const throw()
{ return false; }
 
int
codecvt<char32_t, char, mbstate_t>::
do_length(state_type&, const extern_type* __from,
const extern_type* __end, size_t __max) const
{
__end = ucs4_span(__from, __end, __max);
return __end - __from;
}
 
int
codecvt<char32_t, char, mbstate_t>::do_max_length() const throw()
{ return 4; }
 
// Define members of codecvt_utf8<char16_t> base class implementation.
// Converts from UTF-8 to UCS-2.
 
__codecvt_utf8_base<char16_t>::~__codecvt_utf8_base() { }
 
codecvt_base::result
__codecvt_utf8_base<char16_t>::
do_out(state_type&, const intern_type* __from, const intern_type* __from_end,
const intern_type*& __from_next,
extern_type* __to, extern_type* __to_end,
extern_type*& __to_next) const
{
range<const char16_t> from{ __from, __from_end };
range<char> to{ __to, __to_end };
auto res = ucs2_out(from, to, _M_maxcode, _M_mode);
__from_next = from.next;
__to_next = to.next;
return res;
}
 
codecvt_base::result
__codecvt_utf8_base<char16_t>::
do_unshift(state_type&, extern_type* __to, extern_type*,
extern_type*& __to_next) const
{
__to_next = __to;
return noconv;
}
 
codecvt_base::result
__codecvt_utf8_base<char16_t>::
do_in(state_type&, const extern_type* __from, const extern_type* __from_end,
const extern_type*& __from_next,
intern_type* __to, intern_type* __to_end,
intern_type*& __to_next) const
{
range<const char> from{ __from, __from_end };
range<char16_t> to{ __to, __to_end };
codecvt_mode mode = codecvt_mode(_M_mode & (consume_header|generate_header));
#if __BYTE_ORDER__ != __ORDER_BIG_ENDIAN__
mode = codecvt_mode(mode | little_endian);
#endif
auto res = ucs2_in(from, to, _M_maxcode, mode);
__from_next = from.next;
__to_next = to.next;
return res;
}
 
int
__codecvt_utf8_base<char16_t>::do_encoding() const throw()
{ return 0; }
 
bool
__codecvt_utf8_base<char16_t>::do_always_noconv() const throw()
{ return false; }
 
int
__codecvt_utf8_base<char16_t>::
do_length(state_type&, const extern_type* __from,
const extern_type* __end, size_t __max) const
{
__end = ucs2_span(__from, __end, __max, _M_maxcode, _M_mode);
return __end - __from;
}
 
int
__codecvt_utf8_base<char16_t>::do_max_length() const throw()
{ return 3; }
 
// Define members of codecvt_utf8<char32_t> base class implementation.
// Converts from UTF-8 to UTF-32 (aka UCS-4).
 
__codecvt_utf8_base<char32_t>::~__codecvt_utf8_base() { }
 
codecvt_base::result
__codecvt_utf8_base<char32_t>::
do_out(state_type&, const intern_type* __from, const intern_type* __from_end,
const intern_type*& __from_next,
extern_type* __to, extern_type* __to_end,
extern_type*& __to_next) const
{
range<const char32_t> from{ __from, __from_end };
range<char> to{ __to, __to_end };
auto res = ucs4_out(from, to, _M_maxcode, _M_mode);
__from_next = from.next;
__to_next = to.next;
return res;
}
 
codecvt_base::result
__codecvt_utf8_base<char32_t>::
do_unshift(state_type&, extern_type* __to, extern_type*,
extern_type*& __to_next) const
{
__to_next = __to;
return noconv;
}
 
codecvt_base::result
__codecvt_utf8_base<char32_t>::
do_in(state_type&, const extern_type* __from, const extern_type* __from_end,
const extern_type*& __from_next,
intern_type* __to, intern_type* __to_end,
intern_type*& __to_next) const
{
range<const char> from{ __from, __from_end };
range<char32_t> to{ __to, __to_end };
auto res = ucs4_in(from, to, _M_maxcode, _M_mode);
__from_next = from.next;
__to_next = to.next;
return res;
}
 
int
__codecvt_utf8_base<char32_t>::do_encoding() const throw()
{ return 0; }
 
bool
__codecvt_utf8_base<char32_t>::do_always_noconv() const throw()
{ return false; }
 
int
__codecvt_utf8_base<char32_t>::
do_length(state_type&, const extern_type* __from,
const extern_type* __end, size_t __max) const
{
__end = ucs4_span(__from, __end, __max, _M_maxcode, _M_mode);
return __end - __from;
}
 
int
__codecvt_utf8_base<char32_t>::do_max_length() const throw()
{ return 4; }
 
#ifdef _GLIBCXX_USE_WCHAR_T
// Define members of codecvt_utf8<wchar_t> base class implementation.
// Converts from UTF-8 to UCS-2 or UCS-4 depending on sizeof(wchar_t).
 
__codecvt_utf8_base<wchar_t>::~__codecvt_utf8_base() { }
 
codecvt_base::result
__codecvt_utf8_base<wchar_t>::
do_out(state_type&, const intern_type* __from, const intern_type* __from_end,
const intern_type*& __from_next,
extern_type* __to, extern_type* __to_end,
extern_type*& __to_next) const
{
range<char> to{ __to, __to_end };
#if __SIZEOF_WCHAR_T__ == 2
range<const char16_t> from{
reinterpret_cast<const char16_t*>(__from),
reinterpret_cast<const char16_t*>(__from_end)
};
auto res = ucs2_out(from, to, _M_maxcode, _M_mode);
#elif __SIZEOF_WCHAR_T__ == 4
range<const char32_t> from{
reinterpret_cast<const char32_t*>(__from),
reinterpret_cast<const char32_t*>(__from_end)
};
auto res = ucs4_out(from, to, _M_maxcode, _M_mode);
#else
return codecvt_base::error;
#endif
__from_next = reinterpret_cast<const wchar_t*>(from.next);
__to_next = to.next;
return res;
}
 
codecvt_base::result
__codecvt_utf8_base<wchar_t>::
do_unshift(state_type&, extern_type* __to, extern_type*,
extern_type*& __to_next) const
{
__to_next = __to;
return noconv;
}
 
codecvt_base::result
__codecvt_utf8_base<wchar_t>::
do_in(state_type&, const extern_type* __from, const extern_type* __from_end,
const extern_type*& __from_next,
intern_type* __to, intern_type* __to_end,
intern_type*& __to_next) const
{
range<const char> from{ __from, __from_end };
#if __SIZEOF_WCHAR_T__ == 2
range<char16_t> to{
reinterpret_cast<char16_t*>(__to),
reinterpret_cast<char16_t*>(__to_end)
};
auto res = ucs2_in(from, to, _M_maxcode, _M_mode);
#elif __SIZEOF_WCHAR_T__ == 4
range<char32_t> to{
reinterpret_cast<char32_t*>(__to),
reinterpret_cast<char32_t*>(__to_end)
};
auto res = ucs4_in(from, to, _M_maxcode, _M_mode);
#else
return codecvt_base::error;
#endif
__from_next = from.next;
__to_next = reinterpret_cast<wchar_t*>(to.next);
return res;
}
 
int
__codecvt_utf8_base<wchar_t>::do_encoding() const throw()
{ return 0; }
 
bool
__codecvt_utf8_base<wchar_t>::do_always_noconv() const throw()
{ return false; }
 
int
__codecvt_utf8_base<wchar_t>::
do_length(state_type&, const extern_type* __from,
const extern_type* __end, size_t __max) const
{
#if __SIZEOF_WCHAR_T__ == 2
__end = ucs2_span(__from, __end, __max, _M_maxcode, _M_mode);
#elif __SIZEOF_WCHAR_T__ == 4
__end = ucs4_span(__from, __end, __max, _M_maxcode, _M_mode);
#else
__end = __from;
#endif
return __end - __from;
}
 
int
__codecvt_utf8_base<wchar_t>::do_max_length() const throw()
{ return 4; }
#endif
 
// Define members of codecvt_utf16<char16_t> base class implementation.
// Converts from UTF-16 to UCS-2.
 
__codecvt_utf16_base<char16_t>::~__codecvt_utf16_base() { }
 
codecvt_base::result
__codecvt_utf16_base<char16_t>::
do_out(state_type&, const intern_type* __from, const intern_type* __from_end,
const intern_type*& __from_next,
extern_type* __to, extern_type* __to_end,
extern_type*& __to_next) const
{
range<const char16_t> from{ __from, __from_end };
range<char16_t> to{
reinterpret_cast<char16_t*>(__to),
reinterpret_cast<char16_t*>(__to_end)
};
auto res = ucs2_out(from, to, _M_maxcode, _M_mode);
__from_next = from.next;
__to_next = reinterpret_cast<char*>(to.next);
return res;
}
 
codecvt_base::result
__codecvt_utf16_base<char16_t>::
do_unshift(state_type&, extern_type* __to, extern_type*,
extern_type*& __to_next) const
{
__to_next = __to;
return noconv;
}
 
codecvt_base::result
__codecvt_utf16_base<char16_t>::
do_in(state_type&, const extern_type* __from, const extern_type* __from_end,
const extern_type*& __from_next,
intern_type* __to, intern_type* __to_end,
intern_type*& __to_next) const
{
range<const char16_t> from{
reinterpret_cast<const char16_t*>(__from),
reinterpret_cast<const char16_t*>(__from_end)
};
range<char16_t> to{ __to, __to_end };
auto res = ucs2_in(from, to, _M_maxcode, _M_mode);
__from_next = reinterpret_cast<const char*>(from.next);
__to_next = to.next;
return res;
}
 
int
__codecvt_utf16_base<char16_t>::do_encoding() const throw()
{ return 1; }
 
bool
__codecvt_utf16_base<char16_t>::do_always_noconv() const throw()
{ return false; }
 
int
__codecvt_utf16_base<char16_t>::
do_length(state_type&, const extern_type* __from,
const extern_type* __end, size_t __max) const
{
auto next = reinterpret_cast<const char16_t*>(__from);
next = ucs2_span(next, reinterpret_cast<const char16_t*>(__end), __max,
_M_maxcode, _M_mode);
return reinterpret_cast<const char*>(next) - __from;
}
 
int
__codecvt_utf16_base<char16_t>::do_max_length() const throw()
{ return 3; }
 
// Define members of codecvt_utf16<char32_t> base class implementation.
// Converts from UTF-16 to UTF-32 (aka UCS-4).
 
__codecvt_utf16_base<char32_t>::~__codecvt_utf16_base() { }
 
codecvt_base::result
__codecvt_utf16_base<char32_t>::
do_out(state_type&, const intern_type* __from, const intern_type* __from_end,
const intern_type*& __from_next,
extern_type* __to, extern_type* __to_end,
extern_type*& __to_next) const
{
range<const char32_t> from{ __from, __from_end };
range<char16_t> to{
reinterpret_cast<char16_t*>(__to),
reinterpret_cast<char16_t*>(__to_end)
};
auto res = ucs4_out(from, to, _M_maxcode, _M_mode);
__from_next = from.next;
__to_next = reinterpret_cast<char*>(to.next);
return res;
}
 
codecvt_base::result
__codecvt_utf16_base<char32_t>::
do_unshift(state_type&, extern_type* __to, extern_type*,
extern_type*& __to_next) const
{
__to_next = __to;
return noconv;
}
 
codecvt_base::result
__codecvt_utf16_base<char32_t>::
do_in(state_type&, const extern_type* __from, const extern_type* __from_end,
const extern_type*& __from_next,
intern_type* __to, intern_type* __to_end,
intern_type*& __to_next) const
{
range<const char16_t> from{
reinterpret_cast<const char16_t*>(__from),
reinterpret_cast<const char16_t*>(__from_end)
};
range<char32_t> to{ __to, __to_end };
auto res = ucs4_in(from, to, _M_maxcode, _M_mode);
__from_next = reinterpret_cast<const char*>(from.next);
__to_next = to.next;
return res;
}
 
int
__codecvt_utf16_base<char32_t>::do_encoding() const throw()
{ return 0; }
 
bool
__codecvt_utf16_base<char32_t>::do_always_noconv() const throw()
{ return false; }
 
int
__codecvt_utf16_base<char32_t>::
do_length(state_type&, const extern_type* __from,
const extern_type* __end, size_t __max) const
{
auto next = reinterpret_cast<const char16_t*>(__from);
next = ucs4_span(next, reinterpret_cast<const char16_t*>(__end), __max,
_M_maxcode, _M_mode);
return reinterpret_cast<const char*>(next) - __from;
}
 
int
__codecvt_utf16_base<char32_t>::do_max_length() const throw()
{ return 4; }
 
#ifdef _GLIBCXX_USE_WCHAR_T
// Define members of codecvt_utf16<wchar_t> base class implementation.
// Converts from UTF-8 to UCS-2 or UCS-4 depending on sizeof(wchar_t).
 
__codecvt_utf16_base<wchar_t>::~__codecvt_utf16_base() { }
 
codecvt_base::result
__codecvt_utf16_base<wchar_t>::
do_out(state_type&, const intern_type* __from, const intern_type* __from_end,
const intern_type*& __from_next,
extern_type* __to, extern_type* __to_end,
extern_type*& __to_next) const
{
range<char> to{ __to, __to_end };
#if __SIZEOF_WCHAR_T__ == 2
range<const char16_t> from{
reinterpret_cast<const char16_t*>(__from),
reinterpret_cast<const char16_t*>(__from_end)
};
auto res = ucs2_out(from, to, _M_maxcode, _M_mode);
#elif __SIZEOF_WCHAR_T__ == 4
range<const char32_t> from{
reinterpret_cast<const char32_t*>(__from),
reinterpret_cast<const char32_t*>(__from_end)
};
auto res = ucs4_out(from, to, _M_maxcode, _M_mode);
#else
return codecvt_base::error;
#endif
__from_next = reinterpret_cast<const wchar_t*>(from.next);
__to_next = to.next;
return res;
}
 
codecvt_base::result
__codecvt_utf16_base<wchar_t>::
do_unshift(state_type&, extern_type* __to, extern_type*,
extern_type*& __to_next) const
{
__to_next = __to;
return noconv;
}
 
codecvt_base::result
__codecvt_utf16_base<wchar_t>::
do_in(state_type&, const extern_type* __from, const extern_type* __from_end,
const extern_type*& __from_next,
intern_type* __to, intern_type* __to_end,
intern_type*& __to_next) const
{
range<const char> from{ __from, __from_end };
#if __SIZEOF_WCHAR_T__ == 2
range<char16_t> to{
reinterpret_cast<char16_t*>(__to),
reinterpret_cast<char16_t*>(__to_end)
};
auto res = ucs2_in(from, to, _M_maxcode, _M_mode);
#elif __SIZEOF_WCHAR_T__ == 4
range<char32_t> to{
reinterpret_cast<char32_t*>(__to),
reinterpret_cast<char32_t*>(__to_end)
};
auto res = ucs4_in(from, to, _M_maxcode, _M_mode);
#else
return codecvt_base::error;
#endif
__from_next = from.next;
__to_next = reinterpret_cast<wchar_t*>(to.next);
return res;
}
 
int
__codecvt_utf16_base<wchar_t>::do_encoding() const throw()
{ return 0; }
 
bool
__codecvt_utf16_base<wchar_t>::do_always_noconv() const throw()
{ return false; }
 
int
__codecvt_utf16_base<wchar_t>::
do_length(state_type&, const extern_type* __from,
const extern_type* __end, size_t __max) const
{
auto next = reinterpret_cast<const char16_t*>(__from);
#if __SIZEOF_WCHAR_T__ == 2
next = ucs2_span(next, reinterpret_cast<const char16_t*>(__end), __max,
_M_maxcode, _M_mode);
#elif __SIZEOF_WCHAR_T__ == 4
next = ucs4_span(next, reinterpret_cast<const char16_t*>(__end), __max,
_M_maxcode, _M_mode);
#endif
return reinterpret_cast<const char*>(next) - __from;
}
 
int
__codecvt_utf16_base<wchar_t>::do_max_length() const throw()
{ return 4; }
#endif
 
// Define members of codecvt_utf8_utf16<char16_t> base class implementation.
// Converts from UTF-8 to UTF-16.
 
__codecvt_utf8_utf16_base<char16_t>::~__codecvt_utf8_utf16_base() { }
 
codecvt_base::result
__codecvt_utf8_utf16_base<char16_t>::
do_out(state_type&, const intern_type* __from, const intern_type* __from_end,
const intern_type*& __from_next,
extern_type* __to, extern_type* __to_end,
extern_type*& __to_next) const
{
range<const char16_t> from{ __from, __from_end };
range<char> to{ __to, __to_end };
auto res = utf16_out(from, to, _M_maxcode, _M_mode);
__from_next = from.next;
__to_next = to.next;
return res;
}
 
codecvt_base::result
__codecvt_utf8_utf16_base<char16_t>::
do_unshift(state_type&, extern_type* __to, extern_type*,
extern_type*& __to_next) const
{
__to_next = __to;
return noconv;
}
 
codecvt_base::result
__codecvt_utf8_utf16_base<char16_t>::
do_in(state_type&, const extern_type* __from, const extern_type* __from_end,
const extern_type*& __from_next,
intern_type* __to, intern_type* __to_end,
intern_type*& __to_next) const
{
range<const char> from{ __from, __from_end };
range<char16_t> to{ __to, __to_end };
codecvt_mode mode = codecvt_mode(_M_mode & (consume_header|generate_header));
#if __BYTE_ORDER__ != __ORDER_BIG_ENDIAN__
mode = codecvt_mode(mode | little_endian);
#endif
auto res = utf16_in(from, to, _M_maxcode, mode);
__from_next = from.next;
__to_next = to.next;
return res;
}
 
int
__codecvt_utf8_utf16_base<char16_t>::do_encoding() const throw()
{ return 0; }
 
bool
__codecvt_utf8_utf16_base<char16_t>::do_always_noconv() const throw()
{ return false; }
 
int
__codecvt_utf8_utf16_base<char16_t>::
do_length(state_type&, const extern_type* __from,
const extern_type* __end, size_t __max) const
{
__end = utf16_span(__from, __end, __max, _M_maxcode, _M_mode);
return __end - __from;
}
 
int
__codecvt_utf8_utf16_base<char16_t>::do_max_length() const throw()
{
// Any valid UTF-8 sequence of 3 bytes fits in a single 16-bit code unit,
// whereas 4 byte sequences require two 16-bit code units.
return 3;
}
 
// Define members of codecvt_utf8_utf16<char32_t> base class implementation.
// Converts from UTF-8 to UTF-16.
 
__codecvt_utf8_utf16_base<char32_t>::~__codecvt_utf8_utf16_base() { }
 
codecvt_base::result
__codecvt_utf8_utf16_base<char32_t>::
do_out(state_type&, const intern_type* __from, const intern_type* __from_end,
const intern_type*& __from_next,
extern_type* __to, extern_type* __to_end,
extern_type*& __to_next) const
{
range<const char32_t> from{ __from, __from_end };
range<char> to{ __to, __to_end };
auto res = utf16_out(from, to, _M_maxcode, _M_mode);
__from_next = from.next;
__to_next = to.next;
return res;
}
 
codecvt_base::result
__codecvt_utf8_utf16_base<char32_t>::
do_unshift(state_type&, extern_type* __to, extern_type*,
extern_type*& __to_next) const
{
__to_next = __to;
return noconv;
}
 
codecvt_base::result
__codecvt_utf8_utf16_base<char32_t>::
do_in(state_type&, const extern_type* __from, const extern_type* __from_end,
const extern_type*& __from_next,
intern_type* __to, intern_type* __to_end,
intern_type*& __to_next) const
{
range<const char> from{ __from, __from_end };
range<char32_t> to{ __to, __to_end };
auto res = utf16_in(from, to, _M_maxcode, _M_mode);
__from_next = from.next;
__to_next = to.next;
return res;
}
 
int
__codecvt_utf8_utf16_base<char32_t>::do_encoding() const throw()
{ return 0; }
 
bool
__codecvt_utf8_utf16_base<char32_t>::do_always_noconv() const throw()
{ return false; }
 
int
__codecvt_utf8_utf16_base<char32_t>::
do_length(state_type&, const extern_type* __from,
const extern_type* __end, size_t __max) const
{
__end = utf16_span(__from, __end, __max, _M_maxcode, _M_mode);
return __end - __from;
}
 
int
__codecvt_utf8_utf16_base<char32_t>::do_max_length() const throw()
{
// Any valid UTF-8 sequence of 3 bytes fits in a single 16-bit code unit,
// whereas 4 byte sequences require two 16-bit code units.
return 3;
}
 
#ifdef _GLIBCXX_USE_WCHAR_T
// Define members of codecvt_utf8_utf16<wchar_t> base class implementation.
// Converts from UTF-8 to UTF-16.
 
__codecvt_utf8_utf16_base<wchar_t>::~__codecvt_utf8_utf16_base() { }
 
codecvt_base::result
__codecvt_utf8_utf16_base<wchar_t>::
do_out(state_type&, const intern_type* __from, const intern_type* __from_end,
const intern_type*& __from_next,
extern_type* __to, extern_type* __to_end,
extern_type*& __to_next) const
{
range<const wchar_t> from{ __from, __from_end };
range<char> to{ __to, __to_end };
auto res = utf16_out(from, to, _M_maxcode, _M_mode);
__from_next = from.next;
__to_next = to.next;
return res;
}
 
codecvt_base::result
__codecvt_utf8_utf16_base<wchar_t>::
do_unshift(state_type&, extern_type* __to, extern_type*,
extern_type*& __to_next) const
{
__to_next = __to;
return noconv;
}
 
codecvt_base::result
__codecvt_utf8_utf16_base<wchar_t>::
do_in(state_type&, const extern_type* __from, const extern_type* __from_end,
const extern_type*& __from_next,
intern_type* __to, intern_type* __to_end,
intern_type*& __to_next) const
{
range<const char> from{ __from, __from_end };
range<wchar_t> to{ __to, __to_end };
auto res = utf16_in(from, to, _M_maxcode, _M_mode);
__from_next = from.next;
__to_next = to.next;
return res;
}
 
int
__codecvt_utf8_utf16_base<wchar_t>::do_encoding() const throw()
{ return 0; }
 
bool
__codecvt_utf8_utf16_base<wchar_t>::do_always_noconv() const throw()
{ return false; }
 
int
__codecvt_utf8_utf16_base<wchar_t>::
do_length(state_type&, const extern_type* __from,
const extern_type* __end, size_t __max) const
{
__end = utf16_span(__from, __end, __max, _M_maxcode, _M_mode);
return __end - __from;
}
 
int
__codecvt_utf8_utf16_base<wchar_t>::do_max_length() const throw()
{
// Any valid UTF-8 sequence of 3 bytes fits in a single 16-bit code unit,
// whereas 4 byte sequences require two 16-bit code units.
return 3;
}
#endif
 
inline template class __codecvt_abstract_base<char16_t, char, mbstate_t>;
inline template class __codecvt_abstract_base<char32_t, char, mbstate_t>;
template class codecvt_byname<char16_t, char, mbstate_t>;
template class codecvt_byname<char32_t, char, mbstate_t>;
 
_GLIBCXX_END_NAMESPACE_VERSION
}
#endif // _GLIBCXX_USE_C99_STDINT_TR1
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/compatibility-atomic-c++0x.cc
0,0 → 1,160
// <atomic> compatibility -*- C++ -*-
 
// Copyright (C) 2008-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
#include "gstdint.h"
#include <atomic>
#include <mutex>
 
// XXX GLIBCXX_ABI Deprecated
// gcc-4.7.0
 
#ifdef _GLIBCXX_SHARED
 
#define LOGSIZE 4
 
namespace
{
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
std::mutex&
get_atomic_mutex()
{
static std::mutex atomic_mutex;
return atomic_mutex;
}
#endif
 
std::__atomic_flag_base flag_table[ 1 << LOGSIZE ] =
{
ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT,
ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT,
ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT,
ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT,
};
} // anonymous namespace
 
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
namespace __atomic0
{
 
struct atomic_flag : public __atomic_flag_base
{
bool
test_and_set(memory_order) noexcept;
void
clear(memory_order) noexcept;
};
 
bool
atomic_flag::test_and_set(memory_order) noexcept
{
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
lock_guard<mutex> __lock(get_atomic_mutex());
#endif
bool result = _M_i;
_M_i = true;
return result;
}
 
void
atomic_flag::clear(memory_order) noexcept
{
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
lock_guard<mutex> __lock(get_atomic_mutex());
#endif
_M_i = false;
}
} // namespace __atomic0
 
_GLIBCXX_BEGIN_EXTERN_C
 
bool
atomic_flag_test_and_set_explicit(__atomic_flag_base* __a,
memory_order __m) _GLIBCXX_NOTHROW
{
atomic_flag* d = static_cast<atomic_flag*>(__a);
return d->test_and_set(__m);
}
 
void
atomic_flag_clear_explicit(__atomic_flag_base* __a,
memory_order __m) _GLIBCXX_NOTHROW
{
atomic_flag* d = static_cast<atomic_flag*>(__a);
return d->clear(__m);
}
 
void
__atomic_flag_wait_explicit(__atomic_flag_base* __a,
memory_order __x) _GLIBCXX_NOTHROW
{
while (atomic_flag_test_and_set_explicit(__a, __x))
{ };
}
 
_GLIBCXX_CONST __atomic_flag_base*
__atomic_flag_for_address(const volatile void* __z) _GLIBCXX_NOTHROW
{
uintptr_t __u = reinterpret_cast<uintptr_t>(__z);
__u += (__u >> 2) + (__u << 4);
__u += (__u >> 7) + (__u << 5);
__u += (__u >> 17) + (__u << 13);
if (sizeof(uintptr_t) > 4)
__u += (__u >> 31);
__u &= ~((~uintptr_t(0)) << LOGSIZE);
return flag_table + __u;
}
 
_GLIBCXX_END_EXTERN_C
 
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
 
#endif
 
// XXX GLIBCXX_ABI Deprecated
// gcc-4.5.0
// <atomic> signature changes
 
// The rename syntax for default exported names is
// asm (".symver name1,exportedname@GLIBCXX_3.4")
// asm (".symver name2,exportedname@@GLIBCXX_3.4.5")
// In the future, GLIBCXX_ABI > 6 should remove all uses of
// _GLIBCXX_*_SYMVER macros in this file.
 
#if defined(_GLIBCXX_SYMVER_GNU) && defined(_GLIBCXX_SHARED) \
&& defined(_GLIBCXX_HAVE_AS_SYMVER_DIRECTIVE) \
&& defined(_GLIBCXX_HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT)
 
#define _GLIBCXX_ASM_SYMVER(cur, old, version) \
asm (".symver " #cur "," #old "@@" #version);
 
_GLIBCXX_ASM_SYMVER(_ZNSt9__atomic011atomic_flag5clearESt12memory_order, _ZNVSt9__atomic011atomic_flag5clearESt12memory_order, GLIBCXX_3.4.11)
 
_GLIBCXX_ASM_SYMVER(_ZNSt9__atomic011atomic_flag12test_and_setESt12memory_order, _ZNVSt9__atomic011atomic_flag12test_and_setESt12memory_order, GLIBCXX_3.4.11)
 
#endif
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/compatibility-c++0x.cc
0,0 → 1,258
// Compatibility symbols for previous versions, C++0x bits -*- C++ -*-
 
// Copyright (C) 2009-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
#define _GLIBCXX_COMPATIBILITY_CXX0X
#define _GLIBCXX_USE_CXX11_ABI 0
#define error_category error_categoryxx
#define system_category system_categoryxx
#define generic_category generic_categoryxx
#define _V2 _V2xx
#include <string>
#include <system_error>
#include <cstring>
#undef error_category
#undef system_category
#undef generic_category
#undef _V2
 
#if __cplusplus < 201103L
# error "compatibility-c++0x.cc must be compiled with -std=gnu++0x"
#endif
 
#ifdef _GLIBCXX_SHARED
 
namespace std _GLIBCXX_VISIBILITY(default)
{
// gcc-4.4.0
// <mutex> exported std::lock_error
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
class lock_error : public exception
{
public:
virtual const char*
_GLIBCXX_CONST what() const throw();
};
 
const char*
lock_error::what() const throw()
{ return "std::lock_error"; }
#endif
 
// We need these due to the symbols exported since GLIBCXX_3.4.10.
// See libstdc++/41662 for details.
 
#ifndef _GLIBCXX_LONG_DOUBLE_COMPAT_IMPL
template<>
struct hash<string>
{
size_t operator()(string) const;
};
 
size_t
hash<string>::operator()(string __s) const
{ return _Hash_impl::hash(__s.data(), __s.length()); }
 
template<>
struct hash<const string&>
{
size_t operator()(const string&) const;
};
 
size_t
hash<const string&>::operator()(const string& __s) const
{ return _Hash_impl::hash(__s.data(), __s.length()); }
 
#ifdef _GLIBCXX_USE_WCHAR_T
template<>
struct hash<wstring>
{
size_t operator()(wstring) const;
};
 
size_t
hash<wstring>::operator()(wstring __s) const
{ return _Hash_impl::hash(__s.data(), __s.length() * sizeof(wchar_t)); }
 
template<>
struct hash<const wstring&>
{
size_t operator()(const wstring&) const;
};
 
size_t
hash<const wstring&>::operator()(const wstring& __s) const
{ return _Hash_impl::hash(__s.data(), __s.length() * sizeof(wchar_t)); }
#endif
#endif
 
template<>
struct hash<error_code>
{
size_t operator()(error_code) const;
};
 
size_t
hash<error_code>::operator()(error_code __e) const
{
const size_t __tmp = std::_Hash_impl::hash(__e._M_value);
return std::_Hash_impl::__hash_combine(__e._M_cat, __tmp);
}
 
// gcc-4.7.0
// <chrono> changes is_monotonic to is_steady.
namespace chrono
{
struct system_clock
{
static constexpr bool is_monotonic = false;
};
constexpr bool system_clock::is_monotonic;
} // namespace chrono
 
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// gcc-5 replaces this with _V2::error_category
class error_category
{
public:
error_category() noexcept;
 
virtual ~error_category();
 
error_category(const error_category&) = delete;
error_category& operator=(const error_category&) = delete;
 
virtual const char*
name() const noexcept = 0;
 
virtual string
message(int) const = 0;
 
virtual error_condition
default_error_condition(int __i) const noexcept;
 
virtual bool
equivalent(int __i, const error_condition& __cond) const noexcept;
 
virtual bool
equivalent(const error_code& __code, int __i) const noexcept;
 
bool
operator<(const error_category& __other) const noexcept
{ return less<const error_category*>()(this, &__other); }
 
bool
operator==(const error_category& __other) const noexcept
{ return this == &__other; }
 
bool
operator!=(const error_category& __other) const noexcept
{ return this != &__other; }
};
_GLIBCXX_END_NAMESPACE_VERSION
 
// gcc-4.9.0
// LWG 2145 changes this constructor to constexpr i.e. inline
error_category::error_category() noexcept = default;
 
error_category::~error_category() noexcept = default;
 
namespace
{
using std::string;
 
struct generic_error_category : public std::error_category
{
virtual const char*
name() const noexcept
{ return "generic"; }
 
virtual string
message(int i) const
{
// XXX locale issues: how does one get or set loc.
// _GLIBCXX_HAVE_STRERROR_L, strerror_l(i, cloc)
return string(strerror(i));
}
};
 
struct system_error_category : public std::error_category
{
virtual const char*
name() const noexcept
{ return "system"; }
 
virtual string
message(int i) const
{
// XXX locale issues: how does one get or set loc.
// _GLIBCXX_HAVE_STRERROR_L, strerror_l(i, cloc)
return string(strerror(i));
}
};
 
const generic_error_category generic_category_instance{};
const system_error_category system_category_instance{};
}
 
_GLIBCXX_BEGIN_NAMESPACE_VERSION
const error_category&
system_category() noexcept { return system_category_instance; }
 
const error_category&
generic_category() noexcept { return generic_category_instance; }
 
namespace _V2
{
_GLIBCXX_CONST const error_categoryxx& system_category() noexcept;
_GLIBCXX_CONST const error_categoryxx& generic_category() noexcept;
}
_GLIBCXX_END_NAMESPACE_VERSION
 
error_condition
error_category::default_error_condition(int __i) const noexcept
{
if (*this == system_category())
return error_condition(__i, _V2::system_category());
return error_condition(__i, _V2::generic_category());
}
 
bool
error_category::equivalent(int __i,
const error_condition& __cond) const noexcept
{ return default_error_condition(__i) == __cond; }
 
bool
error_category::equivalent(const error_code& __code, int __i) const noexcept
{
if (*this == system_category()
&& __code.category() == _V2::system_category())
return __code.value() == __i;
if (*this == generic_category()
&& __code.category() == _V2::generic_category())
return __code.value() == __i;
return false;
}
 
}
#endif
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/compatibility-chrono.cc
0,0 → 1,92
// Compatibility symbols for previous versions, C++0x bits -*- C++ -*-
 
// Copyright (C) 2013-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
#include <bits/c++config.h>
 
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
 
#ifdef _GLIBCXX_USE_GETTIMEOFDAY
#include <sys/time.h>
#endif
 
#define system_clock system_clockXX
#define steady_clock steady_clockXX
#include <chrono>
#undef system_clock
#undef steady_clock
 
namespace std _GLIBCXX_VISIBILITY(default)
{
namespace chrono
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// NB: Default configuration was no realtime.
struct system_clock
{
#ifdef _GLIBCXX_USE_GETTIMEOFDAY
typedef chrono::microseconds duration;
#else
typedef chrono::seconds duration;
#endif
 
typedef duration::rep rep;
typedef duration::period period;
typedef chrono::time_point<system_clock, duration> time_point;
 
static_assert(system_clock::duration::min()
< system_clock::duration::zero(),
"a clock's minimum duration cannot be less than its epoch");
 
static constexpr bool is_steady = false;
 
static time_point
now() noexcept;
};
 
constexpr bool system_clock::is_steady;
 
system_clock::time_point
system_clock::now() noexcept
{
#ifdef _GLIBCXX_USE_GETTIMEOFDAY
timeval tv;
// EINVAL, EFAULT
gettimeofday(&tv, 0);
return time_point(duration(chrono::seconds(tv.tv_sec)
+ chrono::microseconds(tv.tv_usec)));
#else
std::time_t __sec = std::time(0);
// This is the conversion done by system_clock::from_time_t(__sec)
typedef chrono::time_point<system_clock, seconds> __from;
return time_point_cast<system_clock::duration>
(__from(chrono::seconds(__sec)));
#endif
}
 
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace chrono
} // namespace std
 
#endif // _GLIBCXX_USE_C99_STDINT_TR1
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/compatibility-condvar.cc
0,0 → 1,57
// Compatibility symbols for previous versions, C++0x bits -*- C++ -*-
 
// Copyright (C) 2013-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
#include <bits/c++config.h>
 
#if __cplusplus < 201103L
# error "compatibility-condvar-c++0x.cc must be compiled with -std=gnu++11"
#endif
 
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
 
#define condition_variable_any condition_variable_anyXX
#include <condition_variable>
#undef condition_variable_any
 
// XXX GLIBCXX_ABI Deprecated
// gcc-4.9.0
// std::condition_variable_any replaced with std::_V2::condition_variable_any
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
class condition_variable_any
{
condition_variable _M_cond;
mutex _M_mutex;
 
public:
condition_variable_any() noexcept;
~condition_variable_any() noexcept;
};
condition_variable_any::condition_variable_any() noexcept = default;
condition_variable_any::~condition_variable_any() noexcept = default;
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
 
#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/compatibility-thread-c++0x.cc
0,0 → 1,126
// Compatibility symbols for previous versions, C++0x bits -*- C++ -*-
 
// Copyright (C) 2009-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
#include <bits/c++config.h>
#if defined(_GLIBCXX_SHARED)
#define _GLIBCXX_ASYNC_ABI_COMPAT
#endif
 
#include <future>
#include <mutex>
 
#if __cplusplus < 201103L
# error "compatibility-thread-c++0x.cc must be compiled with -std=gnu++0x"
#endif
 
#define _GLIBCXX_ASM_SYMVER(cur, old, version) \
asm (".symver " #cur "," #old "@@@" #version);
 
// XXX GLIBCXX_ABI Deprecated
// gcc-4.6.0
// <future> export changes
#if defined(_GLIBCXX_SYMVER_GNU) && defined(_GLIBCXX_SHARED) \
&& defined(_GLIBCXX_HAVE_AS_SYMVER_DIRECTIVE) \
&& defined(_GLIBCXX_HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT)
 
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
const std::error_category* future_category = &std::future_category();
}
 
_GLIBCXX_ASM_SYMVER(_ZN9__gnu_cxx15future_categoryE, _ZSt15future_category, GLIBCXX_3.4.14)
 
#endif
 
// XXX GLIBCXX_ABI Deprecated
// gcc-4.6.0
// <mutex> export changes
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
#if defined(_GLIBCXX_SYMVER_GNU) && defined(_GLIBCXX_SHARED) \
&& defined(_GLIBCXX_HAVE_AS_SYMVER_DIRECTIVE) \
&& defined(_GLIBCXX_HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT)
 
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
std::defer_lock_t defer_lock;
std::try_to_lock_t try_to_lock;
std::adopt_lock_t adopt_lock;
}
 
_GLIBCXX_ASM_SYMVER(_ZN9__gnu_cxx10adopt_lockE, _ZSt10adopt_lock, GLIBCXX_3.4.11)
_GLIBCXX_ASM_SYMVER(_ZN9__gnu_cxx10defer_lockE, _ZSt10defer_lock, GLIBCXX_3.4.11)
_GLIBCXX_ASM_SYMVER(_ZN9__gnu_cxx11try_to_lockE, _ZSt11try_to_lock, GLIBCXX_3.4.11)
 
 
#endif
#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
 
 
// XXX GLIBCXX_ABI Deprecated
// gcc-4.7.0, gcc-4.9.0
// <future> export changes
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
&& (ATOMIC_INT_LOCK_FREE > 1)
#if defined(_GLIBCXX_SHARED)
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// Replaced by _State_baseV2 in gcc-4.9.0
class __future_base::_State_base
{
typedef _Ptr<_Result_base> _Ptr_type;
 
_Ptr_type _M_result;
mutex _M_mutex;
condition_variable _M_cond;
atomic_flag _M_retrieved;
once_flag _M_once;
public:
virtual ~_State_base();
virtual void _M_run_deferred() { }
};
__future_base::_State_base::~_State_base() { }
 
// Replaced by _Async_state_commonV2 in gcc-4.9.0
class __future_base::_Async_state_common : public __future_base::_State_base
{
protected:
~_Async_state_common();
virtual void _M_run_deferred() { _M_join(); }
void _M_join() { std::call_once(_M_once, &thread::join, ref(_M_thread)); }
thread _M_thread;
once_flag _M_once;
};
#if defined(_GLIBCXX_HAVE_TLS)
// Replaced with inline definition in gcc-4.8.0
__future_base::_Async_state_common::~_Async_state_common() { _M_join(); }
 
// Explicit instantiation due to -fno-implicit-instantiation.
template void call_once(once_flag&, void (thread::*&&)(), reference_wrapper<thread>&&);
template _Bind_simple_helper<void (thread::*)(), reference_wrapper<thread>>::__type __bind_simple(void (thread::*&&)(), reference_wrapper<thread>&&);
#endif // _GLIBCXX_HAVE_TLS
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // _GLIBCXX_SHARED
#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/condition_variable.cc
0,0 → 1,158
// condition_variable -*- C++ -*-
 
// Copyright (C) 2008-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
#include <condition_variable>
#include <cstdlib>
 
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
 
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
#ifdef __GTHREAD_COND_INIT
condition_variable::condition_variable() noexcept = default;
#else
condition_variable::condition_variable() noexcept
{
__GTHREAD_COND_INIT_FUNCTION(&_M_cond);
}
#endif
 
condition_variable::~condition_variable() noexcept
{
// XXX no thread blocked
/* int __e = */ __gthread_cond_destroy(&_M_cond);
// if __e == EBUSY then blocked
}
 
void
condition_variable::wait(unique_lock<mutex>& __lock)
{
int __e = __gthread_cond_wait(&_M_cond, __lock.mutex()->native_handle());
 
if (__e)
__throw_system_error(__e);
}
 
void
condition_variable::notify_one() noexcept
{
int __e = __gthread_cond_signal(&_M_cond);
 
// XXX not in spec
// EINVAL
if (__e)
__throw_system_error(__e);
}
 
void
condition_variable::notify_all() noexcept
{
int __e = __gthread_cond_broadcast(&_M_cond);
 
// XXX not in spec
// EINVAL
if (__e)
__throw_system_error(__e);
}
 
extern void
__at_thread_exit(__at_thread_exit_elt*);
 
namespace
{
__gthread_key_t key;
 
void run(void* p)
{
auto elt = (__at_thread_exit_elt*)p;
while (elt)
{
auto next = elt->_M_next;
elt->_M_cb(elt);
elt = next;
}
}
 
void run()
{
auto elt = (__at_thread_exit_elt*)__gthread_getspecific(key);
__gthread_setspecific(key, nullptr);
run(elt);
}
 
struct notifier final : __at_thread_exit_elt
{
notifier(condition_variable& cv, unique_lock<mutex>& l)
: cv(&cv), mx(l.release())
{
_M_cb = &notifier::run;
__at_thread_exit(this);
}
 
~notifier()
{
mx->unlock();
cv->notify_all();
}
 
condition_variable* cv;
mutex* mx;
 
static void run(void* p) { delete static_cast<notifier*>(p); }
};
 
 
void key_init() {
struct key_s {
key_s() { __gthread_key_create (&key, run); }
~key_s() { __gthread_key_delete (key); }
};
static key_s ks;
// Also make sure the callbacks are run by std::exit.
std::atexit (run);
}
}
 
void
__at_thread_exit(__at_thread_exit_elt* elt)
{
static __gthread_once_t once = __GTHREAD_ONCE_INIT;
__gthread_once (&once, key_init);
 
elt->_M_next = (__at_thread_exit_elt*)__gthread_getspecific(key);
__gthread_setspecific(key, elt);
}
 
void
notify_all_at_thread_exit(condition_variable& cv, unique_lock<mutex> l)
{
(void) new notifier{cv, l};
}
 
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
 
#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/cow-fstream-inst.cc
0,0 → 1,78
// Explicit instantiation file.
 
// Copyright (C) 2014-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
//
// ISO C++ 14882:
//
 
#define _GLIBCXX_USE_CXX11_ABI 0
#include <fstream>
 
#if ! _GLIBCXX_USE_DUAL_ABI
# error This file should not be compiled for this configuration.
#endif
 
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
template basic_filebuf<char>*
basic_filebuf<char>::open(const std::string&, ios_base::openmode);
template
basic_ifstream<char>::
basic_ifstream(const std::string&, ios_base::openmode);
template void
basic_ifstream<char>::open(const std::string&, ios_base::openmode);
template
basic_ofstream<char>::
basic_ofstream(const std::string&, ios_base::openmode);
template void
basic_ofstream<char>::open(const std::string&, ios_base::openmode);
template
basic_fstream<char>::basic_fstream(const std::string&, ios_base::openmode);
template void
basic_fstream<char>::open(const std::string&, ios_base::openmode);
 
#ifdef _GLIBCXX_USE_WCHAR_T
template basic_filebuf<wchar_t>*
basic_filebuf<wchar_t>::open(const std::string&, ios_base::openmode);
template
basic_ifstream<wchar_t>::
basic_ifstream(const std::string&, ios_base::openmode);
template void
basic_ifstream<wchar_t>::open(const std::string&, ios_base::openmode);
template
basic_ofstream<wchar_t>::
basic_ofstream(const std::string&, ios_base::openmode);
template void
basic_ofstream<wchar_t>::open(const std::string&, ios_base::openmode);
template
basic_fstream<wchar_t>::
basic_fstream(const std::string&, ios_base::openmode);
template void
basic_fstream<wchar_t>::open(const std::string&, ios_base::openmode);
#endif
 
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/cow-locale_init.cc
0,0 → 1,194
// Copyright (C) 2014-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
// Instantiate the facets using old std::string ABI.
#define _GLIBCXX_USE_CXX11_ABI 0
#include <locale>
 
#if ! _GLIBCXX_USE_DUAL_ABI
# error This file should not be compiled for this configuration.
#endif
 
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
namespace
{
typedef char fake_collate_c[sizeof(std::collate<char>)]
__attribute__ ((aligned(__alignof__(std::collate<char>))));
fake_collate_c collate_c;
 
typedef char fake_numpunct_c[sizeof(numpunct<char>)]
__attribute__ ((aligned(__alignof__(numpunct<char>))));
fake_numpunct_c numpunct_c;
 
typedef char fake_moneypunct_c[sizeof(moneypunct<char, true>)]
__attribute__ ((aligned(__alignof__(moneypunct<char, true>))));
fake_moneypunct_c moneypunct_ct;
fake_moneypunct_c moneypunct_cf;
 
typedef char fake_money_get_c[sizeof(money_get<char>)]
__attribute__ ((aligned(__alignof__(money_get<char>))));
fake_money_get_c money_get_c;
typedef char fake_money_put_c[sizeof(money_put<char>)]
__attribute__ ((aligned(__alignof__(money_put<char>))));
fake_money_put_c money_put_c;
 
typedef char fake_time_get_c[sizeof(time_get<char>)]
__attribute__ ((aligned(__alignof__(time_get<char>))));
fake_time_get_c time_get_c;
 
typedef char fake_messages_c[sizeof(messages<char>)]
__attribute__ ((aligned(__alignof__(messages<char>))));
fake_messages_c messages_c;
 
#ifdef _GLIBCXX_USE_WCHAR_T
typedef char fake_wollate_w[sizeof(std::collate<wchar_t>)]
__attribute__ ((aligned(__alignof__(std::collate<wchar_t>))));
fake_wollate_w collate_w;
 
typedef char fake_numpunct_w[sizeof(numpunct<wchar_t>)]
__attribute__ ((aligned(__alignof__(numpunct<wchar_t>))));
fake_numpunct_w numpunct_w;
 
typedef char fake_moneypunct_w[sizeof(moneypunct<wchar_t, true>)]
__attribute__ ((aligned(__alignof__(moneypunct<wchar_t, true>))));
fake_moneypunct_w moneypunct_wt;
fake_moneypunct_w moneypunct_wf;
 
typedef char fake_money_get_w[sizeof(money_get<wchar_t>)]
__attribute__ ((aligned(__alignof__(money_get<wchar_t>))));
fake_money_get_w money_get_w;
typedef char fake_money_put_w[sizeof(money_put<wchar_t>)]
__attribute__ ((aligned(__alignof__(money_put<wchar_t>))));
fake_money_put_w money_put_w;
 
typedef char fake_time_get_w[sizeof(time_get<wchar_t>)]
__attribute__ ((aligned(__alignof__(time_get<wchar_t>))));
fake_time_get_w time_get_w;
 
typedef char fake_messages_w[sizeof(messages<wchar_t>)]
__attribute__ ((aligned(__alignof__(messages<wchar_t>))));
fake_messages_w messages_w;
#endif
} // anonymous namespace
 
void
locale::_Impl::_M_init_extra(facet** caches)
{
auto __npc = static_cast<__numpunct_cache<char>*>(caches[0]);
auto __mpcf = static_cast<__moneypunct_cache<char, false>*>(caches[1]);
auto __mpct = static_cast<__moneypunct_cache<char, true>*>(caches[2]);
 
_M_init_facet_unchecked(new (&numpunct_c) numpunct<char>(__npc, 1));
_M_init_facet_unchecked(new (&collate_c) std::collate<char>(1));
_M_init_facet_unchecked(new (&moneypunct_cf) moneypunct<char, false>(__mpcf, 1));
_M_init_facet_unchecked(new (&moneypunct_ct) moneypunct<char, true>(__mpct, 1));
_M_init_facet_unchecked(new (&money_get_c) money_get<char>(1));
_M_init_facet_unchecked(new (&money_put_c) money_put<char>(1));
_M_init_facet_unchecked(new (&time_get_c) time_get<char>(1));
_M_init_facet_unchecked(new (&messages_c) std::messages<char>(1));
#ifdef _GLIBCXX_USE_WCHAR_T
auto __npw = static_cast<__numpunct_cache<wchar_t>*>(caches[3]);
auto __mpwf = static_cast<__moneypunct_cache<wchar_t, false>*>(caches[4]);
auto __mpwt = static_cast<__moneypunct_cache<wchar_t, true>*>(caches[5]);
 
_M_init_facet_unchecked(new (&numpunct_w) numpunct<wchar_t>(__npw, 1));
_M_init_facet_unchecked(new (&collate_w) std::collate<wchar_t>(1));
_M_init_facet_unchecked(new (&moneypunct_wf) moneypunct<wchar_t, false>(__mpwf, 1));
_M_init_facet_unchecked(new (&moneypunct_wt) moneypunct<wchar_t, true>(__mpwt, 1));
_M_init_facet_unchecked(new (&money_get_w) money_get<wchar_t>(1));
_M_init_facet_unchecked(new (&money_put_w) money_put<wchar_t>(1));
_M_init_facet_unchecked(new (&time_get_w) time_get<wchar_t>(1));
_M_init_facet_unchecked(new (&messages_w) std::messages<wchar_t>(1));
#endif
 
_M_caches[numpunct<char>::id._M_id()] = __npc;
_M_caches[moneypunct<char, false>::id._M_id()] = __mpcf;
_M_caches[moneypunct<char, true>::id._M_id()] = __mpct;
#ifdef _GLIBCXX_USE_WCHAR_T
_M_caches[numpunct<wchar_t>::id._M_id()] = __npw;
_M_caches[moneypunct<wchar_t, false>::id._M_id()] = __mpwf;
_M_caches[moneypunct<wchar_t, true>::id._M_id()] = __mpwt;
#endif
}
 
void
locale::_Impl::_M_init_extra(void* cloc, void* clocm,
const char* __s, const char* __smon)
{
auto& __cloc = *static_cast<__c_locale*>(cloc);
 
_M_init_facet_unchecked(new numpunct<char>(__cloc));
_M_init_facet_unchecked(new std::collate<char>(__cloc));
_M_init_facet_unchecked(new moneypunct<char, false>(__cloc, 0));
_M_init_facet_unchecked(new moneypunct<char, true>(__cloc, 0));
_M_init_facet_unchecked(new money_get<char>);
_M_init_facet_unchecked(new money_put<char>);
_M_init_facet_unchecked(new time_get<char>);
_M_init_facet_unchecked(new std::messages<char>(__cloc, __s));
 
#ifdef _GLIBCXX_USE_WCHAR_T
auto& __clocm = *static_cast<__c_locale*>(clocm);
 
_M_init_facet_unchecked(new numpunct<wchar_t>(__cloc));
_M_init_facet_unchecked(new std::collate<wchar_t>(__cloc));
_M_init_facet_unchecked(new moneypunct<wchar_t, false>(__clocm, __smon));
_M_init_facet_unchecked(new moneypunct<wchar_t, true>(__clocm, __smon));
_M_init_facet_unchecked(new money_get<wchar_t>);
_M_init_facet_unchecked(new money_put<wchar_t>);
_M_init_facet_unchecked(new time_get<wchar_t>);
_M_init_facet_unchecked(new std::messages<wchar_t>(__cloc, __s));
#endif
}
 
// TODO should be in another file
string
locale::name() const
{
string __ret;
if (!_M_impl->_M_names[0])
__ret = '*';
else if (_M_impl->_M_check_same_name())
__ret = _M_impl->_M_names[0];
else
{
__ret.reserve(128);
__ret += _S_categories[0];
__ret += '=';
__ret += _M_impl->_M_names[0];
for (size_t __i = 1; __i < _S_categories_size; ++__i)
{
__ret += ';';
__ret += _S_categories[__i];
__ret += '=';
__ret += _M_impl->_M_names[__i];
}
}
return __ret;
}
 
_GLIBCXX_END_NAMESPACE_VERSION
}
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/cow-shim_facets.cc
0,0 → 1,35
// Locale support -*- C++ -*-
 
// Copyright (C) 2014-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
/** @file bits/locale_classes.tcc
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{locale}
*/
 
//
// ISO C++ 14882: 22.1 Locales
//
 
#define _GLIBCXX_USE_CXX11_ABI 0
#include "cxx11-shim_facets.cc"
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/cow-sstream-inst.cc
0,0 → 1,34
// Explicit instantiation file.
 
// Copyright (C) 2014-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
//
// ISO C++ 14882:
//
 
#define _GLIBCXX_USE_CXX11_ABI 0
#include "sstream-inst.cc"
 
#if ! _GLIBCXX_USE_DUAL_ABI
# error This file should not be compiled for this configuration.
#endif
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/cow-stdexcept.cc
0,0 → 1,153
// Methods for Exception Support for -*- C++ -*-
 
// Copyright (C) 2014-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
//
// ISO C++ 14882: 19.1 Exception classes
//
 
// All exception classes still use the classic COW std::string.
#define _GLIBCXX_USE_CXX11_ABI 0
#define _GLIBCXX_DEFINE_STDEXCEPT_COPY_OPS 1
#define __cow_string __cow_stringxxx
#include <stdexcept>
#include <system_error>
#undef __cow_string
 
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
// Copy constructors and assignment operators defined using COW std::string
 
logic_error::logic_error(const logic_error& e) noexcept
: _M_msg(e._M_msg) { }
 
logic_error& logic_error::operator=(const logic_error& e) noexcept
{ _M_msg = e._M_msg; return *this; }
 
runtime_error::runtime_error(const runtime_error& e) noexcept
: _M_msg(e._M_msg) { }
 
runtime_error&
runtime_error::operator=(const runtime_error& e) noexcept
{ _M_msg = e._M_msg; return *this; }
 
// New C++11 constructors:
 
logic_error::logic_error(const char* __arg)
: exception(), _M_msg(__arg) { }
 
domain_error::domain_error(const char* __arg)
: logic_error(__arg) { }
 
invalid_argument::invalid_argument(const char* __arg)
: logic_error(__arg) { }
 
length_error::length_error(const char* __arg)
: logic_error(__arg) { }
 
out_of_range::out_of_range(const char* __arg)
: logic_error(__arg) { }
 
runtime_error::runtime_error(const char* __arg)
: exception(), _M_msg(__arg) { }
 
range_error::range_error(const char* __arg)
: runtime_error(__arg) { }
 
overflow_error::overflow_error(const char* __arg)
: runtime_error(__arg) { }
 
underflow_error::underflow_error(const char* __arg)
: runtime_error(__arg) { }
 
#if _GLIBCXX_USE_DUAL_ABI
// Converting constructor from COW std::string to SSO string.
__sso_string::__sso_string(const string& s)
: __sso_string(s.c_str(), s.length()) { }
 
// Redefine __cow_string so that we can define and export its members
// in terms of the COW std::string.
struct __cow_string
{
union {
const char* _M_p;
char _M_bytes[sizeof(_M_p)];
std::string _M_str;
};
 
__cow_string();
__cow_string(const std::string& s);
__cow_string(const char*, size_t n);
__cow_string(const __cow_string&) noexcept;
__cow_string& operator=(const __cow_string&) noexcept;
~__cow_string();
__cow_string(__cow_string&&) noexcept;
__cow_string& operator=(__cow_string&&) noexcept;
};
 
__cow_string::__cow_string() : _M_str() { }
 
__cow_string::__cow_string(const std::string& s) : _M_str(s) { }
 
__cow_string::__cow_string(const char* s, size_t n) : _M_str(s, n) { }
 
__cow_string::__cow_string(const __cow_string& s) noexcept
: _M_str(s._M_str) { }
 
__cow_string&
__cow_string::operator=(const __cow_string& s) noexcept
{
_M_str = s._M_str;
return *this;
}
 
__cow_string::~__cow_string() { _M_str.~basic_string(); }
 
__cow_string::__cow_string(__cow_string&& s) noexcept
: _M_str(std::move(s._M_str)) { }
 
__cow_string&
__cow_string::operator=(__cow_string&& s) noexcept
{
_M_str = std::move(s._M_str);
return *this;
}
 
static_assert(sizeof(__cow_string) == sizeof(std::string),
"sizeof(std::string) has changed");
static_assert(alignof(__cow_string) == alignof(std::string),
"alignof(std::string) has changed");
#endif
 
// Return error_category::message() as an SSO string
__sso_string
error_category::_M_message(int i) const
{
string msg = this->message(i);
return {msg.c_str(), msg.length()};
}
 
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/cow-string-inst.cc
0,0 → 1,120
// Reference-counted COW string instantiations -*- C++ -*-
 
// Copyright (C) 2014-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
//
// ISO C++ 14882: 21 Strings library
//
 
#define _GLIBCXX_USE_CXX11_ABI 0
#include "string-inst.cc"
 
#include <istream>
#include <ostream>
 
#if ! _GLIBCXX_USE_DUAL_ABI
# error This file should not be compiled for this configuration.
#endif
 
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
// These came from c++98/misc-inst.cc, repeat them for COW string
// string related to iostreams.
template
basic_istream<char>&
operator>>(basic_istream<char>&, string&);
template
basic_ostream<char>&
operator<<(basic_ostream<char>&, const string&);
template
basic_istream<char>&
getline(basic_istream<char>&, string&, char);
template
basic_istream<char>&
getline(basic_istream<char>&, string&);
 
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
 
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
#include <random>
#if defined __i386__ || defined __x86_64__
# include <cpuid.h>
#endif
#include <cstdio>
 
namespace std _GLIBCXX_VISIBILITY(default)
{
void
random_device::_M_init(const std::string& token)
{
const char *fname = token.c_str();
 
if (token == "default")
{
#if (defined __i386__ || defined __x86_64__) && defined _GLIBCXX_X86_RDRAND
unsigned int eax, ebx, ecx, edx;
// Check availability of cpuid and, for now at least, also the
// CPU signature for Intel's
if (__get_cpuid_max(0, &ebx) > 0 && ebx == signature_INTEL_ebx)
{
__cpuid(1, eax, ebx, ecx, edx);
if (ecx & bit_RDRND)
{
_M_file = nullptr;
return;
}
}
#endif
 
fname = "/dev/urandom";
}
else if (token != "/dev/urandom" && token != "/dev/random")
fail:
std::__throw_runtime_error(__N("random_device::"
"random_device(const std::string&)"));
 
_M_file = static_cast<void*>(std::fopen(fname, "rb"));
if (!_M_file)
goto fail;
}
 
void
random_device::_M_init_pretr1(const std::string& token)
{
unsigned long __seed = 5489UL;
if (token != "mt19937")
{
const char* __nptr = token.c_str();
char* __endptr;
__seed = std::strtoul(__nptr, &__endptr, 0);
if (*__nptr == '\0' || *__endptr != '\0')
std::__throw_runtime_error(__N("random_device::random_device"
"(const std::string&)"));
}
_M_mt.seed(__seed);
}
} // namespace
#endif
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/cow-wstring-inst.cc
0,0 → 1,64
// Reference-counted COW wide string instantiations -*- C++ -*-
 
// Copyright (C) 2014-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
//
// ISO C++ 14882: 21 Strings library
//
 
#define _GLIBCXX_USE_CXX11_ABI 0
#include <bits/c++config.h>
 
#ifdef _GLIBCXX_USE_WCHAR_T
#define C wchar_t
#include "string-inst.cc"
 
#include <ostream>
#include <istream>
 
#if ! _GLIBCXX_USE_DUAL_ABI
# error This file should not be compiled for this configuration.
#endif
 
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
// XXX these came from c++98/misc-inst.cc, repeat them for COW string
// string related to iostreams
template
basic_istream<wchar_t>&
operator>>(basic_istream<wchar_t>&, wstring&);
template
basic_ostream<wchar_t>&
operator<<(basic_ostream<wchar_t>&, const wstring&);
template
basic_istream<wchar_t>&
getline(basic_istream<wchar_t>&, wstring&, wchar_t);
template
basic_istream<wchar_t>&
getline(basic_istream<wchar_t>&, wstring&);
 
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/ctype.cc
0,0 → 1,133
// Copyright (C) 1997-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
#include <locale>
#include <cstdlib>
#include <cstring>
 
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
// Definitions for static const data members of ctype_base.
const ctype_base::mask ctype_base::space;
const ctype_base::mask ctype_base::print;
const ctype_base::mask ctype_base::cntrl;
const ctype_base::mask ctype_base::upper;
const ctype_base::mask ctype_base::lower;
const ctype_base::mask ctype_base::alpha;
const ctype_base::mask ctype_base::digit;
const ctype_base::mask ctype_base::punct;
const ctype_base::mask ctype_base::xdigit;
const ctype_base::mask ctype_base::alnum;
const ctype_base::mask ctype_base::graph;
const ctype_base::mask ctype_base::blank;
 
// Definitions for locale::id of standard facets that are specialized.
locale::id ctype<char>::id;
 
#ifdef _GLIBCXX_USE_WCHAR_T
locale::id ctype<wchar_t>::id;
#endif
 
const size_t ctype<char>::table_size;
 
ctype<char>::~ctype()
{
_S_destroy_c_locale(_M_c_locale_ctype);
if (_M_del)
delete[] this->table();
}
 
// Fill in the narrowing cache and flag whether all values are
// valid or not. _M_narrow_ok is set to 2 if memcpy can't
// be used.
void
ctype<char>::
_M_narrow_init() const
{
char __tmp[sizeof(_M_narrow)];
for (size_t __i = 0; __i < sizeof(_M_narrow); ++__i)
__tmp[__i] = __i;
do_narrow(__tmp, __tmp + sizeof(__tmp), 0, _M_narrow);
_M_narrow_ok = 1;
if (__builtin_memcmp(__tmp, _M_narrow, sizeof(_M_narrow)))
_M_narrow_ok = 2;
else
{
// Deal with the special case of zero: renarrow with a
// different default and compare.
char __c;
do_narrow(__tmp, __tmp + 1, 1, &__c);
if (__c == 1)
_M_narrow_ok = 2;
}
}
 
void
ctype<char>::
_M_widen_init() const
{
char __tmp[sizeof(_M_widen)];
for (size_t __i = 0; __i < sizeof(_M_widen); ++__i)
__tmp[__i] = __i;
do_widen(__tmp, __tmp + sizeof(__tmp), _M_widen);
_M_widen_ok = 1;
// Set _M_widen_ok to 2 if memcpy can't be used.
if (__builtin_memcmp(__tmp, _M_widen, sizeof(_M_widen)))
_M_widen_ok = 2;
}
 
#ifdef _GLIBCXX_USE_WCHAR_T
ctype<wchar_t>::ctype(size_t __refs)
: __ctype_abstract_base<wchar_t>(__refs),
_M_c_locale_ctype(_S_get_c_locale()), _M_narrow_ok(false)
{ _M_initialize_ctype(); }
 
ctype<wchar_t>::ctype(__c_locale __cloc, size_t __refs)
: __ctype_abstract_base<wchar_t>(__refs),
_M_c_locale_ctype(_S_clone_c_locale(__cloc)), _M_narrow_ok(false)
{ _M_initialize_ctype(); }
 
ctype<wchar_t>::~ctype()
{ _S_destroy_c_locale(_M_c_locale_ctype); }
 
ctype_byname<wchar_t>::ctype_byname(const char* __s, size_t __refs)
: ctype<wchar_t>(__refs)
{
if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
{
this->_S_destroy_c_locale(this->_M_c_locale_ctype);
this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
this->_M_initialize_ctype();
}
}
 
ctype_byname<wchar_t>::~ctype_byname()
{ }
 
#endif
 
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/ctype_configure_char.cc
0,0 → 1,243
// Locale support -*- C++ -*-
 
// Copyright (C) 2011-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
/** @file ctype_configure_char.cc */
 
//
// ISO C++ 14882: 22.1 Locales
//
 
#include <locale>
#include <cstdlib>
#include <cstring>
 
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
// The classic table used in libstdc++ is *not* the C _ctype table
// used by mscvrt, but is based on the ctype masks defined for libstdc++
// in ctype_base.h.
 
const ctype_base::mask*
ctype<char>::classic_table() throw()
{
static const ctype_base::mask _S_classic_table[256] =
{
cntrl /* null */,
cntrl /* ^A */,
cntrl /* ^B */,
cntrl /* ^C */,
cntrl /* ^D */,
cntrl /* ^E */,
cntrl /* ^F */,
cntrl /* ^G */,
cntrl /* ^H */,
ctype_base::mask(space | cntrl | blank) /* tab */,
ctype_base::mask(space | cntrl) /* LF */,
ctype_base::mask(space | cntrl) /* ^K */,
ctype_base::mask(space | cntrl) /* FF */,
ctype_base::mask(space | cntrl) /* ^M */,
cntrl /* ^N */,
cntrl /* ^O */,
cntrl /* ^P */,
cntrl /* ^Q */,
cntrl /* ^R */,
cntrl /* ^S */,
cntrl /* ^T */,
cntrl /* ^U */,
cntrl /* ^V */,
cntrl /* ^W */,
cntrl /* ^X */,
cntrl /* ^Y */,
cntrl /* ^Z */,
cntrl /* esc */,
cntrl /* ^\ */,
cntrl /* ^] */,
cntrl /* ^^ */,
cntrl /* ^_ */,
ctype_base::mask(space | print | blank) /* */,
ctype_base::mask(punct | print) /* ! */,
ctype_base::mask(punct | print) /* " */,
ctype_base::mask(punct | print) /* # */,
ctype_base::mask(punct | print) /* $ */,
ctype_base::mask(punct | print) /* % */,
ctype_base::mask(punct | print) /* & */,
ctype_base::mask(punct | print) /* ' */,
ctype_base::mask(punct | print) /* ( */,
ctype_base::mask(punct | print) /* ) */,
ctype_base::mask(punct | print) /* * */,
ctype_base::mask(punct | print) /* + */,
ctype_base::mask(punct | print) /* , */,
ctype_base::mask(punct | print) /* - */,
ctype_base::mask(punct | print) /* . */,
ctype_base::mask(punct | print) /* / */,
ctype_base::mask(digit | xdigit | print) /* 0 */,
ctype_base::mask(digit | xdigit | print) /* 1 */,
ctype_base::mask(digit | xdigit | print) /* 2 */,
ctype_base::mask(digit | xdigit | print) /* 3 */,
ctype_base::mask(digit | xdigit | print) /* 4 */,
ctype_base::mask(digit | xdigit | print) /* 5 */,
ctype_base::mask(digit | xdigit | print) /* 6 */,
ctype_base::mask(digit | xdigit | print) /* 7 */,
ctype_base::mask(digit | xdigit | print) /* 8 */,
ctype_base::mask(digit | xdigit | print) /* 9 */,
ctype_base::mask(punct | print) /* : */,
ctype_base::mask(punct | print) /* ; */,
ctype_base::mask(punct | print) /* < */,
ctype_base::mask(punct | print) /* = */,
ctype_base::mask(punct | print) /* > */,
ctype_base::mask(punct | print) /* ? */,
ctype_base::mask(punct | print) /* ! */,
ctype_base::mask(alpha | upper | xdigit | print) /* A */,
ctype_base::mask(alpha | upper | xdigit | print) /* B */,
ctype_base::mask(alpha | upper | xdigit | print) /* C */,
ctype_base::mask(alpha | upper | xdigit | print) /* D */,
ctype_base::mask(alpha | upper | xdigit | print) /* E */,
ctype_base::mask(alpha | upper | xdigit | print) /* F */,
ctype_base::mask(alpha | upper | print) /* G */,
ctype_base::mask(alpha | upper | print) /* H */,
ctype_base::mask(alpha | upper | print) /* I */,
ctype_base::mask(alpha | upper | print) /* J */,
ctype_base::mask(alpha | upper | print) /* K */,
ctype_base::mask(alpha | upper | print) /* L */,
ctype_base::mask(alpha | upper | print) /* M */,
ctype_base::mask(alpha | upper | print) /* N */,
ctype_base::mask(alpha | upper | print) /* O */,
ctype_base::mask(alpha | upper | print) /* P */,
ctype_base::mask(alpha | upper | print) /* Q */,
ctype_base::mask(alpha | upper | print) /* R */,
ctype_base::mask(alpha | upper | print) /* S */,
ctype_base::mask(alpha | upper | print) /* T */,
ctype_base::mask(alpha | upper | print) /* U */,
ctype_base::mask(alpha | upper | print) /* V */,
ctype_base::mask(alpha | upper | print) /* W */,
ctype_base::mask(alpha | upper | print) /* X */,
ctype_base::mask(alpha | upper | print) /* Y */,
ctype_base::mask(alpha | upper | print) /* Z */,
ctype_base::mask(punct | print) /* [ */,
ctype_base::mask(punct | print) /* \ */,
ctype_base::mask(punct | print) /* ] */,
ctype_base::mask(punct | print) /* ^ */,
ctype_base::mask(punct | print) /* _ */,
ctype_base::mask(punct | print) /* ` */,
ctype_base::mask(alpha | lower | xdigit | print) /* a */,
ctype_base::mask(alpha | lower | xdigit | print) /* b */,
ctype_base::mask(alpha | lower | xdigit | print) /* c */,
ctype_base::mask(alpha | lower | xdigit | print) /* d */,
ctype_base::mask(alpha | lower | xdigit | print) /* e */,
ctype_base::mask(alpha | lower | xdigit | print) /* f */,
ctype_base::mask(alpha | lower | print) /* g */,
ctype_base::mask(alpha | lower | print) /* h */,
ctype_base::mask(alpha | lower | print) /* i */,
ctype_base::mask(alpha | lower | print) /* j */,
ctype_base::mask(alpha | lower | print) /* k */,
ctype_base::mask(alpha | lower | print) /* l */,
ctype_base::mask(alpha | lower | print) /* m */,
ctype_base::mask(alpha | lower | print) /* n */,
ctype_base::mask(alpha | lower | print) /* o */,
ctype_base::mask(alpha | lower | print) /* p */,
ctype_base::mask(alpha | lower | print) /* q */,
ctype_base::mask(alpha | lower | print) /* r */,
ctype_base::mask(alpha | lower | print) /* s */,
ctype_base::mask(alpha | lower | print) /* t */,
ctype_base::mask(alpha | lower | print) /* u */,
ctype_base::mask(alpha | lower | print) /* v */,
ctype_base::mask(alpha | lower | print) /* w */,
ctype_base::mask(alpha | lower | print) /* x */,
ctype_base::mask(alpha | lower | print) /* y */,
ctype_base::mask(alpha | lower | print) /* x */,
ctype_base::mask(punct | print) /* { */,
ctype_base::mask(punct | print) /* | */,
ctype_base::mask(punct | print) /* } */,
ctype_base::mask(punct | print) /* ~ */,
cntrl /* del (0x7f)*/,
/* The next 128 entries are all 0. */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
return _S_classic_table;
}
 
ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
size_t __refs)
: facet(__refs), _M_del(__table != 0 && __del),
_M_toupper(NULL), _M_tolower(NULL),
_M_table(__table ? __table : classic_table())
{
memset(_M_widen, 0, sizeof(_M_widen));
_M_widen_ok = 0;
memset(_M_narrow, 0, sizeof(_M_narrow));
_M_narrow_ok = 0;
}
 
ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
: facet(__refs), _M_del(__table != 0 && __del),
_M_toupper(NULL), _M_tolower(NULL),
_M_table(__table ? __table : classic_table())
{
memset(_M_widen, 0, sizeof(_M_widen));
_M_widen_ok = 0;
memset(_M_narrow, 0, sizeof(_M_narrow));
_M_narrow_ok = 0;
}
 
char
ctype<char>::do_toupper(char __c) const
{ return (this->is(ctype_base::lower, __c) ? (__c - 'a' + 'A') : __c); }
 
const char*
ctype<char>::do_toupper(char* __low, const char* __high) const
{
while (__low < __high)
{
*__low = this->do_toupper(*__low);
++__low;
}
return __high;
}
 
char
ctype<char>::do_tolower(char __c) const
{ return (this->is(ctype_base::upper, __c) ? (__c - 'A' + 'a') : __c); }
 
const char*
ctype<char>::do_tolower(char* __low, const char* __high) const
{
while (__low < __high)
{
*__low = this->do_tolower(*__low);
++__low;
}
return __high;
}
 
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/ctype_members.cc
0,0 → 1,276
// std::ctype implementation details, generic version -*- C++ -*-
 
// Copyright (C) 2001-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
//
// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions.
//
 
// Written by Benjamin Kosnik <bkoz@redhat.com>
 
#include <locale>
#include <cstdlib>
#include <cstring>
#include <cstdio>
 
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
// NB: The other ctype<char> specializations are in src/locale.cc and
// various /config/os/* files.
ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
: ctype<char>(0, false, __refs)
{
if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
{
this->_S_destroy_c_locale(this->_M_c_locale_ctype);
this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
}
}
 
ctype_byname<char>::~ctype_byname()
{ }
 
#ifdef _GLIBCXX_USE_WCHAR_T
ctype<wchar_t>::__wmask_type
ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const throw()
{
__wmask_type __ret;
switch (__m)
{
case space:
__ret = wctype("space");
break;
case print:
__ret = wctype("print");
break;
case cntrl:
__ret = wctype("cntrl");
break;
case upper:
__ret = wctype("upper");
break;
case lower:
__ret = wctype("lower");
break;
case alpha:
__ret = wctype("alpha");
break;
case digit:
__ret = wctype("digit");
break;
case punct:
__ret = wctype("punct");
break;
case xdigit:
__ret = wctype("xdigit");
break;
case alnum:
__ret = wctype("alnum");
break;
case graph:
__ret = wctype("graph");
break;
default:
// For some targets ctype_base::blank == ctype_base::space so check
// here to avoid a duplicate case error.
if (__m == blank)
__ret = wctype("blank");
else
__ret = __wmask_type();
}
return __ret;
};
wchar_t
ctype<wchar_t>::do_toupper(wchar_t __c) const
{ return towupper(__c); }
 
const wchar_t*
ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const
{
while (__lo < __hi)
{
*__lo = towupper(*__lo);
++__lo;
}
return __hi;
}
wchar_t
ctype<wchar_t>::do_tolower(wchar_t __c) const
{ return towlower(__c); }
const wchar_t*
ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const
{
while (__lo < __hi)
{
*__lo = towlower(*__lo);
++__lo;
}
return __hi;
}
 
bool
ctype<wchar_t>::
do_is(mask __m, char_type __c) const
{
bool __ret = false;
// Generically, 15 (instead of 11) since we don't know the numerical
// encoding of the various categories in /usr/include/ctype.h.
const size_t __bitmasksize = 15;
for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
if (__m & _M_bit[__bitcur]
&& iswctype(__c, _M_wmask[__bitcur]))
{
__ret = true;
break;
}
return __ret;
}
const wchar_t*
ctype<wchar_t>::
do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
{
for (;__lo < __hi; ++__vec, ++__lo)
{
// Generically, 15 (instead of 11) since we don't know the numerical
// encoding of the various categories in /usr/include/ctype.h.
const size_t __bitmasksize = 15;
mask __m = 0;
for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
if (iswctype(*__lo, _M_wmask[__bitcur]))
__m |= _M_bit[__bitcur];
*__vec = __m;
}
return __hi;
}
const wchar_t*
ctype<wchar_t>::
do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const
{
while (__lo < __hi && !this->do_is(__m, *__lo))
++__lo;
return __lo;
}
 
const wchar_t*
ctype<wchar_t>::
do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
{
while (__lo < __hi && this->do_is(__m, *__lo) != 0)
++__lo;
return __lo;
}
 
wchar_t
ctype<wchar_t>::
do_widen(char __c) const
{ return _M_widen[static_cast<unsigned char>(__c)]; }
const char*
ctype<wchar_t>::
do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
{
while (__lo < __hi)
{
*__dest = _M_widen[static_cast<unsigned char>(*__lo)];
++__lo;
++__dest;
}
return __hi;
}
 
char
ctype<wchar_t>::
do_narrow(wchar_t __wc, char __dfault) const
{
if (__wc >= 0 && __wc < 128 && _M_narrow_ok)
return _M_narrow[__wc];
const int __c = wctob(__wc);
return (__c == EOF ? __dfault : static_cast<char>(__c));
}
 
const wchar_t*
ctype<wchar_t>::
do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault,
char* __dest) const
{
if (_M_narrow_ok)
while (__lo < __hi)
{
if (*__lo >= 0 && *__lo < 128)
*__dest = _M_narrow[*__lo];
else
{
const int __c = wctob(*__lo);
*__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
}
++__lo;
++__dest;
}
else
while (__lo < __hi)
{
const int __c = wctob(*__lo);
*__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
++__lo;
++__dest;
}
return __hi;
}
 
void
ctype<wchar_t>::_M_initialize_ctype() throw()
{
wint_t __i;
for (__i = 0; __i < 128; ++__i)
{
const int __c = wctob(__i);
if (__c == EOF)
break;
else
_M_narrow[__i] = static_cast<char>(__c);
}
if (__i == 128)
_M_narrow_ok = true;
else
_M_narrow_ok = false;
for (size_t __i = 0;
__i < sizeof(_M_widen) / sizeof(wint_t); ++__i)
_M_widen[__i] = btowc(__i);
 
for (size_t __i = 0; __i <= 15; ++__i)
{
_M_bit[__i] = static_cast<mask>(1 << __i);
_M_wmask[__i] = _M_convert_to_wmask(_M_bit[__i]);
}
}
#endif // _GLIBCXX_USE_WCHAR_T
 
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/cxx11-hash_tr1.cc
0,0 → 1,59
// std::tr1::hash definitions with new string -*- C++ -*-
 
// Copyright (C) 2014-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
#define _GLIBCXX_USE_CXX11_ABI 1
#include <string>
 
#if ! _GLIBCXX_USE_DUAL_ABI
# error This file should not be compiled for this configuration.
#endif
 
#include <tr1/functional>
namespace std _GLIBCXX_VISIBILITY(default)
{
namespace tr1
{
template<>
size_t
hash<string>::operator()(string __s) const
{ return _Fnv_hash::hash(__s.data(), __s.length()); }
 
template<>
size_t
hash<const string&>::operator()(const string& __s) const
{ return _Fnv_hash::hash(__s.data(), __s.length()); }
 
#ifdef _GLIBCXX_USE_WCHAR_T
template<>
size_t
hash<wstring>::operator()(wstring __s) const
{ return _Fnv_hash::hash(__s.data(), __s.length() * sizeof(wchar_t)); }
 
template<>
size_t
hash<const wstring&>::operator()(const wstring& __s) const
{ return _Fnv_hash::hash(__s.data(), __s.length() * sizeof(wchar_t)); }
#endif
}
}
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/cxx11-ios_failure.cc
0,0 → 1,95
// Iostreams base classes -*- C++ -*-
 
// Copyright (C) 2014-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
//
// ISO C++ 14882:2011: 27.5.3.1.1 Class ios_base::failure
//
 
#define _GLIBCXX_USE_CXX11_ABI 1
#include <ios>
 
#if ! _GLIBCXX_USE_DUAL_ABI
# error This file should not be compiled for this configuration.
#endif
 
namespace
{
struct io_error_category : std::error_category
{
virtual const char*
name() const noexcept
{ return "iostream"; }
 
_GLIBCXX_DEFAULT_ABI_TAG
virtual std::string message(int __ec) const
{
std::string __msg;
switch (std::io_errc(__ec))
{
case std::io_errc::stream:
__msg = "iostream error";
break;
default:
__msg = "Unknown error";
break;
}
return __msg;
}
};
 
const io_error_category&
__io_category_instance() noexcept
{
static const io_error_category __ec{};
return __ec;
}
 
} // namespace
 
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
const error_category&
iostream_category() noexcept
{ return __io_category_instance(); }
 
ios_base::failure::failure(const string& __str)
: system_error(io_errc::stream, __str) { }
 
ios_base::failure::failure(const string& __str, const error_code& __ec)
: system_error(__ec, __str) { }
 
ios_base::failure::failure(const char* __str, const error_code& __ec)
: system_error(__ec, __str) { }
 
ios_base::failure::~failure()
{ }
 
const char*
ios_base::failure::what() const throw()
{ return runtime_error::what(); }
 
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/cxx11-locale-inst.cc
0,0 → 1,39
// Copyright (C) 2014-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
//
// ISO C++ 14882: 22.1 Locales
//
 
// Facet instantiations using new ABI strings.
 
#define _GLIBCXX_USE_CXX11_ABI 1
#include <bits/c++config.h>
#if ! _GLIBCXX_USE_DUAL_ABI
# error This file should not be compiled for this configuration.
#endif
 
#ifndef C
# define C char
# define C_is_char
#endif
# include "locale-inst.cc"
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/cxx11-shim_facets.cc
0,0 → 1,834
// Locale support -*- C++ -*-
 
// Copyright (C) 2014-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
//
// ISO C++ 14882: 22.1 Locales
//
 
// This file defines classes that behave like the standard predefined locale
// facets (collate, money_get etc.) except that they forward all virtual
// functions to another facet which uses a different std::string ABI,
// converting between string types as needed.
// When a user replaces one of the relevant facets the corresponding shim in
// this file is used so that the replacement facet can be used (via the shim)
// in code that uses the other std::string ABI from the replacing code.
 
#ifndef _GLIBCXX_USE_CXX11_ABI
# define _GLIBCXX_USE_CXX11_ABI 1
#endif
#include <locale>
 
#if ! _GLIBCXX_USE_DUAL_ABI
# error This file should not be compiled for this configuration.
#endif
 
namespace std _GLIBCXX_VISIBILITY(default)
{
// Base class of facet shims, holds a reference to the underlying facet
// that the shim forwards to.
class locale::facet::__shim
{
public:
const facet* _M_get() const { return _M_facet; }
 
__shim(const __shim&) = delete;
__shim& operator=(const __shim&) = delete;
 
protected:
explicit
__shim(const facet* __f) : _M_facet(__f) { __f->_M_add_reference(); }
 
~__shim() { _M_facet->_M_remove_reference(); }
 
private:
const facet* _M_facet;
};
 
namespace __facet_shims
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
namespace // unnamed
{
template<typename C>
void __destroy_string(void* p)
{
static_cast<std::basic_string<C>*>(p)->~basic_string();
}
} // namespace
 
// Manages a buffer of uninitialized memory that can store a std::string
// or std::wstring, using either ABI, and convert to the other ABI.
class __any_string
{
struct __attribute__((may_alias)) __str_rep
{
union {
const void* _M_p;
char* _M_pc;
#ifdef _GLIBCXX_USE_WCHAR_T
wchar_t* _M_pwc;
#endif
};
size_t _M_len;
char _M_unused[16];
 
operator const char*() const { return _M_pc; }
#ifdef _GLIBCXX_USE_WCHAR_T
operator const wchar_t*() const { return _M_pwc; }
#endif
};
union {
__str_rep _M_str;
char _M_bytes[sizeof(__str_rep)];
};
using __dtor_func = void(*)(void*);
__dtor_func _M_dtor = nullptr;
 
#if _GLIBCXX_USE_CXX11_ABI
// SSO strings overlay the entire __str_rep structure.
static_assert(sizeof(std::string) == sizeof(__str_rep),
"std::string changed size!");
#else
// COW strings overlay just the pointer, the length is stored manually.
static_assert(sizeof(std::string) == sizeof(__str_rep::_M_p),
"std::string changed size!");
#endif
# ifdef _GLIBCXX_USE_WCHAR_T
static_assert(sizeof(std::wstring) == sizeof(std::string),
"std::wstring and std::string are different sizes!");
# endif
 
public:
__any_string() = default;
~__any_string() { if (_M_dtor) _M_dtor(_M_bytes); }
 
__any_string(const __any_string&) = delete;
__any_string& operator=(const __any_string&) = delete;
 
// Store a string (and its length if needed) in the buffer and
// set _M_dtor to the function that runs the right destructor.
template<typename C>
__any_string&
operator=(const basic_string<C>& s)
{
if (_M_dtor)
_M_dtor(_M_bytes);
::new(_M_bytes) basic_string<C>(s);
#if ! _GLIBCXX_USE_CXX11_ABI
_M_str._M_len = s.length();
#endif
_M_dtor = __destroy_string<C>;
return *this;
}
 
// Create a new string with a copy of the characters in the stored string.
// The returned object will match the caller's string ABI, even when the
// stored string doesn't.
template<typename C>
_GLIBCXX_DEFAULT_ABI_TAG
operator basic_string<C>() const
{
if (!_M_dtor)
__throw_logic_error("uninitialized __any_string");
return basic_string<C>(static_cast<const C*>(_M_str), _M_str._M_len);
}
};
 
// This file is compiled twice, with and without this macro defined.
// Define tag types to distinguish between the two cases and to allow
// overloading on the tag.
using current_abi = __bool_constant<_GLIBCXX_USE_CXX11_ABI>;
using other_abi = __bool_constant<!_GLIBCXX_USE_CXX11_ABI>;
 
using facet = locale::facet;
 
// Declare the functions that shims defined in this file will call to
// perform work in the context of the other ABI.
// These will be defined when this file is recompiled for the other ABI
// (at which point what is now "current_abi" will become "other_abi").
 
template<typename C>
void
__numpunct_fill_cache(other_abi, const facet*, __numpunct_cache<C>*);
 
template<typename C>
int
__collate_compare(other_abi, const facet*, const C*, const C*,
const C*, const C*);
 
template<typename C>
void
__collate_transform(other_abi, const facet*, __any_string&,
const C*, const C*);
 
template<typename C>
time_base::dateorder
__time_get_dateorder(other_abi, const facet* f);
 
template<typename C>
istreambuf_iterator<C>
__time_get(other_abi, const facet* f,
istreambuf_iterator<C> beg, istreambuf_iterator<C> end,
ios_base& io, ios_base::iostate& err, tm* t, char which);
 
template<typename C, bool Intl>
void
__moneypunct_fill_cache(other_abi, const facet*,
__moneypunct_cache<C, Intl>*);
 
template<typename C>
istreambuf_iterator<C>
__money_get(other_abi, const facet*,
istreambuf_iterator<C>, istreambuf_iterator<C>,
bool, ios_base&, ios_base::iostate&,
long double*, __any_string*);
 
template<typename C>
ostreambuf_iterator<C>
__money_put(other_abi, const facet*, ostreambuf_iterator<C>, bool,
ios_base&, C, long double, const __any_string*);
 
template<typename C>
messages_base::catalog
__messages_open(other_abi, const facet*, const char*, size_t,
const locale&);
 
template<typename C>
void
__messages_get(other_abi, const facet*, __any_string&,
messages_base::catalog, int, int, const C*, size_t);
 
template<typename C>
void
__messages_close(other_abi, const facet*, messages_base::catalog);
 
namespace // unnamed
{
template<typename _CharT>
struct numpunct_shim : std::numpunct<_CharT>, facet::__shim
{
typedef typename numpunct<_CharT>::__cache_type __cache_type;
 
// f must point to a type derived from numpunct<C>[abi:other]
numpunct_shim(const facet* f, __cache_type* c = new __cache_type)
: std::numpunct<_CharT>(c), __shim(f), _M_cache(c)
{
__numpunct_fill_cache(other_abi{}, f, c);
}
 
~numpunct_shim()
{
// Stop GNU locale's ~numpunct() from freeing the cached string.
_M_cache->_M_grouping_size = 0;
}
 
// No need to override any virtual functions, the base definitions
// will return the cached data.
 
__cache_type* _M_cache;
};
 
template<typename _CharT>
struct collate_shim : std::collate<_CharT>, facet::__shim
{
typedef basic_string<_CharT> string_type;
 
// f must point to a type derived from collate<C>[abi:other]
collate_shim(const facet* f) : __shim(f) { }
 
virtual int
do_compare(const _CharT* lo1, const _CharT* hi1,
const _CharT* lo2, const _CharT* hi2) const
{
return __collate_compare(other_abi{}, _M_get(),
lo1, hi1, lo2, hi2);
}
 
virtual string_type
do_transform(const _CharT* lo, const _CharT* hi) const
{
__any_string st;
__collate_transform(other_abi{}, _M_get(), st, lo, hi);
return st;
}
};
 
template<typename _CharT>
struct time_get_shim : std::time_get<_CharT>, facet::__shim
{
typedef typename std::time_get<_CharT>::iter_type iter_type;
typedef typename std::time_get<_CharT>::char_type char_type;
 
// f must point to a type derived from time_get<C>[abi:other]
time_get_shim(const facet* f) : __shim(f) { }
 
virtual time_base::dateorder
do_date_order() const
{ return __time_get_dateorder<_CharT>(other_abi{}, _M_get()); }
 
virtual iter_type
do_get_time(iter_type beg, iter_type end, ios_base& io,
ios_base::iostate& err, tm* t) const
{
return __time_get(other_abi{}, _M_get(), beg, end, io, err, t,
't');
}
 
virtual iter_type
do_get_date(iter_type beg, iter_type end, ios_base& io,
ios_base::iostate& err, tm* t) const
{
return __time_get(other_abi{}, _M_get(), beg, end, io, err, t,
'd');
}
 
virtual iter_type
do_get_weekday(iter_type beg, iter_type end, ios_base& io,
ios_base::iostate& err, tm* t) const
{
return __time_get(other_abi{}, _M_get(), beg, end, io, err, t,
'w');
}
 
virtual iter_type
do_get_monthname(iter_type beg, iter_type end, ios_base& io,
ios_base::iostate& err, tm* t) const
{
return __time_get(other_abi{}, _M_get(), beg, end, io, err, t,
'm');
}
 
virtual iter_type
do_get_year(iter_type beg, iter_type end, ios_base& io,
ios_base::iostate& err, tm* t) const
{
return __time_get(other_abi{}, _M_get(), beg, end, io, err, t,
'y');
}
};
 
template<typename _CharT, bool _Intl>
struct moneypunct_shim : std::moneypunct<_CharT, _Intl>, facet::__shim
{
typedef typename moneypunct<_CharT, _Intl>::__cache_type __cache_type;
 
// f must point to a type derived from moneypunct<C>[abi:other]
moneypunct_shim(const facet* f, __cache_type* c = new __cache_type)
: std::moneypunct<_CharT, _Intl>(c), __shim(f), _M_cache(c)
{
__moneypunct_fill_cache(other_abi{}, f, c);
}
 
~moneypunct_shim()
{
// Stop GNU locale's ~moneypunct() from freeing the cached strings.
_M_cache->_M_grouping_size = 0;
_M_cache->_M_curr_symbol_size = 0;
_M_cache->_M_positive_sign_size = 0;
_M_cache->_M_negative_sign_size = 0;
}
 
// No need to override any virtual functions, the base definitions
// will return the cached data.
 
__cache_type* _M_cache;
};
 
template<typename _CharT>
struct money_get_shim : std::money_get<_CharT>, facet::__shim
{
typedef typename std::money_get<_CharT>::iter_type iter_type;
typedef typename std::money_get<_CharT>::char_type char_type;
typedef typename std::money_get<_CharT>::string_type string_type;
 
// f must point to a type derived from money_get<C>[abi:other]
money_get_shim(const facet* f) : __shim(f) { }
 
virtual iter_type
do_get(iter_type s, iter_type end, bool intl, ios_base& io,
ios_base::iostate& err, long double& units) const
{
ios_base::iostate err2 = ios_base::goodbit;
long double units2;
s = __money_get(other_abi{}, _M_get(), s, end, intl, io, err2,
&units2, nullptr);
if (err2 == ios_base::goodbit)
units = units2;
else
err = err2;
return s;
}
 
virtual iter_type
do_get(iter_type s, iter_type end, bool intl, ios_base& io,
ios_base::iostate& err, string_type& digits) const
{
__any_string st;
ios_base::iostate err2 = ios_base::goodbit;
s = __money_get(other_abi{}, _M_get(), s, end, intl, io, err2,
nullptr, &st);
if (err2 == ios_base::goodbit)
digits = st;
else
err = err2;
return s;
}
};
 
template<typename _CharT>
struct money_put_shim : std::money_put<_CharT>, facet::__shim
{
typedef typename std::money_put<_CharT>::iter_type iter_type;
typedef typename std::money_put<_CharT>::char_type char_type;
typedef typename std::money_put<_CharT>::string_type string_type;
 
// f must point to a type derived from money_put<C>[abi:other]
money_put_shim(const facet* f) : __shim(f) { }
 
virtual iter_type
do_put(iter_type s, bool intl, ios_base& io,
char_type fill, long double units) const
{
return __money_put(other_abi{}, _M_get(), s, intl, io, fill, units,
nullptr);
}
 
virtual iter_type
do_put(iter_type s, bool intl, ios_base& io,
char_type fill, const string_type& digits) const
{
__any_string st;
st = digits;
return __money_put(other_abi{}, _M_get(), s, intl, io, fill, 0.L,
&st);
}
};
 
template<typename _CharT>
struct messages_shim : std::messages<_CharT>, facet::__shim
{
typedef messages_base::catalog catalog;
typedef basic_string<_CharT> string_type;
 
// f must point to a type derived from messages<C>[abi:other]
messages_shim(const facet* f) : __shim(f) { }
 
virtual catalog
do_open(const basic_string<char>& s, const locale& l) const
{
return __messages_open<_CharT>(other_abi{}, _M_get(),
s.c_str(), s.size(), l);
}
 
virtual string_type
do_get(catalog c, int set, int msgid, const string_type& dfault) const
{
__any_string st;
__messages_get(other_abi{}, _M_get(), st, c, set, msgid,
dfault.c_str(), dfault.size());
return st;
}
 
virtual void
do_close(catalog c) const
{
__messages_close<_CharT>(other_abi{}, _M_get(), c);
}
};
 
template class numpunct_shim<char>;
template class collate_shim<char>;
template class moneypunct_shim<char, true>;
template class moneypunct_shim<char, false>;
template class money_get_shim<char>;
template class money_put_shim<char>;
template class messages_shim<char>;
#ifdef _GLIBCXX_USE_WCHAR_T
template class numpunct_shim<wchar_t>;
template class collate_shim<wchar_t>;
template class moneypunct_shim<wchar_t, true>;
template class moneypunct_shim<wchar_t, false>;
template class money_get_shim<wchar_t>;
template class money_put_shim<wchar_t>;
template class messages_shim<wchar_t>;
#endif
 
template<typename C>
inline size_t
__copy(const C*& dest, const basic_string<C>& s)
{
auto len = s.length();
C* p = new C[len+1];
s.copy(p, len);
p[len] = '\0';
dest = p;
return len;
}
 
} // namespace
 
// Now define and instantiate the functions that will be called by the
// shim facets defined when this file is recompiled for the other ABI.
 
// Cache the values returned by the numpunct facet f.
// Sets c->_M_allocated so that the __numpunct_cache destructor will
// delete[] the strings allocated by this function.
template<typename C>
void
__numpunct_fill_cache(current_abi, const facet* f, __numpunct_cache<C>* c)
{
auto* m = static_cast<const numpunct<C>*>(f);
 
c->_M_decimal_point = m->decimal_point();
c->_M_thousands_sep = m->thousands_sep();
 
c->_M_grouping = nullptr;
c->_M_truename = nullptr;
c->_M_falsename = nullptr;
// set _M_allocated so that if any allocation fails the previously
// allocated strings will be deleted in ~__numpunct_cache()
c->_M_allocated = true;
 
c->_M_grouping_size = __copy(c->_M_grouping, m->grouping());
c->_M_truename_size = __copy(c->_M_truename, m->truename());
c->_M_falsename_size = __copy(c->_M_falsename, m->falsename());
}
 
template void
__numpunct_fill_cache(current_abi, const facet*, __numpunct_cache<char>*);
 
#ifdef _GLIBCXX_USE_WCHAR_T
template void
__numpunct_fill_cache(current_abi, const facet*, __numpunct_cache<wchar_t>*);
#endif
 
template<typename C>
int
__collate_compare(current_abi, const facet* f, const C* lo1, const C* hi1,
const C* lo2, const C* hi2)
{
return static_cast<const collate<C>*>(f)->compare(lo1, hi1, lo2, hi2);
}
 
template int
__collate_compare(current_abi, const facet*, const char*, const char*,
const char*, const char*);
 
#ifdef _GLIBCXX_USE_WCHAR_T
template int
__collate_compare(current_abi, const facet*, const wchar_t*, const wchar_t*,
const wchar_t*, const wchar_t*);
#endif
 
template<typename C>
void
__collate_transform(current_abi, const facet* f, __any_string& st,
const C* __lo, const C* __hi)
{
auto* c = static_cast<const collate<C>*>(f);
st = c->transform(__lo, __hi);
}
 
template void
__collate_transform(current_abi, const facet*, __any_string&,
const char*, const char*);
 
#ifdef _GLIBCXX_USE_WCHAR_T
template void
__collate_transform(current_abi, const facet*, __any_string&,
const wchar_t*, const wchar_t*);
#endif
 
// Cache the values returned by the moneypunct facet, f.
// Sets c->_M_allocated so that the __moneypunct_cache destructor will
// delete[] the strings allocated by this function.
template<typename C, bool Intl>
void
__moneypunct_fill_cache(current_abi, const facet* f,
__moneypunct_cache<C, Intl>* c)
{
auto* m = static_cast<const moneypunct<C, Intl>*>(f);
 
c->_M_decimal_point = m->decimal_point();
c->_M_thousands_sep = m->thousands_sep();
c->_M_frac_digits = m->frac_digits();
 
c->_M_grouping = nullptr;
c->_M_curr_symbol = nullptr;
c->_M_positive_sign = nullptr;
c->_M_negative_sign = nullptr;
// Set _M_allocated so that if any allocation fails the previously
// allocated strings will be deleted in ~__moneypunct_cache().
c->_M_allocated = true;
 
c->_M_grouping_size = __copy(c->_M_grouping, m->grouping());
c->_M_curr_symbol_size = __copy(c->_M_curr_symbol, m->curr_symbol());
c->_M_positive_sign_size
= __copy(c->_M_positive_sign, m->positive_sign());
c->_M_negative_sign_size
= __copy(c->_M_negative_sign, m->negative_sign());
 
c->_M_pos_format = m->pos_format();
c->_M_neg_format = m->neg_format();
}
 
template void
__moneypunct_fill_cache(current_abi, const facet*,
__moneypunct_cache<char, true>*);
 
template void
__moneypunct_fill_cache(current_abi, const facet*,
__moneypunct_cache<char, false>*);
 
#ifdef _GLIBCXX_USE_WCHAR_T
template void
__moneypunct_fill_cache(current_abi, const facet*,
__moneypunct_cache<wchar_t, true>*);
 
template void
__moneypunct_fill_cache(current_abi, const facet*,
__moneypunct_cache<wchar_t, false>*);
#endif
 
template<typename C>
messages_base::catalog
__messages_open(current_abi, const facet* f, const char* s, size_t n,
const locale& l)
{
auto* m = static_cast<const messages<C>*>(f);
string str(s, n);
return m->open(str, l);
}
 
template messages_base::catalog
__messages_open<char>(current_abi, const facet*, const char*, size_t,
const locale&);
 
#ifdef _GLIBCXX_USE_WCHAR_T
template messages_base::catalog
__messages_open<wchar_t>(current_abi, const facet*, const char*, size_t,
const locale&);
#endif
 
template<typename C>
void
__messages_get(current_abi, const facet* f, __any_string& st,
messages_base::catalog c, int set, int msgid,
const C* s, size_t n)
{
auto* m = static_cast<const messages<C>*>(f);
st = m->get(c, set, msgid, basic_string<C>(s, n));
}
 
template void
__messages_get(current_abi, const facet*, __any_string&,
messages_base::catalog, int, int, const char*, size_t);
 
#ifdef _GLIBCXX_USE_WCHAR_T
template void
__messages_get(current_abi, const facet*, __any_string&,
messages_base::catalog, int, int, const wchar_t*, size_t);
#endif
 
template<typename C>
void
__messages_close(current_abi, const facet* f, messages_base::catalog c)
{
static_cast<const messages<C>*>(f)->close(c);
}
 
template void
__messages_close<char>(current_abi, const facet*, messages_base::catalog c);
 
#ifdef _GLIBCXX_USE_WCHAR_T
template void
__messages_close<wchar_t>(current_abi, const facet*,
messages_base::catalog c);
#endif
 
template<typename C>
time_base::dateorder
__time_get_dateorder(current_abi, const facet* f)
{ return static_cast<const time_get<C>*>(f)->date_order(); }
 
template time_base::dateorder
__time_get_dateorder<char>(current_abi, const facet*);
 
#ifdef _GLIBCXX_USE_WCHAR_T
template time_base::dateorder
__time_get_dateorder<wchar_t>(current_abi, const facet*);
#endif
 
template<typename C>
istreambuf_iterator<C>
__time_get(current_abi, const facet* f,
istreambuf_iterator<C> beg, istreambuf_iterator<C> end,
ios_base& io, ios_base::iostate& err, tm* t, char which)
{
auto* g = static_cast<const time_get<C>*>(f);
switch(which)
{
case 't':
return g->get_time(beg, end, io, err, t);
case 'd':
return g->get_date(beg, end, io, err, t);
case 'w':
return g->get_weekday(beg, end, io, err, t);
case 'm':
return g->get_monthname(beg, end, io, err, t);
case 'y':
return g->get_year(beg, end, io, err, t);
default:
__builtin_unreachable();
}
}
 
template istreambuf_iterator<char>
__time_get(current_abi, const facet*,
istreambuf_iterator<char>, istreambuf_iterator<char>,
ios_base&, ios_base::iostate&, tm*, char);
 
#ifdef _GLIBCXX_USE_WCHAR_T
template istreambuf_iterator<wchar_t>
__time_get(current_abi, const facet*,
istreambuf_iterator<wchar_t>, istreambuf_iterator<wchar_t>,
ios_base&, ios_base::iostate&, tm*, char);
#endif
 
template<typename C>
istreambuf_iterator<C>
__money_get(current_abi, const facet* f,
istreambuf_iterator<C> s, istreambuf_iterator<C> end,
bool intl, ios_base& str, ios_base::iostate& err,
long double* units, __any_string* digits)
{
auto* m = static_cast<const money_get<C>*>(f);
if (units)
return m->get(s, end, intl, str, err, *units);
basic_string<C> digits2;
s = m->get(s, end, intl, str, err, digits2);
if (err == ios_base::goodbit)
*digits = digits2;
return s;
}
 
template istreambuf_iterator<char>
__money_get(current_abi, const facet*,
istreambuf_iterator<char>, istreambuf_iterator<char>,
bool, ios_base&, ios_base::iostate&,
long double*, __any_string*);
 
#ifdef _GLIBCXX_USE_WCHAR_T
template istreambuf_iterator<wchar_t>
__money_get(current_abi, const facet*,
istreambuf_iterator<wchar_t>, istreambuf_iterator<wchar_t>,
bool, ios_base&, ios_base::iostate&,
long double*, __any_string*);
#endif
 
template<typename C>
ostreambuf_iterator<C>
__money_put(current_abi, const facet* f, ostreambuf_iterator<C> s,
bool intl, ios_base& io, C fill, long double units,
const __any_string* digits)
{
auto* m = static_cast<const money_put<C>*>(f);
if (digits)
return m->put(s, intl, io, fill, *digits);
else
return m->put(s, intl, io, fill, units);
}
 
template ostreambuf_iterator<char>
__money_put(current_abi, const facet*, ostreambuf_iterator<char>,
bool, ios_base&, char, long double, const __any_string*);
 
#ifdef _GLIBCXX_USE_WCHAR_T
template ostreambuf_iterator<wchar_t>
__money_put(current_abi, const facet*, ostreambuf_iterator<wchar_t>,
bool, ios_base&, wchar_t, long double, const __any_string*);
#endif
 
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace __facet_shims
 
_GLIBCXX_BEGIN_NAMESPACE_VERSION
// Create a new shim facet of type WHICH that forwards calls to F.
// F is the replacement facet provided by the user, WHICH is the ID of
// F's "other ABI twin" which we are replacing with a shim.
const locale::facet*
#if _GLIBCXX_USE_CXX11_ABI
locale::facet::_M_sso_shim(const locale::id* which) const
#else
locale::facet::_M_cow_shim(const locale::id* which) const
#endif
{
using namespace __facet_shims;
 
#if __cpp_rtti
// If this is already a shim just use its underlying facet.
if (auto* p = dynamic_cast<const __shim*>(this))
return p->_M_get();
#endif
 
if (which == &numpunct<char>::id)
return new numpunct_shim<char>{this};
if (which == &std::collate<char>::id)
return new collate_shim<char>{this};
if (which == &time_get<char>::id)
return new time_get_shim<char>{this};
if (which == &money_get<char>::id)
return new money_get_shim<char>{this};
if (which == &money_put<char>::id)
return new money_put_shim<char>{this};
if (which == &moneypunct<char, true>::id)
return new moneypunct_shim<char, true>{this};
if (which == &moneypunct<char, false>::id)
return new moneypunct_shim<char, false>{this};
if (which == &std::messages<char>::id)
return new messages_shim<char>{this};
#ifdef _GLIBCXX_USE_WCHAR_T
if (which == &numpunct<wchar_t>::id)
return new numpunct_shim<wchar_t>{this};
if (which == &std::collate<wchar_t>::id)
return new collate_shim<wchar_t>{this};
if (which == &time_get<wchar_t>::id)
return new time_get_shim<wchar_t>{this};
if (which == &money_get<wchar_t>::id)
return new money_get_shim<wchar_t>{this};
if (which == &money_put<wchar_t>::id)
return new money_put_shim<wchar_t>{this};
if (which == &moneypunct<wchar_t, true>::id)
return new moneypunct_shim<wchar_t, true>{this};
if (which == &moneypunct<wchar_t, false>::id)
return new moneypunct_shim<wchar_t, false>{this};
if (which == &std::messages<wchar_t>::id)
return new messages_shim<wchar_t>{this};
#endif
__throw_logic_error("cannot create shim for unknown locale::facet");
}
 
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/cxx11-stdexcept.cc
0,0 → 1,78
// Methods for Exception Support for -*- C++ -*-
 
// Copyright (C) 2014-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
//
// ISO C++ 14882: 19.1 Exception classes
//
 
#define _GLIBCXX_USE_CXX11_ABI 1
#include <stdexcept>
 
#if ! _GLIBCXX_USE_DUAL_ABI
# error This file should not be compiled for this configuration.
#endif
 
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
// These constructors take an abi-tagged std::string and use it to
// initialize an untagged COW std::string in _M_msg.
 
logic_error::logic_error(const string& __arg)
: _M_msg(__arg) { }
 
runtime_error::runtime_error(const string& __arg)
: _M_msg(__arg) { }
 
// These constructors take an abi-tagged std::string and pass it to the
// base class constructors defined above.
 
domain_error::domain_error(const string& __arg)
: logic_error(__arg) { }
 
invalid_argument::invalid_argument(const string& __arg)
: logic_error(__arg) { }
 
length_error::length_error(const string& __arg)
: logic_error(__arg) { }
 
out_of_range::out_of_range(const string& __arg)
: logic_error(__arg) { }
 
range_error::range_error(const string& __arg)
: runtime_error(__arg) { }
 
overflow_error::overflow_error(const string& __arg)
: runtime_error(__arg) { }
 
underflow_error::underflow_error(const string& __arg)
: runtime_error(__arg) { }
 
// Converting constructor from ABI-tagged std::string to COW string.
__cow_string::__cow_string(const string& s)
: __cow_string(s.c_str(), s.length()) { }
 
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/cxx11-wlocale-inst.cc
0,0 → 1,32
// Copyright (C) 2014-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
//
// ISO C++ 14882: 22.1 Locales
//
 
#define _GLIBCXX_USE_CXX11_ABI 1
#include <bits/c++config.h>
#ifdef _GLIBCXX_USE_WCHAR_T
#define C wchar_t
#include "cxx11-locale-inst.cc"
#endif
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/debug.cc
0,0 → 1,966
// Debugging mode support code -*- C++ -*-
 
// Copyright (C) 2003-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
#include <debug/debug.h>
#include <debug/safe_base.h>
#include <debug/safe_unordered_base.h>
#include <debug/safe_iterator.h>
#include <debug/safe_local_iterator.h>
#include <algorithm>
#include <cassert>
#include <cstring>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <functional>
 
using namespace std;
 
namespace
{
/** Returns different instances of __mutex depending on the passed address
* in order to limit contention without breaking current library binary
* compatibility. */
__gnu_cxx::__mutex&
get_safe_base_mutex(void* __address)
{
const size_t mask = 0xf;
static __gnu_cxx::__mutex safe_base_mutex[mask + 1];
const size_t index = _Hash_impl::hash(__address) & mask;
return safe_base_mutex[index];
}
 
void
swap_its(__gnu_debug::_Safe_sequence_base& __lhs,
__gnu_debug::_Safe_iterator_base*& __lhs_its,
__gnu_debug::_Safe_sequence_base& __rhs,
__gnu_debug::_Safe_iterator_base*& __rhs_its)
{
swap(__lhs_its, __rhs_its);
__gnu_debug::_Safe_iterator_base* __iter;
for (__iter = __rhs_its; __iter; __iter = __iter->_M_next)
__iter->_M_sequence = &__rhs;
for (__iter = __lhs_its; __iter; __iter = __iter->_M_next)
__iter->_M_sequence = &__lhs;
}
 
void
swap_seq(__gnu_debug::_Safe_sequence_base& __lhs,
__gnu_debug::_Safe_sequence_base& __rhs)
{
swap(__lhs._M_version, __rhs._M_version);
swap_its(__lhs, __lhs._M_iterators,
__rhs, __rhs._M_iterators);
swap_its(__lhs, __lhs._M_const_iterators,
__rhs, __rhs._M_const_iterators);
}
 
void
swap_ucont(__gnu_debug::_Safe_unordered_container_base& __lhs,
__gnu_debug::_Safe_unordered_container_base& __rhs)
{
swap_seq(__lhs, __rhs);
swap_its(__lhs, __lhs._M_local_iterators,
__rhs, __rhs._M_local_iterators);
swap_its(__lhs, __lhs._M_const_local_iterators,
__rhs, __rhs._M_const_local_iterators);
}
 
void
detach_all(__gnu_debug::_Safe_iterator_base* __iter)
{
for (; __iter;)
{
__gnu_debug::_Safe_iterator_base* __old = __iter;
__iter = __iter->_M_next;
__old->_M_reset();
}
}
} // anonymous namespace
 
namespace __gnu_debug
{
const char* _S_debug_messages[] =
{
// General Checks
"function requires a valid iterator range [%1.name;, %2.name;)",
"attempt to insert into container with a singular iterator",
"attempt to insert into container with an iterator"
" from a different container",
"attempt to erase from container with a %2.state; iterator",
"attempt to erase from container with an iterator"
" from a different container",
"attempt to subscript container with out-of-bounds index %2;,"
" but container only holds %3; elements",
"attempt to access an element in an empty container",
"elements in iterator range [%1.name;, %2.name;)"
" are not partitioned by the value %3;",
"elements in iterator range [%1.name;, %2.name;)"
" are not partitioned by the predicate %3; and value %4;",
"elements in iterator range [%1.name;, %2.name;) are not sorted",
"elements in iterator range [%1.name;, %2.name;)"
" are not sorted according to the predicate %3;",
"elements in iterator range [%1.name;, %2.name;) do not form a heap",
"elements in iterator range [%1.name;, %2.name;)"
" do not form a heap with respect to the predicate %3;",
// std::bitset checks
"attempt to write through a singular bitset reference",
"attempt to read from a singular bitset reference",
"attempt to flip a singular bitset reference",
// std::list checks
"attempt to splice a list into itself",
"attempt to splice lists with unequal allocators",
"attempt to splice elements referenced by a %1.state; iterator",
"attempt to splice an iterator from a different container",
"splice destination %1.name;"
" occurs within source range [%2.name;, %3.name;)",
// iterator checks
"attempt to initialize an iterator that will immediately become singular",
"attempt to copy-construct an iterator from a singular iterator",
"attempt to construct a constant iterator"
" from a singular mutable iterator",
"attempt to copy from a singular iterator",
"attempt to dereference a %1.state; iterator",
"attempt to increment a %1.state; iterator",
"attempt to decrement a %1.state; iterator",
"attempt to subscript a %1.state; iterator %2; step from"
" its current position, which falls outside its dereferenceable range",
"attempt to advance a %1.state; iterator %2; steps,"
" which falls outside its valid range",
"attempt to retreat a %1.state; iterator %2; steps,"
" which falls outside its valid range",
"attempt to compare a %1.state; iterator to a %2.state; iterator",
"attempt to compare iterators from different sequences",
"attempt to order a %1.state; iterator to a %2.state; iterator",
"attempt to order iterators from different sequences",
"attempt to compute the difference between a %1.state;"
" iterator to a %2.state; iterator",
"attempt to compute the different between two iterators"
" from different sequences",
// istream_iterator
"attempt to dereference an end-of-stream istream_iterator",
"attempt to increment an end-of-stream istream_iterator",
// ostream_iterator
"attempt to output via an ostream_iterator with no associated stream",
// istreambuf_iterator
"attempt to dereference an end-of-stream istreambuf_iterator"
" (this is a GNU extension)",
"attempt to increment an end-of-stream istreambuf_iterator",
// std::forward_list
"attempt to insert into container after an end iterator",
"attempt to erase from container after a %2.state; iterator not followed"
" by a dereferenceable one",
"function requires a valid iterator range (%2.name;, %3.name;)"
", \"%2.name;\" shall be before and not equal to \"%3.name;\"",
// std::unordered_container::local_iterator
"attempt to compare local iterators from different unordered container"
" buckets",
"function requires a non-empty iterator range [%1.name;, %2.name;)",
"attempt to self move assign",
"attempt to access container with out-of-bounds bucket index %2;,"
" container only holds %3; buckets",
"load factor shall be positive",
"allocators must be equal",
"attempt to insert with an iterator range [%1.name;, %2.name;) from this container"
};
 
void
_Safe_sequence_base::
_M_detach_all()
{
__gnu_cxx::__scoped_lock sentry(_M_get_mutex());
detach_all(_M_iterators);
_M_iterators = 0;
detach_all(_M_const_iterators);
_M_const_iterators = 0;
}
 
void
_Safe_sequence_base::
_M_detach_singular()
{
__gnu_cxx::__scoped_lock sentry(_M_get_mutex());
for (_Safe_iterator_base* __iter = _M_iterators; __iter;)
{
_Safe_iterator_base* __old = __iter;
__iter = __iter->_M_next;
if (__old->_M_singular())
__old->_M_detach_single();
}
 
for (_Safe_iterator_base* __iter2 = _M_const_iterators; __iter2;)
{
_Safe_iterator_base* __old = __iter2;
__iter2 = __iter2->_M_next;
if (__old->_M_singular())
__old->_M_detach_single();
}
}
 
void
_Safe_sequence_base::
_M_revalidate_singular()
{
__gnu_cxx::__scoped_lock sentry(_M_get_mutex());
for (_Safe_iterator_base* __iter = _M_iterators; __iter;
__iter = __iter->_M_next)
__iter->_M_version = _M_version;
 
for (_Safe_iterator_base* __iter2 = _M_const_iterators; __iter2;
__iter2 = __iter2->_M_next)
__iter2->_M_version = _M_version;
}
 
void
_Safe_sequence_base::
_M_swap(_Safe_sequence_base& __x) noexcept
{
// We need to lock both sequences to swap
using namespace __gnu_cxx;
__mutex *__this_mutex = &_M_get_mutex();
__mutex *__x_mutex = &__x._M_get_mutex();
if (__this_mutex == __x_mutex)
{
__scoped_lock __lock(*__this_mutex);
swap_seq(*this, __x);
}
else
{
__scoped_lock __l1(__this_mutex < __x_mutex
? *__this_mutex : *__x_mutex);
__scoped_lock __l2(__this_mutex < __x_mutex
? *__x_mutex : *__this_mutex);
swap_seq(*this, __x);
}
}
 
__gnu_cxx::__mutex&
_Safe_sequence_base::
_M_get_mutex() throw ()
{ return get_safe_base_mutex(this); }
 
void
_Safe_sequence_base::
_M_attach(_Safe_iterator_base* __it, bool __constant)
{
__gnu_cxx::__scoped_lock sentry(_M_get_mutex());
_M_attach_single(__it, __constant);
}
 
void
_Safe_sequence_base::
_M_attach_single(_Safe_iterator_base* __it, bool __constant) throw ()
{
_Safe_iterator_base*& __its =
__constant ? _M_const_iterators : _M_iterators;
__it->_M_next = __its;
if (__it->_M_next)
__it->_M_next->_M_prior = __it;
__its = __it;
}
 
void
_Safe_sequence_base::
_M_detach(_Safe_iterator_base* __it)
{
// Remove __it from this sequence's list
__gnu_cxx::__scoped_lock sentry(_M_get_mutex());
_M_detach_single(__it);
}
 
void
_Safe_sequence_base::
_M_detach_single(_Safe_iterator_base* __it) throw ()
{
// Remove __it from this sequence's list
__it->_M_unlink();
if (_M_const_iterators == __it)
_M_const_iterators = __it->_M_next;
if (_M_iterators == __it)
_M_iterators = __it->_M_next;
}
 
void
_Safe_iterator_base::
_M_attach(_Safe_sequence_base* __seq, bool __constant)
{
_M_detach();
// Attach to the new sequence (if there is one)
if (__seq)
{
_M_sequence = __seq;
_M_version = _M_sequence->_M_version;
_M_sequence->_M_attach(this, __constant);
}
}
void
_Safe_iterator_base::
_M_attach_single(_Safe_sequence_base* __seq, bool __constant) throw ()
{
_M_detach_single();
// Attach to the new sequence (if there is one)
if (__seq)
{
_M_sequence = __seq;
_M_version = _M_sequence->_M_version;
_M_sequence->_M_attach_single(this, __constant);
}
}
 
void
_Safe_iterator_base::
_M_detach()
{
if (_M_sequence)
_M_sequence->_M_detach(this);
 
_M_reset();
}
 
void
_Safe_iterator_base::
_M_detach_single() throw ()
{
if (_M_sequence)
_M_sequence->_M_detach_single(this);
 
_M_reset();
}
 
void
_Safe_iterator_base::
_M_reset() throw ()
{
_M_sequence = 0;
_M_version = 0;
_M_prior = 0;
_M_next = 0;
}
 
bool
_Safe_iterator_base::
_M_singular() const throw ()
{ return !_M_sequence || _M_version != _M_sequence->_M_version; }
bool
_Safe_iterator_base::
_M_can_compare(const _Safe_iterator_base& __x) const throw ()
{
return (!_M_singular()
&& !__x._M_singular() && _M_sequence == __x._M_sequence);
}
 
__gnu_cxx::__mutex&
_Safe_iterator_base::
_M_get_mutex() throw ()
{ return get_safe_base_mutex(_M_sequence); }
 
_Safe_unordered_container_base*
_Safe_local_iterator_base::
_M_get_container() const noexcept
{ return static_cast<_Safe_unordered_container_base*>(_M_sequence); }
 
void
_Safe_local_iterator_base::
_M_attach(_Safe_sequence_base* __cont, bool __constant)
{
_M_detach();
// Attach to the new container (if there is one)
if (__cont)
{
_M_sequence = __cont;
_M_version = _M_sequence->_M_version;
_M_get_container()->_M_attach_local(this, __constant);
}
}
void
_Safe_local_iterator_base::
_M_attach_single(_Safe_sequence_base* __cont, bool __constant) throw ()
{
_M_detach_single();
// Attach to the new container (if there is one)
if (__cont)
{
_M_sequence = __cont;
_M_version = _M_sequence->_M_version;
_M_get_container()->_M_attach_local_single(this, __constant);
}
}
 
void
_Safe_local_iterator_base::
_M_detach()
{
if (_M_sequence)
_M_get_container()->_M_detach_local(this);
 
_M_reset();
}
 
void
_Safe_local_iterator_base::
_M_detach_single() throw ()
{
if (_M_sequence)
_M_get_container()->_M_detach_local_single(this);
 
_M_reset();
}
 
void
_Safe_unordered_container_base::
_M_detach_all()
{
__gnu_cxx::__scoped_lock sentry(_M_get_mutex());
detach_all(_M_iterators);
_M_iterators = 0;
detach_all(_M_const_iterators);
_M_const_iterators = 0;
 
detach_all(_M_local_iterators);
_M_local_iterators = 0;
 
detach_all(_M_const_local_iterators);
_M_const_local_iterators = 0;
}
 
void
_Safe_unordered_container_base::
_M_swap(_Safe_unordered_container_base& __x) noexcept
{
// We need to lock both containers to swap
using namespace __gnu_cxx;
__mutex *__this_mutex = &_M_get_mutex();
__mutex *__x_mutex = &__x._M_get_mutex();
if (__this_mutex == __x_mutex)
{
__scoped_lock __lock(*__this_mutex);
swap_ucont(*this, __x);
}
else
{
__scoped_lock __l1(__this_mutex < __x_mutex
? *__this_mutex : *__x_mutex);
__scoped_lock __l2(__this_mutex < __x_mutex
? *__x_mutex : *__this_mutex);
swap_ucont(*this, __x);
}
}
 
void
_Safe_unordered_container_base::
_M_attach_local(_Safe_iterator_base* __it, bool __constant)
{
__gnu_cxx::__scoped_lock sentry(_M_get_mutex());
_M_attach_local_single(__it, __constant);
}
 
void
_Safe_unordered_container_base::
_M_attach_local_single(_Safe_iterator_base* __it, bool __constant) throw ()
{
_Safe_iterator_base*& __its =
__constant ? _M_const_local_iterators : _M_local_iterators;
__it->_M_next = __its;
if (__it->_M_next)
__it->_M_next->_M_prior = __it;
__its = __it;
}
 
void
_Safe_unordered_container_base::
_M_detach_local(_Safe_iterator_base* __it)
{
// Remove __it from this container's list
__gnu_cxx::__scoped_lock sentry(_M_get_mutex());
_M_detach_local_single(__it);
}
 
void
_Safe_unordered_container_base::
_M_detach_local_single(_Safe_iterator_base* __it) throw ()
{
// Remove __it from this container's list
__it->_M_unlink();
if (_M_const_local_iterators == __it)
_M_const_local_iterators = __it->_M_next;
if (_M_local_iterators == __it)
_M_local_iterators = __it->_M_next;
}
 
void
_Error_formatter::_Parameter::
_M_print_field(const _Error_formatter* __formatter, const char* __name) const
{
assert(this->_M_kind != _Parameter::__unused_param);
const int __bufsize = 64;
char __buf[__bufsize];
if (_M_kind == __iterator)
{
if (strcmp(__name, "name") == 0)
{
assert(_M_variant._M_iterator._M_name);
__formatter->_M_print_word(_M_variant._M_iterator._M_name);
}
else if (strcmp(__name, "address") == 0)
{
__formatter->_M_format_word(__buf, __bufsize, "%p",
_M_variant._M_iterator._M_address);
__formatter->_M_print_word(__buf);
}
else if (strcmp(__name, "type") == 0)
{
if (!_M_variant._M_iterator._M_type)
__formatter->_M_print_word("<unknown type>");
else
// TBD: demangle!
__formatter->_M_print_word(_M_variant._M_iterator.
_M_type->name());
}
else if (strcmp(__name, "constness") == 0)
{
static const char* __constness_names[__last_constness] =
{
"<unknown>",
"constant",
"mutable"
};
__formatter->_M_print_word(__constness_names[_M_variant.
_M_iterator.
_M_constness]);
}
else if (strcmp(__name, "state") == 0)
{
static const char* __state_names[__last_state] =
{
"<unknown>",
"singular",
"dereferenceable (start-of-sequence)",
"dereferenceable",
"past-the-end",
"before-begin"
};
__formatter->_M_print_word(__state_names[_M_variant.
_M_iterator._M_state]);
}
else if (strcmp(__name, "sequence") == 0)
{
assert(_M_variant._M_iterator._M_sequence);
__formatter->_M_format_word(__buf, __bufsize, "%p",
_M_variant._M_iterator._M_sequence);
__formatter->_M_print_word(__buf);
}
else if (strcmp(__name, "seq_type") == 0)
{
if (!_M_variant._M_iterator._M_seq_type)
__formatter->_M_print_word("<unknown seq_type>");
else
// TBD: demangle!
__formatter->_M_print_word(_M_variant._M_iterator.
_M_seq_type->name());
}
else
assert(false);
}
else if (_M_kind == __sequence)
{
if (strcmp(__name, "name") == 0)
{
assert(_M_variant._M_sequence._M_name);
__formatter->_M_print_word(_M_variant._M_sequence._M_name);
}
else if (strcmp(__name, "address") == 0)
{
assert(_M_variant._M_sequence._M_address);
__formatter->_M_format_word(__buf, __bufsize, "%p",
_M_variant._M_sequence._M_address);
__formatter->_M_print_word(__buf);
}
else if (strcmp(__name, "type") == 0)
{
if (!_M_variant._M_sequence._M_type)
__formatter->_M_print_word("<unknown type>");
else
// TBD: demangle!
__formatter->_M_print_word(_M_variant._M_sequence.
_M_type->name());
}
else
assert(false);
}
else if (_M_kind == __integer)
{
if (strcmp(__name, "name") == 0)
{
assert(_M_variant._M_integer._M_name);
__formatter->_M_print_word(_M_variant._M_integer._M_name);
}
else
assert(false);
}
else if (_M_kind == __string)
{
if (strcmp(__name, "name") == 0)
{
assert(_M_variant._M_string._M_name);
__formatter->_M_print_word(_M_variant._M_string._M_name);
}
else
assert(false);
}
else
{
assert(false);
}
}
void
_Error_formatter::_Parameter::
_M_print_description(const _Error_formatter* __formatter) const
{
const int __bufsize = 128;
char __buf[__bufsize];
if (_M_kind == __iterator)
{
__formatter->_M_print_word("iterator ");
if (_M_variant._M_iterator._M_name)
{
__formatter->_M_format_word(__buf, __bufsize, "\"%s\" ",
_M_variant._M_iterator._M_name);
__formatter->_M_print_word(__buf);
}
__formatter->_M_format_word(__buf, __bufsize, "@ 0x%p {\n",
_M_variant._M_iterator._M_address);
__formatter->_M_print_word(__buf);
if (_M_variant._M_iterator._M_type)
{
__formatter->_M_print_word("type = ");
_M_print_field(__formatter, "type");
if (_M_variant._M_iterator._M_constness != __unknown_constness)
{
__formatter->_M_print_word(" (");
_M_print_field(__formatter, "constness");
__formatter->_M_print_word(" iterator)");
}
__formatter->_M_print_word(";\n");
}
if (_M_variant._M_iterator._M_state != __unknown_state)
{
__formatter->_M_print_word(" state = ");
_M_print_field(__formatter, "state");
__formatter->_M_print_word(";\n");
}
if (_M_variant._M_iterator._M_sequence)
{
__formatter->_M_print_word(" references sequence ");
if (_M_variant._M_iterator._M_seq_type)
{
__formatter->_M_print_word("with type `");
_M_print_field(__formatter, "seq_type");
__formatter->_M_print_word("' ");
}
__formatter->_M_format_word(__buf, __bufsize, "@ 0x%p\n",
_M_variant._M_iterator._M_sequence);
__formatter->_M_print_word(__buf);
}
__formatter->_M_print_word("}\n");
}
else if (_M_kind == __sequence)
{
__formatter->_M_print_word("sequence ");
if (_M_variant._M_sequence._M_name)
{
__formatter->_M_format_word(__buf, __bufsize, "\"%s\" ",
_M_variant._M_sequence._M_name);
__formatter->_M_print_word(__buf);
}
__formatter->_M_format_word(__buf, __bufsize, "@ 0x%p {\n",
_M_variant._M_sequence._M_address);
__formatter->_M_print_word(__buf);
if (_M_variant._M_sequence._M_type)
{
__formatter->_M_print_word(" type = ");
_M_print_field(__formatter, "type");
__formatter->_M_print_word(";\n");
}
__formatter->_M_print_word("}\n");
}
}
 
const _Error_formatter&
_Error_formatter::_M_message(_Debug_msg_id __id) const throw ()
{ return this->_M_message(_S_debug_messages[__id]); }
void
_Error_formatter::_M_error() const
{
const int __bufsize = 128;
char __buf[__bufsize];
// Emit file & line number information
_M_column = 1;
_M_wordwrap = false;
if (_M_file)
{
_M_format_word(__buf, __bufsize, "%s:", _M_file);
_M_print_word(__buf);
_M_column += strlen(__buf);
}
if (_M_line > 0)
{
_M_format_word(__buf, __bufsize, "%u:", _M_line);
_M_print_word(__buf);
_M_column += strlen(__buf);
}
if (_M_max_length)
_M_wordwrap = true;
_M_print_word("error: ");
// Print the error message
assert(_M_text);
_M_print_string(_M_text);
_M_print_word(".\n");
// Emit descriptions of the objects involved in the operation
_M_wordwrap = false;
bool __has_noninteger_parameters = false;
for (unsigned int __i = 0; __i < _M_num_parameters; ++__i)
{
if (_M_parameters[__i]._M_kind == _Parameter::__iterator
|| _M_parameters[__i]._M_kind == _Parameter::__sequence)
{
if (!__has_noninteger_parameters)
{
_M_first_line = true;
_M_print_word("\nObjects involved in the operation:\n");
__has_noninteger_parameters = true;
}
_M_parameters[__i]._M_print_description(this);
}
}
abort();
}
 
template<typename _Tp>
void
_Error_formatter::_M_format_word(char* __buf,
int __n __attribute__ ((__unused__)),
const char* __fmt, _Tp __s) const throw ()
{
#ifdef _GLIBCXX_USE_C99
std::snprintf(__buf, __n, __fmt, __s);
#else
std::sprintf(__buf, __fmt, __s);
#endif
}
 
void
_Error_formatter::_M_print_word(const char* __word) const
{
if (!_M_wordwrap)
{
fprintf(stderr, "%s", __word);
return;
}
size_t __length = strlen(__word);
if (__length == 0)
return;
size_t __visual_length
= __word[__length - 1] == '\n' ? __length - 1 : __length;
if (__visual_length == 0
|| (_M_column + __visual_length < _M_max_length)
|| (__visual_length >= _M_max_length && _M_column == 1))
{
// If this isn't the first line, indent
if (_M_column == 1 && !_M_first_line)
{
char __spacing[_M_indent + 1];
for (int i = 0; i < _M_indent; ++i)
__spacing[i] = ' ';
__spacing[_M_indent] = '\0';
fprintf(stderr, "%s", __spacing);
_M_column += _M_indent;
}
fprintf(stderr, "%s", __word);
if (__word[__length - 1] == '\n')
{
_M_first_line = false;
_M_column = 1;
}
else
_M_column += __length;
}
else
{
_M_print_word("\n");
_M_print_word(__word);
}
}
void
_Error_formatter::
_M_print_string(const char* __string) const
{
const char* __start = __string;
const char* __finish = __start;
const int __bufsize = 128;
char __buf[__bufsize];
 
while (*__start)
{
if (*__start != '%')
{
// [__start, __finish) denotes the next word
__finish = __start;
while (isalnum(*__finish))
++__finish;
if (__start == __finish)
++__finish;
if (isspace(*__finish))
++__finish;
const ptrdiff_t __len = __finish - __start;
assert(__len < __bufsize);
memcpy(__buf, __start, __len);
__buf[__len] = '\0';
_M_print_word(__buf);
__start = __finish;
// Skip extra whitespace
while (*__start == ' ')
++__start;
continue;
}
++__start;
assert(*__start);
if (*__start == '%')
{
_M_print_word("%");
++__start;
continue;
}
// Get the parameter number
assert(*__start >= '1' && *__start <= '9');
size_t __param = *__start - '0';
--__param;
assert(__param < _M_num_parameters);
// '.' separates the parameter number from the field
// name, if there is one.
++__start;
if (*__start != '.')
{
assert(*__start == ';');
++__start;
__buf[0] = '\0';
if (_M_parameters[__param]._M_kind == _Parameter::__integer)
{
_M_format_word(__buf, __bufsize, "%ld",
_M_parameters[__param]._M_variant._M_integer._M_value);
_M_print_word(__buf);
}
else if (_M_parameters[__param]._M_kind == _Parameter::__string)
_M_print_string(_M_parameters[__param]._M_variant._M_string._M_value);
continue;
}
// Extract the field name we want
enum { __max_field_len = 16 };
char __field[__max_field_len];
int __field_idx = 0;
++__start;
while (*__start != ';')
{
assert(*__start);
assert(__field_idx < __max_field_len-1);
__field[__field_idx++] = *__start++;
}
++__start;
__field[__field_idx] = 0;
_M_parameters[__param]._M_print_field(this, __field);
}
}
 
void
_Error_formatter::_M_get_max_length() const throw ()
{
const char* __nptr = std::getenv("GLIBCXX_DEBUG_MESSAGE_LENGTH");
if (__nptr)
{
char* __endptr;
const unsigned long __ret = std::strtoul(__nptr, &__endptr, 0);
if (*__nptr != '\0' && *__endptr == '\0')
_M_max_length = __ret;
}
}
 
// Instantiations.
template
void
_Error_formatter::_M_format_word(char*, int, const char*,
const void*) const;
 
template
void
_Error_formatter::_M_format_word(char*, int, const char*, long) const;
 
template
void
_Error_formatter::_M_format_word(char*, int, const char*,
std::size_t) const;
 
template
void
_Error_formatter::_M_format_word(char*, int, const char*,
const char*) const;
} // namespace __gnu_debug
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/ext11-inst.cc
0,0 → 1,40
// Explicit instantiation file.
 
// Copyright (C) 2014-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
#include <ext/stdio_filebuf.h>
#include <ext/stdio_sync_filebuf.h>
 
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
template class stdio_filebuf<char>;
template class stdio_sync_filebuf<char>;
#ifdef _GLIBCXX_USE_WCHAR_T
template class stdio_filebuf<wchar_t>;
template class stdio_sync_filebuf<wchar_t>;
#endif
 
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/fstream-inst.cc
0,0 → 1,49
// Explicit instantiation file.
 
// Copyright (C) 1997-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
//
// ISO C++ 14882:
//
 
#define _GLIBCXX_USE_CXX11_ABI 1
#include <fstream>
 
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
template class basic_filebuf<char, char_traits<char> >;
template class basic_ifstream<char>;
template class basic_ofstream<char>;
template class basic_fstream<char>;
 
#ifdef _GLIBCXX_USE_WCHAR_T
template class basic_filebuf<wchar_t, char_traits<wchar_t> >;
template class basic_ifstream<wchar_t>;
template class basic_ofstream<wchar_t>;
template class basic_fstream<wchar_t>;
#endif
 
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/functexcept.cc
0,0 → 1,147
// Copyright (C) 2001-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
// We don't want to change the type thrown by __throw_ios_failure (yet?)
#define _GLIBCXX_USE_CXX11_ABI 0
 
#include <bits/functexcept.h>
#include <cstdlib>
#include <exception>
#include <stdexcept>
#include <new>
#include <typeinfo>
#include <ios>
#include <system_error>
#include <future>
#include <functional>
#include <bits/regex_error.h>
#include <stdarg.h>
 
#ifdef _GLIBCXX_USE_NLS
# include <libintl.h>
# define _(msgid) gettext (msgid)
#else
# define _(msgid) (msgid)
#endif
 
namespace __gnu_cxx
{
int __snprintf_lite(char *__buf, size_t __bufsize, const char *__fmt,
va_list __ap);
}
 
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
void
__throw_bad_exception()
{ _GLIBCXX_THROW_OR_ABORT(bad_exception()); }
 
void
__throw_bad_alloc()
{ _GLIBCXX_THROW_OR_ABORT(bad_alloc()); }
 
void
__throw_bad_cast()
{ _GLIBCXX_THROW_OR_ABORT(bad_cast()); }
 
void
__throw_bad_typeid()
{ _GLIBCXX_THROW_OR_ABORT(bad_typeid()); }
 
void
__throw_logic_error(const char* __s __attribute__((unused)))
{ _GLIBCXX_THROW_OR_ABORT(logic_error(_(__s))); }
 
void
__throw_domain_error(const char* __s __attribute__((unused)))
{ _GLIBCXX_THROW_OR_ABORT(domain_error(_(__s))); }
 
void
__throw_invalid_argument(const char* __s __attribute__((unused)))
{ _GLIBCXX_THROW_OR_ABORT(invalid_argument(_(__s))); }
 
void
__throw_length_error(const char* __s __attribute__((unused)))
{ _GLIBCXX_THROW_OR_ABORT(length_error(_(__s))); }
 
void
__throw_out_of_range(const char* __s __attribute__((unused)))
{ _GLIBCXX_THROW_OR_ABORT(out_of_range(_(__s))); }
 
void
__throw_out_of_range_fmt(const char* __fmt, ...)
{
const size_t __len = __builtin_strlen(__fmt);
// We expect at most 2 numbers, and 1 short string. The additional
// 512 bytes should provide more than enough space for expansion.
const size_t __alloca_size = __len + 512;
char *const __s = static_cast<char*>(__builtin_alloca(__alloca_size));
va_list __ap;
 
va_start(__ap, __fmt);
__gnu_cxx::__snprintf_lite(__s, __alloca_size, __fmt, __ap);
_GLIBCXX_THROW_OR_ABORT(out_of_range(_(__s)));
va_end(__ap); // Not reached.
}
 
void
__throw_runtime_error(const char* __s __attribute__((unused)))
{ _GLIBCXX_THROW_OR_ABORT(runtime_error(_(__s))); }
 
void
__throw_range_error(const char* __s __attribute__((unused)))
{ _GLIBCXX_THROW_OR_ABORT(range_error(_(__s))); }
 
void
__throw_overflow_error(const char* __s __attribute__((unused)))
{ _GLIBCXX_THROW_OR_ABORT(overflow_error(_(__s))); }
 
void
__throw_underflow_error(const char* __s __attribute__((unused)))
{ _GLIBCXX_THROW_OR_ABORT(underflow_error(_(__s))); }
 
void
__throw_ios_failure(const char* __s __attribute__((unused)))
{ _GLIBCXX_THROW_OR_ABORT(ios_base::failure(_(__s))); }
 
void
__throw_system_error(int __i __attribute__((unused)))
{ _GLIBCXX_THROW_OR_ABORT(system_error(error_code(__i,
generic_category()))); }
 
void
__throw_future_error(int __i __attribute__((unused)))
{ _GLIBCXX_THROW_OR_ABORT(future_error(make_error_code(future_errc(__i)))); }
 
void
__throw_bad_function_call()
{ _GLIBCXX_THROW_OR_ABORT(bad_function_call()); }
 
void
__throw_regex_error(regex_constants::error_type __ecode
__attribute__((unused)))
{ _GLIBCXX_THROW_OR_ABORT(regex_error(__ecode)); }
 
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/functional.cc
0,0 → 1,38
// Support for <functional> -*- C++ -*-
 
// Copyright (C) 2011-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
#include <functional>
 
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
bad_function_call::~bad_function_call() noexcept = default;
 
const char*
bad_function_call::what() const noexcept
{ return "bad_function_call"; }
 
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/futex.cc
0,0 → 1,99
// futex -*- C++ -*-
 
// Copyright (C) 2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
#include <bits/atomic_futex.h>
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
#if defined(_GLIBCXX_HAVE_LINUX_FUTEX) && ATOMIC_INT_LOCK_FREE > 1
#include <chrono>
#include <climits>
#include <syscall.h>
#include <unistd.h>
#include <sys/time.h>
#include <errno.h>
#include <debug/debug.h>
 
// Constants for the wait/wake futex syscall operations
const unsigned futex_wait_op = 0;
const unsigned futex_wake_op = 1;
 
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
bool
__atomic_futex_unsigned_base::_M_futex_wait_until(unsigned *__addr,
unsigned __val,
bool __has_timeout, chrono::seconds __s, chrono::nanoseconds __ns)
{
if (!__has_timeout)
{
// Ignore whether we actually succeeded to block because at worst,
// we will fall back to spin-waiting. The only thing we could do
// here on errors is abort.
int ret __attribute__((unused));
ret = syscall (SYS_futex, __addr, futex_wait_op, __val, nullptr);
_GLIBCXX_DEBUG_ASSERT(ret == 0 || errno == EINTR || errno == EAGAIN);
return true;
}
else
{
struct timeval tv;
gettimeofday (&tv, NULL);
// Convert the absolute timeout value to a relative timeout
struct timespec rt;
rt.tv_sec = __s.count() - tv.tv_sec;
rt.tv_nsec = __ns.count() - tv.tv_usec * 1000;
if (rt.tv_nsec < 0)
{
rt.tv_nsec += 1000000000;
--rt.tv_sec;
}
// Did we already time out?
if (rt.tv_sec < 0)
return false;
 
if (syscall (SYS_futex, __addr, futex_wait_op, __val, &rt) == -1)
{
_GLIBCXX_DEBUG_ASSERT(errno == EINTR || errno == EAGAIN
|| errno == ETIMEDOUT);
if (errno == ETIMEDOUT)
return false;
}
return true;
}
}
 
void
__atomic_futex_unsigned_base::_M_futex_notify_all(unsigned* __addr)
{
// This syscall can fail for various reasons, including in situations
// in which there is no real error. Thus, we don't bother checking
// the error codes. See the futex documentation and glibc for background.
syscall (SYS_futex, __addr, futex_wake_op, INT_MAX);
}
 
_GLIBCXX_END_NAMESPACE_VERSION
}
#endif
#endif
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/future.cc
0,0 → 1,112
// future -*- C++ -*-
 
// Copyright (C) 2009-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
#include <future>
 
namespace
{
struct future_error_category : public std::error_category
{
virtual const char*
name() const noexcept
{ return "future"; }
 
_GLIBCXX_DEFAULT_ABI_TAG
virtual std::string message(int __ec) const
{
std::string __msg;
switch (std::future_errc(__ec))
{
case std::future_errc::broken_promise:
__msg = "Broken promise";
break;
case std::future_errc::future_already_retrieved:
__msg = "Future already retrieved";
break;
case std::future_errc::promise_already_satisfied:
__msg = "Promise already satisfied";
break;
case std::future_errc::no_state:
__msg = "No associated state";
break;
default:
__msg = "Unknown error";
break;
}
return __msg;
}
};
 
const future_error_category&
__future_category_instance() noexcept
{
static const future_error_category __fec{};
return __fec;
}
}
 
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
const error_category& future_category() noexcept
{ return __future_category_instance(); }
 
future_error::~future_error() noexcept { }
 
const char*
future_error::what() const noexcept { return logic_error::what(); }
 
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
&& (ATOMIC_INT_LOCK_FREE > 1)
__future_base::_Result_base::_Result_base() = default;
 
__future_base::_Result_base::~_Result_base() = default;
 
void
__future_base::_State_baseV2::_Make_ready::_S_run(void* p)
{
unique_ptr<_Make_ready> mr{static_cast<_Make_ready*>(p)};
if (auto state = mr->_M_shared_state.lock())
{
// Use release MO to synchronize with observers of the ready state.
state->_M_status._M_store_notify_all(_Status::__ready,
memory_order_release);
}
}
 
// defined in src/c++11/condition_variable.cc
extern void
__at_thread_exit(__at_thread_exit_elt* elt);
 
void
__future_base::_State_baseV2::_Make_ready::_M_set()
{
_M_cb = &_Make_ready::_S_run;
__at_thread_exit(this);
}
#endif
 
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/hash_c++0x.cc
0,0 → 1,57
// std::hash definitions -*- C++ -*-
 
// Copyright (C) 2010-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
#if __cplusplus < 201103L
# error "hash_c++0x.cc must be compiled with -std=gnu++0x"
#endif
 
#include <type_traits>
#include <bits/functional_hash.h>
 
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_PURE size_t
hash<long double>::operator()(long double __val) const noexcept
{
// 0 and -0 both hash to zero.
if (__val == 0.0L)
return 0;
 
int __exponent;
__val = __builtin_frexpl(__val, &__exponent);
__val = __val < 0.0l ? -(__val + 0.5l) : __val;
 
const long double __mult = __SIZE_MAX__ + 1.0l;
__val *= __mult;
 
// Try to use all the bits of the mantissa (really necessary only
// on 32-bit targets, at least for 80-bit floating point formats).
const size_t __hibits = (size_t)__val;
__val = (__val - (long double)__hibits) * __mult;
 
const size_t __coeff = __SIZE_MAX__ / __LDBL_MAX_EXP__;
 
return __hibits + (size_t)__val + __coeff * __exponent;
}
}
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/hashtable_c++0x.cc
0,0 → 1,99
// std::__detail definitions -*- C++ -*-
 
// Copyright (C) 2007-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
#if __cplusplus < 201103L
# error "hashtable_c++0x.cc must be compiled with -std=gnu++0x"
#endif
 
#include <initializer_list>
#include <tuple>
#include <ext/aligned_buffer.h>
#include <ext/alloc_traits.h>
#include <bits/hashtable_policy.h>
 
namespace std _GLIBCXX_VISIBILITY(default)
{
#include "../shared/hashtable-aux.cc"
 
namespace __detail
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
// Return a prime no smaller than n.
std::size_t
_Prime_rehash_policy::_M_next_bkt(std::size_t __n) const
{
// Optimize lookups involving the first elements of __prime_list.
// (useful to speed-up, eg, constructors)
static const unsigned char __fast_bkt[12]
= { 2, 2, 2, 3, 5, 5, 7, 7, 11, 11, 11, 11 };
 
if (__n <= 11)
{
_M_next_resize =
__builtin_ceil(__fast_bkt[__n] * (long double)_M_max_load_factor);
return __fast_bkt[__n];
}
 
const unsigned long* __next_bkt =
std::lower_bound(__prime_list + 5, __prime_list + _S_n_primes, __n);
_M_next_resize =
__builtin_ceil(*__next_bkt * (long double)_M_max_load_factor);
return *__next_bkt;
}
 
// Finds the smallest prime p such that alpha p > __n_elt + __n_ins.
// If p > __n_bkt, return make_pair(true, p); otherwise return
// make_pair(false, 0). In principle this isn't very different from
// _M_bkt_for_elements.
 
// The only tricky part is that we're caching the element count at
// which we need to rehash, so we don't have to do a floating-point
// multiply for every insertion.
 
std::pair<bool, std::size_t>
_Prime_rehash_policy::
_M_need_rehash(std::size_t __n_bkt, std::size_t __n_elt,
std::size_t __n_ins) const
{
if (__n_elt + __n_ins >= _M_next_resize)
{
long double __min_bkts = (__n_elt + __n_ins)
/ (long double)_M_max_load_factor;
if (__min_bkts >= __n_bkt)
return std::make_pair(true,
_M_next_bkt(std::max<std::size_t>(__builtin_floor(__min_bkts) + 1,
__n_bkt * _S_growth_factor)));
 
_M_next_resize
= __builtin_floor(__n_bkt * (long double)_M_max_load_factor);
return std::make_pair(false, 0);
}
else
return std::make_pair(false, 0);
}
 
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace __detail
} // namespace std
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/ios-inst.cc
0,0 → 1,42
// Explicit instantiation file.
 
// Copyright (C) 1997-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
//
// ISO C++ 14882:
//
 
#include <ios>
 
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
template class basic_ios<char>;
 
#ifdef _GLIBCXX_USE_WCHAR_T
template class basic_ios<wchar_t>;
#endif
 
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/ios.cc
0,0 → 1,259
// Iostreams base classes -*- C++ -*-
 
// Copyright (C) 1997-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
//
// ISO C++ 14882: 27.4 Iostreams base classes
//
 
#include <ios>
#include <limits>
 
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
// Definitions for static const members of ios_base.
const ios_base::fmtflags ios_base::boolalpha;
const ios_base::fmtflags ios_base::dec;
const ios_base::fmtflags ios_base::fixed;
const ios_base::fmtflags ios_base::hex;
const ios_base::fmtflags ios_base::internal;
const ios_base::fmtflags ios_base::left;
const ios_base::fmtflags ios_base::oct;
const ios_base::fmtflags ios_base::right;
const ios_base::fmtflags ios_base::scientific;
const ios_base::fmtflags ios_base::showbase;
const ios_base::fmtflags ios_base::showpoint;
const ios_base::fmtflags ios_base::showpos;
const ios_base::fmtflags ios_base::skipws;
const ios_base::fmtflags ios_base::unitbuf;
const ios_base::fmtflags ios_base::uppercase;
const ios_base::fmtflags ios_base::adjustfield;
const ios_base::fmtflags ios_base::basefield;
const ios_base::fmtflags ios_base::floatfield;
 
const ios_base::iostate ios_base::badbit;
const ios_base::iostate ios_base::eofbit;
const ios_base::iostate ios_base::failbit;
const ios_base::iostate ios_base::goodbit;
 
const ios_base::openmode ios_base::app;
const ios_base::openmode ios_base::ate;
const ios_base::openmode ios_base::binary;
const ios_base::openmode ios_base::in;
const ios_base::openmode ios_base::out;
const ios_base::openmode ios_base::trunc;
 
const ios_base::seekdir ios_base::beg;
const ios_base::seekdir ios_base::cur;
const ios_base::seekdir ios_base::end;
 
_Atomic_word ios_base::Init::_S_refcount;
 
bool ios_base::Init::_S_synced_with_stdio = true;
 
ios_base::ios_base() throw()
: _M_precision(), _M_width(), _M_flags(), _M_exception(),
_M_streambuf_state(), _M_callbacks(0), _M_word_zero(),
_M_word_size(_S_local_word_size), _M_word(_M_local_word), _M_ios_locale()
{
// Do nothing: basic_ios::init() does it.
// NB: _M_callbacks and _M_word must be zero for non-initialized
// ios_base to go through ~ios_base gracefully.
}
// 27.4.2.7 ios_base constructors/destructors
ios_base::~ios_base()
{
_M_call_callbacks(erase_event);
_M_dispose_callbacks();
if (_M_word != _M_local_word)
{
delete [] _M_word;
_M_word = 0;
}
}
 
// 27.4.2.5 ios_base storage functions
int
ios_base::xalloc() throw()
{
// Implementation note: Initialize top to zero to ensure that
// initialization occurs before main() is started.
static _Atomic_word _S_top = 0;
return __gnu_cxx::__exchange_and_add_dispatch(&_S_top, 1) + 4;
}
 
void
ios_base::register_callback(event_callback __fn, int __index)
{ _M_callbacks = new _Callback_list(__fn, __index, _M_callbacks); }
 
// 27.4.2.5 iword/pword storage
ios_base::_Words&
ios_base::_M_grow_words(int __ix, bool __iword)
{
// Precondition: _M_word_size <= __ix
int __newsize = _S_local_word_size;
_Words* __words = _M_local_word;
if (__ix > _S_local_word_size - 1)
{
if (__ix < numeric_limits<int>::max())
{
__newsize = __ix + 1;
__try
{ __words = new _Words[__newsize]; }
__catch(const std::bad_alloc&)
{
_M_streambuf_state |= badbit;
if (_M_streambuf_state & _M_exception)
__throw_ios_failure(__N("ios_base::_M_grow_words "
"allocation failed"));
if (__iword)
_M_word_zero._M_iword = 0;
else
_M_word_zero._M_pword = 0;
return _M_word_zero;
}
for (int __i = 0; __i < _M_word_size; __i++)
__words[__i] = _M_word[__i];
if (_M_word && _M_word != _M_local_word)
{
delete [] _M_word;
_M_word = 0;
}
}
else
{
_M_streambuf_state |= badbit;
if (_M_streambuf_state & _M_exception)
__throw_ios_failure(__N("ios_base::_M_grow_words is not valid"));
if (__iword)
_M_word_zero._M_iword = 0;
else
_M_word_zero._M_pword = 0;
return _M_word_zero;
}
}
_M_word = __words;
_M_word_size = __newsize;
return _M_word[__ix];
}
 
void
ios_base::_M_call_callbacks(event __e) throw()
{
_Callback_list* __p = _M_callbacks;
while (__p)
{
__try
{ (*__p->_M_fn) (__e, *this, __p->_M_index); }
__catch(...)
{ }
__p = __p->_M_next;
}
}
 
void
ios_base::_M_dispose_callbacks(void) throw()
{
_Callback_list* __p = _M_callbacks;
while (__p && __p->_M_remove_reference() == 0)
{
_Callback_list* __next = __p->_M_next;
delete __p;
__p = __next;
}
_M_callbacks = 0;
}
 
void
ios_base::_M_move(ios_base& __rhs) noexcept
{
_M_precision = __rhs._M_precision;
_M_width = __rhs._M_width;
_M_flags = __rhs._M_flags;
_M_exception = __rhs._M_exception;
_M_streambuf_state = __rhs._M_streambuf_state;
_M_callbacks = std::__exchange(__rhs._M_callbacks, nullptr);
if (_M_word != _M_local_word)
delete[] _M_word;
if (__rhs._M_word == __rhs._M_local_word)
{
_M_word = _M_local_word;
_M_word_size = _S_local_word_size;
for (int __i = 0; __i < _S_local_word_size; __i++)
_M_word[__i] = std::__exchange(__rhs._M_word[__i], {});
}
else
{
_M_word = std::__exchange(__rhs._M_word, __rhs._M_local_word);
_M_word_size
= std::__exchange(__rhs._M_word_size, _S_local_word_size);
}
_M_ios_locale = __rhs._M_ios_locale;
}
 
void
ios_base::_M_swap(ios_base& __rhs) noexcept
{
std::swap(_M_precision, __rhs._M_precision);
std::swap(_M_width, __rhs._M_width);
std::swap(_M_flags, __rhs._M_flags);
std::swap(_M_exception, __rhs._M_exception);
std::swap(_M_streambuf_state, __rhs._M_streambuf_state);
std::swap(_M_callbacks, __rhs._M_callbacks);
const bool __lhs_local = _M_word == _M_local_word;
const bool __rhs_local = __rhs._M_word == __rhs._M_local_word;
if (__lhs_local && __rhs_local)
std::swap(_M_local_word, __rhs._M_local_word); // array swap
else
{
if (!__lhs_local && !__rhs_local)
std::swap(_M_word, __rhs._M_word);
else
{
ios_base* __local;
ios_base* __allocated;
if (__lhs_local)
{
__local = this;
__allocated = &__rhs;
}
else
{
__local = &__rhs;
__allocated= this;
}
for (int __i = 0; __i < _S_local_word_size; __i++)
__allocated->_M_local_word[__i] = __local->_M_local_word[__i];
__local->_M_word = __allocated->_M_word;
__allocated->_M_word = __allocated->_M_local_word;
}
std::swap(_M_word_size, __rhs._M_word_size);
}
std::swap(_M_ios_locale, __rhs._M_ios_locale);
}
 
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/iostream-inst.cc
0,0 → 1,47
// Explicit instantiation file.
 
// Copyright (C) 1997-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
//
// ISO C++ 14882:
//
 
#include <iomanip>
#include <istream>
 
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
template class _Setfill<char>;
template _Setfill<char> setfill(char);
template class basic_iostream<char>;
 
#ifdef _GLIBCXX_USE_WCHAR_T
template class _Setfill<wchar_t>;
template _Setfill<wchar_t> setfill(wchar_t);
template class basic_iostream<wchar_t>;
#endif
 
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/istream-inst.cc
0,0 → 1,114
// Explicit instantiation file.
 
// Copyright (C) 1997-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
//
// ISO C++ 14882:
//
 
#include <istream>
#include <iomanip>
 
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
template class basic_istream<char>;
template istream& ws(istream&);
template istream& operator>>(istream&, char&);
template istream& operator>>(istream&, unsigned char&);
template istream& operator>>(istream&, signed char&);
template istream& operator>>(istream&, char*);
template istream& operator>>(istream&, unsigned char*);
template istream& operator>>(istream&, signed char*);
 
template istream& operator>>(istream&, _Setfill<char>);
template istream& operator>>(istream&, _Setiosflags);
template istream& operator>>(istream&, _Resetiosflags);
template istream& operator>>(istream&, _Setbase);
template istream& operator>>(istream&, _Setprecision);
template istream& operator>>(istream&, _Setw);
 
template istream& istream::_M_extract(unsigned short&);
template istream& istream::_M_extract(unsigned int&);
template istream& istream::_M_extract(long&);
template istream& istream::_M_extract(unsigned long&);
template istream& istream::_M_extract(bool&);
#ifdef _GLIBCXX_USE_LONG_LONG
template istream& istream::_M_extract(long long&);
template istream& istream::_M_extract(unsigned long long&);
#endif
template istream& istream::_M_extract(float&);
template istream& istream::_M_extract(double&);
template istream& istream::_M_extract(long double&);
template istream& istream::_M_extract(void*&);
 
#ifdef _GLIBCXX_USE_WCHAR_T
template class basic_istream<wchar_t>;
template wistream& ws(wistream&);
template wistream& operator>>(wistream&, wchar_t&);
template wistream& operator>>(wistream&, wchar_t*);
 
template wistream& operator>>(wistream&, _Setfill<wchar_t>);
template wistream& operator>>(wistream&, _Setiosflags);
template wistream& operator>>(wistream&, _Resetiosflags);
template wistream& operator>>(wistream&, _Setbase);
template wistream& operator>>(wistream&, _Setprecision);
template wistream& operator>>(wistream&, _Setw);
 
template wistream& wistream::_M_extract(unsigned short&);
template wistream& wistream::_M_extract(unsigned int&);
template wistream& wistream::_M_extract(long&);
template wistream& wistream::_M_extract(unsigned long&);
template wistream& wistream::_M_extract(bool&);
#ifdef _GLIBCXX_USE_LONG_LONG
template wistream& wistream::_M_extract(long long&);
template wistream& wistream::_M_extract(unsigned long long&);
#endif
template wistream& wistream::_M_extract(float&);
template wistream& wistream::_M_extract(double&);
template wistream& wistream::_M_extract(long double&);
template wistream& wistream::_M_extract(void*&);
#endif
 
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
 
// XXX GLIBCXX_ABI Deprecated
#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
 
#define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \
extern "C" void ldbl (void) __attribute__ ((alias (#dbl), weak))
_GLIBCXX_LDBL_COMPAT (_ZNSirsERd, _ZNSirsERe);
#ifdef _GLIBCXX_USE_WCHAR_T
_GLIBCXX_LDBL_COMPAT (_ZNSt13basic_istreamIwSt11char_traitsIwEErsERd,
_ZNSt13basic_istreamIwSt11char_traitsIwEErsERe);
#endif
_GLIBCXX_LDBL_COMPAT (_ZNSi10_M_extractIdEERSiRT_,
_ZNSi10_M_extractIeEERSiRT_);
#ifdef _GLIBCXX_USE_WCHAR_T
_GLIBCXX_LDBL_COMPAT (_ZNSt13basic_istreamIwSt11char_traitsIwEE10_M_extractIdEERS2_RT_,
_ZNSt13basic_istreamIwSt11char_traitsIwEE10_M_extractIeEERS2_RT_);
#endif
 
#endif // _GLIBCXX_LONG_DOUBLE_COMPAT
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/limits.cc
0,0 → 1,612
// Static data members of -*- C++ -*- numeric_limits classes
 
// Copyright (C) 1999-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@cmla.ens-cachan.fr>
 
//
// ISO C++ 14882:1998
// 18.2.1
//
 
#include <limits>
 
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
#define const _GLIBCXX_USE_CONSTEXPR
 
const bool __numeric_limits_base::is_specialized;
const int __numeric_limits_base::digits;
const int __numeric_limits_base::digits10;
const int __numeric_limits_base::max_digits10;
const bool __numeric_limits_base::is_signed;
const bool __numeric_limits_base::is_integer;
const bool __numeric_limits_base::is_exact;
const int __numeric_limits_base::radix;
const int __numeric_limits_base::min_exponent;
const int __numeric_limits_base::min_exponent10;
const int __numeric_limits_base::max_exponent;
const int __numeric_limits_base::max_exponent10;
const bool __numeric_limits_base::has_infinity;
const bool __numeric_limits_base::has_quiet_NaN;
const bool __numeric_limits_base::has_signaling_NaN;
const float_denorm_style __numeric_limits_base::has_denorm;
const bool __numeric_limits_base::has_denorm_loss;
const bool __numeric_limits_base::is_iec559;
const bool __numeric_limits_base::is_bounded;
const bool __numeric_limits_base::is_modulo;
const bool __numeric_limits_base::traps;
const bool __numeric_limits_base::tinyness_before;
const float_round_style __numeric_limits_base::round_style;
 
// bool
const bool numeric_limits<bool>::is_specialized;
const int numeric_limits<bool>::digits;
const int numeric_limits<bool>::digits10;
const int numeric_limits<bool>::max_digits10;
const bool numeric_limits<bool>::is_signed;
const bool numeric_limits<bool>::is_integer;
const bool numeric_limits<bool>::is_exact;
const int numeric_limits<bool>::radix;
const int numeric_limits<bool>::min_exponent;
const int numeric_limits<bool>::min_exponent10;
const int numeric_limits<bool>::max_exponent;
const int numeric_limits<bool>::max_exponent10;
const bool numeric_limits<bool>::has_infinity;
const bool numeric_limits<bool>::has_quiet_NaN;
const bool numeric_limits<bool>::has_signaling_NaN;
const float_denorm_style numeric_limits<bool>::has_denorm;
const bool numeric_limits<bool>::has_denorm_loss;
const bool numeric_limits<bool>::is_iec559;
const bool numeric_limits<bool>::is_bounded;
const bool numeric_limits<bool>::is_modulo;
const bool numeric_limits<bool>::traps;
const bool numeric_limits<bool>::tinyness_before;
const float_round_style numeric_limits<bool>::round_style;
 
// char
const bool numeric_limits<char>::is_specialized;
const int numeric_limits<char>::digits;
const int numeric_limits<char>::digits10;
const int numeric_limits<char>::max_digits10;
const bool numeric_limits<char>::is_signed;
const bool numeric_limits<char>::is_integer;
const bool numeric_limits<char>::is_exact;
const int numeric_limits<char>::radix;
const int numeric_limits<char>::min_exponent;
const int numeric_limits<char>::min_exponent10;
const int numeric_limits<char>::max_exponent;
const int numeric_limits<char>::max_exponent10;
const bool numeric_limits<char>::has_infinity;
const bool numeric_limits<char>::has_quiet_NaN;
const bool numeric_limits<char>::has_signaling_NaN;
const float_denorm_style numeric_limits<char>::has_denorm;
const bool numeric_limits<char>::has_denorm_loss;
const bool numeric_limits<char>::is_iec559;
const bool numeric_limits<char>::is_bounded;
const bool numeric_limits<char>::is_modulo;
const bool numeric_limits<char>::traps;
const bool numeric_limits<char>::tinyness_before;
const float_round_style numeric_limits<char>::round_style;
 
// signed char
const bool numeric_limits<signed char>::is_specialized;
const int numeric_limits<signed char>::digits;
const int numeric_limits<signed char>::digits10;
const int numeric_limits<signed char>::max_digits10;
const bool numeric_limits<signed char>::is_signed;
const bool numeric_limits<signed char>::is_integer;
const bool numeric_limits<signed char>::is_exact;
const int numeric_limits<signed char>::radix;
const int numeric_limits<signed char>::min_exponent;
const int numeric_limits<signed char>::min_exponent10;
const int numeric_limits<signed char>::max_exponent;
const int numeric_limits<signed char>::max_exponent10;
const bool numeric_limits<signed char>::has_infinity;
const bool numeric_limits<signed char>::has_quiet_NaN;
const bool numeric_limits<signed char>::has_signaling_NaN;
const float_denorm_style numeric_limits<signed char>::has_denorm;
const bool numeric_limits<signed char>::has_denorm_loss;
const bool numeric_limits<signed char>::is_iec559;
const bool numeric_limits<signed char>::is_bounded;
const bool numeric_limits<signed char>::is_modulo;
const bool numeric_limits<signed char>::traps;
const bool numeric_limits<signed char>::tinyness_before;
const float_round_style numeric_limits<signed char>::round_style;
 
// unsigned char
const bool numeric_limits<unsigned char>::is_specialized;
const int numeric_limits<unsigned char>::digits;
const int numeric_limits<unsigned char>::digits10;
const int numeric_limits<unsigned char>::max_digits10;
const bool numeric_limits<unsigned char>::is_signed;
const bool numeric_limits<unsigned char>::is_integer;
const bool numeric_limits<unsigned char>::is_exact;
const int numeric_limits<unsigned char>::radix;
const int numeric_limits<unsigned char>::min_exponent;
const int numeric_limits<unsigned char>::min_exponent10;
const int numeric_limits<unsigned char>::max_exponent;
const int numeric_limits<unsigned char>::max_exponent10;
const bool numeric_limits<unsigned char>::has_infinity;
const bool numeric_limits<unsigned char>::has_quiet_NaN;
const bool numeric_limits<unsigned char>::has_signaling_NaN;
const float_denorm_style numeric_limits<unsigned char>::has_denorm;
const bool numeric_limits<unsigned char>::has_denorm_loss;
const bool numeric_limits<unsigned char>::is_iec559;
const bool numeric_limits<unsigned char>::is_bounded;
const bool numeric_limits<unsigned char>::is_modulo;
const bool numeric_limits<unsigned char>::traps;
const bool numeric_limits<unsigned char>::tinyness_before;
const float_round_style numeric_limits<unsigned char>::round_style;
 
// wchar_t
// This used to be problematic...
#ifdef _GLIBCXX_USE_WCHAR_T
const bool numeric_limits<wchar_t>::is_specialized;
const int numeric_limits<wchar_t>::digits;
const int numeric_limits<wchar_t>::digits10;
const int numeric_limits<wchar_t>::max_digits10;
const bool numeric_limits<wchar_t>::is_signed;
const bool numeric_limits<wchar_t>::is_integer;
const bool numeric_limits<wchar_t>::is_exact;
const int numeric_limits<wchar_t>::radix;
const int numeric_limits<wchar_t>::min_exponent;
const int numeric_limits<wchar_t>::min_exponent10;
const int numeric_limits<wchar_t>::max_exponent;
const int numeric_limits<wchar_t>::max_exponent10;
const bool numeric_limits<wchar_t>::has_infinity;
const bool numeric_limits<wchar_t>::has_quiet_NaN;
const bool numeric_limits<wchar_t>::has_signaling_NaN;
const float_denorm_style numeric_limits<wchar_t>::has_denorm;
const bool numeric_limits<wchar_t>::has_denorm_loss;
const bool numeric_limits<wchar_t>::is_iec559;
const bool numeric_limits<wchar_t>::is_bounded;
const bool numeric_limits<wchar_t>::is_modulo;
const bool numeric_limits<wchar_t>::traps;
const bool numeric_limits<wchar_t>::tinyness_before;
const float_round_style numeric_limits<wchar_t>::round_style;
#endif // _GLIBCXX_USE_WCHAR_T
 
// short
const bool numeric_limits<short>::is_specialized;
const int numeric_limits<short>::digits;
const int numeric_limits<short>::digits10;
const int numeric_limits<short>::max_digits10;
const bool numeric_limits<short>::is_signed;
const bool numeric_limits<short>::is_integer;
const bool numeric_limits<short>::is_exact;
const int numeric_limits<short>::radix;
const int numeric_limits<short>::min_exponent;
const int numeric_limits<short>::min_exponent10;
const int numeric_limits<short>::max_exponent;
const int numeric_limits<short>::max_exponent10;
const bool numeric_limits<short>::has_infinity;
const bool numeric_limits<short>::has_quiet_NaN;
const bool numeric_limits<short>::has_signaling_NaN;
const float_denorm_style numeric_limits<short>::has_denorm;
const bool numeric_limits<short>::has_denorm_loss;
const bool numeric_limits<short>::is_iec559;
const bool numeric_limits<short>::is_bounded;
const bool numeric_limits<short>::is_modulo;
const bool numeric_limits<short>::traps;
const bool numeric_limits<short>::tinyness_before;
const float_round_style numeric_limits<short>::round_style;
 
// unsigned short
const bool numeric_limits<unsigned short>::is_specialized;
const int numeric_limits<unsigned short>::digits;
const int numeric_limits<unsigned short>::digits10;
const int numeric_limits<unsigned short>::max_digits10;
const bool numeric_limits<unsigned short>::is_signed;
const bool numeric_limits<unsigned short>::is_integer;
const bool numeric_limits<unsigned short>::is_exact;
const int numeric_limits<unsigned short>::radix;
const int numeric_limits<unsigned short>::min_exponent;
const int numeric_limits<unsigned short>::min_exponent10;
const int numeric_limits<unsigned short>::max_exponent;
const int numeric_limits<unsigned short>::max_exponent10;
const bool numeric_limits<unsigned short>::has_infinity;
const bool numeric_limits<unsigned short>::has_quiet_NaN;
const bool numeric_limits<unsigned short>::has_signaling_NaN;
const float_denorm_style numeric_limits<unsigned short>::has_denorm;
const bool numeric_limits<unsigned short>::has_denorm_loss;
const bool numeric_limits<unsigned short>::is_iec559;
const bool numeric_limits<unsigned short>::is_bounded;
const bool numeric_limits<unsigned short>::is_modulo;
const bool numeric_limits<unsigned short>::traps;
const bool numeric_limits<unsigned short>::tinyness_before;
const float_round_style numeric_limits<unsigned short>::round_style;
 
// int
const bool numeric_limits<int>::is_specialized;
const int numeric_limits<int>::digits;
const int numeric_limits<int>::digits10;
const int numeric_limits<int>::max_digits10;
const bool numeric_limits<int>::is_signed;
const bool numeric_limits<int>::is_integer;
const bool numeric_limits<int>::is_exact;
const int numeric_limits<int>::radix;
const int numeric_limits<int>::min_exponent;
const int numeric_limits<int>::min_exponent10;
const int numeric_limits<int>::max_exponent;
const int numeric_limits<int>::max_exponent10;
const bool numeric_limits<int>::has_infinity;
const bool numeric_limits<int>::has_quiet_NaN;
const bool numeric_limits<int>::has_signaling_NaN;
const float_denorm_style numeric_limits<int>::has_denorm;
const bool numeric_limits<int>::has_denorm_loss;
const bool numeric_limits<int>::is_iec559;
const bool numeric_limits<int>::is_bounded;
const bool numeric_limits<int>::is_modulo;
const bool numeric_limits<int>::traps;
const bool numeric_limits<int>::tinyness_before;
const float_round_style numeric_limits<int>::round_style;
 
// unsigned int
const bool numeric_limits<unsigned int>::is_specialized;
const int numeric_limits<unsigned int>::digits;
const int numeric_limits<unsigned int>::digits10;
const int numeric_limits<unsigned int>::max_digits10;
const bool numeric_limits<unsigned int>::is_signed;
const bool numeric_limits<unsigned int>::is_integer;
const bool numeric_limits<unsigned int>::is_exact;
const int numeric_limits<unsigned int>::radix;
const int numeric_limits<unsigned int>::min_exponent;
const int numeric_limits<unsigned int>::min_exponent10;
const int numeric_limits<unsigned int>::max_exponent;
const int numeric_limits<unsigned int>::max_exponent10;
const bool numeric_limits<unsigned int>::has_infinity;
const bool numeric_limits<unsigned int>::has_quiet_NaN;
const bool numeric_limits<unsigned int>::has_signaling_NaN;
const float_denorm_style numeric_limits<unsigned int>::has_denorm;
const bool numeric_limits<unsigned int>::has_denorm_loss;
const bool numeric_limits<unsigned int>::is_iec559;
const bool numeric_limits<unsigned int>::is_bounded;
const bool numeric_limits<unsigned int>::is_modulo;
const bool numeric_limits<unsigned int>::traps;
const bool numeric_limits<unsigned int>::tinyness_before;
const float_round_style numeric_limits<unsigned int>::round_style;
 
// long
const bool numeric_limits<long>::is_specialized;
const int numeric_limits<long>::digits;
const int numeric_limits<long>::digits10;
const int numeric_limits<long>::max_digits10;
const bool numeric_limits<long>::is_signed;
const bool numeric_limits<long>::is_integer;
const bool numeric_limits<long>::is_exact;
const int numeric_limits<long>::radix;
const int numeric_limits<long>::min_exponent;
const int numeric_limits<long>::min_exponent10;
const int numeric_limits<long>::max_exponent;
const int numeric_limits<long>::max_exponent10;
const bool numeric_limits<long>::has_infinity;
const bool numeric_limits<long>::has_quiet_NaN;
const bool numeric_limits<long>::has_signaling_NaN;
const float_denorm_style numeric_limits<long>::has_denorm;
const bool numeric_limits<long>::has_denorm_loss;
const bool numeric_limits<long>::is_iec559;
const bool numeric_limits<long>::is_bounded;
const bool numeric_limits<long>::is_modulo;
const bool numeric_limits<long>::traps;
const bool numeric_limits<long>::tinyness_before;
const float_round_style numeric_limits<long>::round_style;
 
// unsigned long
const bool numeric_limits<unsigned long>::is_specialized;
const int numeric_limits<unsigned long>::digits;
const int numeric_limits<unsigned long>::digits10;
const int numeric_limits<unsigned long>::max_digits10;
const bool numeric_limits<unsigned long>::is_signed;
const bool numeric_limits<unsigned long>::is_integer;
const bool numeric_limits<unsigned long>::is_exact;
const int numeric_limits<unsigned long>::radix;
const int numeric_limits<unsigned long>::min_exponent;
const int numeric_limits<unsigned long>::min_exponent10;
const int numeric_limits<unsigned long>::max_exponent;
const int numeric_limits<unsigned long>::max_exponent10;
const bool numeric_limits<unsigned long>::has_infinity;
const bool numeric_limits<unsigned long>::has_quiet_NaN;
const bool numeric_limits<unsigned long>::has_signaling_NaN;
const float_denorm_style numeric_limits<unsigned long>::has_denorm;
const bool numeric_limits<unsigned long>::has_denorm_loss;
const bool numeric_limits<unsigned long>::is_iec559;
const bool numeric_limits<unsigned long>::is_bounded;
const bool numeric_limits<unsigned long>::is_modulo;
const bool numeric_limits<unsigned long>::traps;
const bool numeric_limits<unsigned long>::tinyness_before;
const float_round_style numeric_limits<unsigned long>::round_style;
 
// NOTA BENE: long long is an extension
const bool numeric_limits<long long>::is_specialized;
const int numeric_limits<long long>::digits;
const int numeric_limits<long long>::digits10;
const int numeric_limits<long long>::max_digits10;
const bool numeric_limits<long long>::is_signed;
const bool numeric_limits<long long>::is_integer;
const bool numeric_limits<long long>::is_exact;
const int numeric_limits<long long>::radix;
const int numeric_limits<long long>::min_exponent;
const int numeric_limits<long long>::min_exponent10;
const int numeric_limits<long long>::max_exponent;
const int numeric_limits<long long>::max_exponent10;
const bool numeric_limits<long long>::has_infinity;
const bool numeric_limits<long long>::has_quiet_NaN;
const bool numeric_limits<long long>::has_signaling_NaN;
const float_denorm_style numeric_limits<long long>::has_denorm;
const bool numeric_limits<long long>::has_denorm_loss;
const bool numeric_limits<long long>::is_iec559;
const bool numeric_limits<long long>::is_bounded;
const bool numeric_limits<long long>::is_modulo;
const bool numeric_limits<long long>::traps;
const bool numeric_limits<long long>::tinyness_before;
const float_round_style numeric_limits<long long>::round_style;
 
const bool numeric_limits<unsigned long long>::is_specialized;
const int numeric_limits<unsigned long long>::digits;
const int numeric_limits<unsigned long long>::digits10;
const int numeric_limits<unsigned long long>::max_digits10;
const bool numeric_limits<unsigned long long>::is_signed;
const bool numeric_limits<unsigned long long>::is_integer;
const bool numeric_limits<unsigned long long>::is_exact;
const int numeric_limits<unsigned long long>::radix;
const int numeric_limits<unsigned long long>::min_exponent;
const int numeric_limits<unsigned long long>::min_exponent10;
const int numeric_limits<unsigned long long>::max_exponent;
const int numeric_limits<unsigned long long>::max_exponent10;
const bool numeric_limits<unsigned long long>::has_infinity;
const bool numeric_limits<unsigned long long>::has_quiet_NaN;
const bool numeric_limits<unsigned long long>::has_signaling_NaN;
const float_denorm_style numeric_limits<unsigned long long>::has_denorm;
const bool numeric_limits<unsigned long long>::has_denorm_loss;
const bool numeric_limits<unsigned long long>::is_iec559;
const bool numeric_limits<unsigned long long>::is_bounded;
const bool numeric_limits<unsigned long long>::is_modulo;
const bool numeric_limits<unsigned long long>::traps;
const bool numeric_limits<unsigned long long>::tinyness_before;
const float_round_style numeric_limits<unsigned long long>::round_style;
 
#define INT_N(__INT_N_TYPE) \
const bool numeric_limits<__INT_N_TYPE>::is_specialized; \
const int numeric_limits<__INT_N_TYPE>::digits; \
const int numeric_limits<__INT_N_TYPE>::digits10; \
const int numeric_limits<__INT_N_TYPE>::max_digits10; \
const bool numeric_limits<__INT_N_TYPE>::is_signed; \
const bool numeric_limits<__INT_N_TYPE>::is_integer; \
const bool numeric_limits<__INT_N_TYPE>::is_exact; \
const int numeric_limits<__INT_N_TYPE>::radix; \
const int numeric_limits<__INT_N_TYPE>::min_exponent; \
const int numeric_limits<__INT_N_TYPE>::min_exponent10; \
const int numeric_limits<__INT_N_TYPE>::max_exponent; \
const int numeric_limits<__INT_N_TYPE>::max_exponent10; \
const bool numeric_limits<__INT_N_TYPE>::has_infinity; \
const bool numeric_limits<__INT_N_TYPE>::has_quiet_NaN; \
const bool numeric_limits<__INT_N_TYPE>::has_signaling_NaN; \
const float_denorm_style numeric_limits<__INT_N_TYPE>::has_denorm; \
const bool numeric_limits<__INT_N_TYPE>::has_denorm_loss; \
const bool numeric_limits<__INT_N_TYPE>::is_iec559; \
const bool numeric_limits<__INT_N_TYPE>::is_bounded; \
const bool numeric_limits<__INT_N_TYPE>::is_modulo; \
const bool numeric_limits<__INT_N_TYPE>::traps; \
const bool numeric_limits<__INT_N_TYPE>::tinyness_before; \
const float_round_style numeric_limits<__INT_N_TYPE>::round_style; \
\
const bool numeric_limits<unsigned __INT_N_TYPE>::is_specialized; \
const int numeric_limits<unsigned __INT_N_TYPE>::digits; \
const int numeric_limits<unsigned __INT_N_TYPE>::digits10; \
const int numeric_limits<unsigned __INT_N_TYPE>::max_digits10; \
const bool numeric_limits<unsigned __INT_N_TYPE>::is_signed; \
const bool numeric_limits<unsigned __INT_N_TYPE>::is_integer; \
const bool numeric_limits<unsigned __INT_N_TYPE>::is_exact; \
const int numeric_limits<unsigned __INT_N_TYPE>::radix; \
const int numeric_limits<unsigned __INT_N_TYPE>::min_exponent; \
const int numeric_limits<unsigned __INT_N_TYPE>::min_exponent10; \
const int numeric_limits<unsigned __INT_N_TYPE>::max_exponent; \
const int numeric_limits<unsigned __INT_N_TYPE>::max_exponent10; \
const bool numeric_limits<unsigned __INT_N_TYPE>::has_infinity; \
const bool numeric_limits<unsigned __INT_N_TYPE>::has_quiet_NaN; \
const bool numeric_limits<unsigned __INT_N_TYPE>::has_signaling_NaN; \
const float_denorm_style numeric_limits<unsigned __INT_N_TYPE>::has_denorm; \
const bool numeric_limits<unsigned __INT_N_TYPE>::has_denorm_loss; \
const bool numeric_limits<unsigned __INT_N_TYPE>::is_iec559; \
const bool numeric_limits<unsigned __INT_N_TYPE>::is_bounded; \
const bool numeric_limits<unsigned __INT_N_TYPE>::is_modulo; \
const bool numeric_limits<unsigned __INT_N_TYPE>::traps; \
const bool numeric_limits<unsigned __INT_N_TYPE>::tinyness_before; \
const float_round_style numeric_limits<unsigned __INT_N_TYPE>::round_style;
 
#ifdef __GLIBCXX_TYPE_INT_N_0
INT_N (__GLIBCXX_TYPE_INT_N_0)
#endif
#ifdef __GLIBCXX_TYPE_INT_N_1
INT_N (__GLIBCXX_TYPE_INT_N_1)
#endif
#ifdef __GLIBCXX_TYPE_INT_N_2
INT_N (__GLIBCXX_TYPE_INT_N_2)
#endif
#ifdef __GLIBCXX_TYPE_INT_N_3
INT_N (__GLIBCXX_TYPE_INT_N_3)
#endif
 
// float
const bool numeric_limits<float>::is_specialized;
const int numeric_limits<float>::digits;
const int numeric_limits<float>::digits10;
const int numeric_limits<float>::max_digits10;
const bool numeric_limits<float>::is_signed;
const bool numeric_limits<float>::is_integer;
const bool numeric_limits<float>::is_exact;
const int numeric_limits<float>::radix;
const int numeric_limits<float>::min_exponent;
const int numeric_limits<float>::min_exponent10;
const int numeric_limits<float>::max_exponent;
const int numeric_limits<float>::max_exponent10;
const bool numeric_limits<float>::has_infinity;
const bool numeric_limits<float>::has_quiet_NaN;
const bool numeric_limits<float>::has_signaling_NaN;
const float_denorm_style numeric_limits<float>::has_denorm;
const bool numeric_limits<float>::has_denorm_loss;
const bool numeric_limits<float>::is_iec559;
const bool numeric_limits<float>::is_bounded;
const bool numeric_limits<float>::is_modulo;
const bool numeric_limits<float>::traps;
const bool numeric_limits<float>::tinyness_before;
const float_round_style numeric_limits<float>::round_style;
 
// double
const bool numeric_limits<double>::is_specialized;
const int numeric_limits<double>::digits;
const int numeric_limits<double>::digits10;
const int numeric_limits<double>::max_digits10;
const bool numeric_limits<double>::is_signed;
const bool numeric_limits<double>::is_integer;
const bool numeric_limits<double>::is_exact;
const int numeric_limits<double>::radix;
const int numeric_limits<double>::min_exponent;
const int numeric_limits<double>::min_exponent10;
const int numeric_limits<double>::max_exponent;
const int numeric_limits<double>::max_exponent10;
const bool numeric_limits<double>::has_infinity;
const bool numeric_limits<double>::has_quiet_NaN;
const bool numeric_limits<double>::has_signaling_NaN;
const float_denorm_style numeric_limits<double>::has_denorm;
const bool numeric_limits<double>::has_denorm_loss;
const bool numeric_limits<double>::is_iec559;
const bool numeric_limits<double>::is_bounded;
const bool numeric_limits<double>::is_modulo;
const bool numeric_limits<double>::traps;
const bool numeric_limits<double>::tinyness_before;
const float_round_style numeric_limits<double>::round_style;
 
// long double
const bool numeric_limits<long double>::is_specialized;
const int numeric_limits<long double>::digits;
const int numeric_limits<long double>::digits10;
const int numeric_limits<long double>::max_digits10;
const bool numeric_limits<long double>::is_signed;
const bool numeric_limits<long double>::is_integer;
const bool numeric_limits<long double>::is_exact;
const int numeric_limits<long double>::radix;
const int numeric_limits<long double>::min_exponent;
const int numeric_limits<long double>::min_exponent10;
const int numeric_limits<long double>::max_exponent;
const int numeric_limits<long double>::max_exponent10;
const bool numeric_limits<long double>::has_infinity;
const bool numeric_limits<long double>::has_quiet_NaN;
const bool numeric_limits<long double>::has_signaling_NaN;
const float_denorm_style numeric_limits<long double>::has_denorm;
const bool numeric_limits<long double>::has_denorm_loss;
const bool numeric_limits<long double>::is_iec559;
const bool numeric_limits<long double>::is_bounded;
const bool numeric_limits<long double>::is_modulo;
const bool numeric_limits<long double>::traps;
const bool numeric_limits<long double>::tinyness_before;
const float_round_style numeric_limits<long double>::round_style;
 
// char16_t
const bool numeric_limits<char16_t>::is_specialized;
const int numeric_limits<char16_t>::digits;
const int numeric_limits<char16_t>::digits10;
const int numeric_limits<char16_t>::max_digits10;
const bool numeric_limits<char16_t>::is_signed;
const bool numeric_limits<char16_t>::is_integer;
const bool numeric_limits<char16_t>::is_exact;
const int numeric_limits<char16_t>::radix;
const int numeric_limits<char16_t>::min_exponent;
const int numeric_limits<char16_t>::min_exponent10;
const int numeric_limits<char16_t>::max_exponent;
const int numeric_limits<char16_t>::max_exponent10;
const bool numeric_limits<char16_t>::has_infinity;
const bool numeric_limits<char16_t>::has_quiet_NaN;
const bool numeric_limits<char16_t>::has_signaling_NaN;
const float_denorm_style numeric_limits<char16_t>::has_denorm;
const bool numeric_limits<char16_t>::has_denorm_loss;
const bool numeric_limits<char16_t>::is_iec559;
const bool numeric_limits<char16_t>::is_bounded;
const bool numeric_limits<char16_t>::is_modulo;
const bool numeric_limits<char16_t>::traps;
const bool numeric_limits<char16_t>::tinyness_before;
const float_round_style numeric_limits<char16_t>::round_style;
 
// char32_t
const bool numeric_limits<char32_t>::is_specialized;
const int numeric_limits<char32_t>::digits;
const int numeric_limits<char32_t>::digits10;
const int numeric_limits<char32_t>::max_digits10;
const bool numeric_limits<char32_t>::is_signed;
const bool numeric_limits<char32_t>::is_integer;
const bool numeric_limits<char32_t>::is_exact;
const int numeric_limits<char32_t>::radix;
const int numeric_limits<char32_t>::min_exponent;
const int numeric_limits<char32_t>::min_exponent10;
const int numeric_limits<char32_t>::max_exponent;
const int numeric_limits<char32_t>::max_exponent10;
const bool numeric_limits<char32_t>::has_infinity;
const bool numeric_limits<char32_t>::has_quiet_NaN;
const bool numeric_limits<char32_t>::has_signaling_NaN;
const float_denorm_style numeric_limits<char32_t>::has_denorm;
const bool numeric_limits<char32_t>::has_denorm_loss;
const bool numeric_limits<char32_t>::is_iec559;
const bool numeric_limits<char32_t>::is_bounded;
const bool numeric_limits<char32_t>::is_modulo;
const bool numeric_limits<char32_t>::traps;
const bool numeric_limits<char32_t>::tinyness_before;
const float_round_style numeric_limits<char32_t>::round_style;
 
#undef const
 
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
 
// XXX GLIBCXX_ABI Deprecated
#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
 
#define _GLIBCXX_NUM_LIM_COMPAT(type, member, len) \
extern "C" type _ZNSt14numeric_limitsIeE ## len ## member ## E \
__attribute__ ((alias ("_ZNSt14numeric_limitsIdE" #len #member "E")))
_GLIBCXX_NUM_LIM_COMPAT (bool, is_specialized, 14);
_GLIBCXX_NUM_LIM_COMPAT (int, digits, 6);
_GLIBCXX_NUM_LIM_COMPAT (int, digits10, 8);
_GLIBCXX_NUM_LIM_COMPAT (bool, is_signed, 9);
_GLIBCXX_NUM_LIM_COMPAT (bool, is_integer, 10);
_GLIBCXX_NUM_LIM_COMPAT (bool, is_exact, 8);
_GLIBCXX_NUM_LIM_COMPAT (int, radix, 5);
_GLIBCXX_NUM_LIM_COMPAT (int, min_exponent, 12);
_GLIBCXX_NUM_LIM_COMPAT (int, min_exponent10, 14);
_GLIBCXX_NUM_LIM_COMPAT (int, max_exponent, 12);
_GLIBCXX_NUM_LIM_COMPAT (int, max_exponent10, 14);
_GLIBCXX_NUM_LIM_COMPAT (bool, has_infinity, 12);
_GLIBCXX_NUM_LIM_COMPAT (bool, has_quiet_NaN, 13);
_GLIBCXX_NUM_LIM_COMPAT (bool, has_signaling_NaN, 17);
_GLIBCXX_NUM_LIM_COMPAT (std::float_denorm_style, has_denorm, 10);
_GLIBCXX_NUM_LIM_COMPAT (bool, has_denorm_loss, 15);
_GLIBCXX_NUM_LIM_COMPAT (bool, is_iec559, 9);
_GLIBCXX_NUM_LIM_COMPAT (bool, is_bounded, 10);
_GLIBCXX_NUM_LIM_COMPAT (bool, is_modulo, 9);
_GLIBCXX_NUM_LIM_COMPAT (bool, traps, 5);
_GLIBCXX_NUM_LIM_COMPAT (bool, tinyness_before, 15);
_GLIBCXX_NUM_LIM_COMPAT (std::float_round_style, round_style, 11);
 
#endif // _GLIBCXX_LONG_DOUBLE_COMPAT
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/locale-inst.cc
0,0 → 1,422
// Locale support -*- C++ -*-
 
// Copyright (C) 1999-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
//
// ISO C++ 14882: 22.1 Locales
//
 
#ifndef _GLIBCXX_USE_CXX11_ABI
// Instantiations in this file use the old COW std::string ABI unless included
// by another file which defines _GLIBCXX_USE_CXX11_ABI=1. Some instantiations
// are guarded by a check for !_GLIBCXX_USE_CXX11_ABI so that they are only
// instantiated once, because they are not tagged with abi_tag so should not
// be instantiated twice.
# define _GLIBCXX_USE_CXX11_ABI 0
#endif
 
#include <locale>
 
// Instantiation configuration.
#ifndef C
# define C char
# define C_is_char
#endif
 
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
// moneypunct, money_get, and money_put
#if ! _GLIBCXX_USE_CXX11_ABI
template struct __moneypunct_cache<C, false>;
template struct __moneypunct_cache<C, true>;
#endif
_GLIBCXX_BEGIN_NAMESPACE_CXX11
template class moneypunct<C, false>;
template class moneypunct<C, true>;
template class moneypunct_byname<C, false>;
template class moneypunct_byname<C, true>;
_GLIBCXX_END_NAMESPACE_CXX11
_GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11
template class money_get<C, istreambuf_iterator<C> >;
template class money_put<C, ostreambuf_iterator<C> >;
template
istreambuf_iterator<C>
money_get<C, istreambuf_iterator<C> >::
_M_extract<true>(istreambuf_iterator<C>, istreambuf_iterator<C>,
ios_base&, ios_base::iostate&, string&) const;
 
template
istreambuf_iterator<C>
money_get<C, istreambuf_iterator<C> >::
_M_extract<false>(istreambuf_iterator<C>, istreambuf_iterator<C>,
ios_base&, ios_base::iostate&, string&) const;
 
template
ostreambuf_iterator<C>
money_put<C, ostreambuf_iterator<C> >::
_M_insert<true>(ostreambuf_iterator<C>, ios_base&, C,
const string_type&) const;
 
template
ostreambuf_iterator<C>
money_put<C, ostreambuf_iterator<C> >::
_M_insert<false>(ostreambuf_iterator<C>, ios_base&, C,
const string_type&) const;
_GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11
 
// numpunct, numpunct_byname, num_get, and num_put
#if ! _GLIBCXX_USE_CXX11_ABI
template struct __numpunct_cache<C>;
#endif
_GLIBCXX_BEGIN_NAMESPACE_CXX11
template class numpunct<C>;
template class numpunct_byname<C>;
_GLIBCXX_END_NAMESPACE_CXX11
_GLIBCXX_BEGIN_NAMESPACE_LDBL
#if ! _GLIBCXX_USE_CXX11_ABI
template class num_get<C, istreambuf_iterator<C> >;
#endif
 
template
istreambuf_iterator<C>
num_get<C, istreambuf_iterator<C> >::
_M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
ios_base&, ios_base::iostate&,
long&) const;
 
template
istreambuf_iterator<C>
num_get<C, istreambuf_iterator<C> >::
_M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
ios_base&, ios_base::iostate&,
unsigned short&) const;
 
template
istreambuf_iterator<C>
num_get<C, istreambuf_iterator<C> >::
_M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
ios_base&, ios_base::iostate&,
unsigned int&) const;
 
template
istreambuf_iterator<C>
num_get<C, istreambuf_iterator<C> >::
_M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
ios_base&, ios_base::iostate&,
unsigned long&) const;
 
#ifdef _GLIBCXX_USE_LONG_LONG
template
istreambuf_iterator<C>
num_get<C, istreambuf_iterator<C> >::
_M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
ios_base&, ios_base::iostate&,
long long&) const;
 
template
istreambuf_iterator<C>
num_get<C, istreambuf_iterator<C> >::
_M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
ios_base&, ios_base::iostate&,
unsigned long long&) const;
#endif
 
#if ! _GLIBCXX_USE_CXX11_ABI
template class num_put<C, ostreambuf_iterator<C> >;
 
template
ostreambuf_iterator<C>
num_put<C, ostreambuf_iterator<C> >::
_M_insert_int(ostreambuf_iterator<C>, ios_base&, C,
long) const;
 
template
ostreambuf_iterator<C>
num_put<C, ostreambuf_iterator<C> >::
_M_insert_int(ostreambuf_iterator<C>, ios_base&, C,
unsigned long) const;
 
#ifdef _GLIBCXX_USE_LONG_LONG
template
ostreambuf_iterator<C>
num_put<C, ostreambuf_iterator<C> >::
_M_insert_int(ostreambuf_iterator<C>, ios_base&, C,
long long) const;
 
template
ostreambuf_iterator<C>
num_put<C, ostreambuf_iterator<C> >::
_M_insert_int(ostreambuf_iterator<C>, ios_base&, C,
unsigned long long) const;
#endif
 
template
ostreambuf_iterator<C>
num_put<C, ostreambuf_iterator<C> >::
_M_insert_float(ostreambuf_iterator<C>, ios_base&, C, char,
double) const;
 
template
ostreambuf_iterator<C>
num_put<C, ostreambuf_iterator<C> >::
_M_insert_float(ostreambuf_iterator<C>, ios_base&, C, char,
long double) const;
#endif
_GLIBCXX_END_NAMESPACE_LDBL
 
// time_get and time_put
#if ! _GLIBCXX_USE_CXX11_ABI
template class __timepunct<C>;
template struct __timepunct_cache<C>;
template class time_put<C, ostreambuf_iterator<C> >;
template class time_put_byname<C, ostreambuf_iterator<C> >;
#else
// Instantiate constructor taking __cxx11::string
template time_put_byname<C>::time_put_byname(const string&, size_t);
#endif
_GLIBCXX_BEGIN_NAMESPACE_CXX11
template class time_get<C, istreambuf_iterator<C> >;
template class time_get_byname<C, istreambuf_iterator<C> >;
_GLIBCXX_END_NAMESPACE_CXX11
 
// messages
_GLIBCXX_BEGIN_NAMESPACE_CXX11
template class messages<C>;
template class messages_byname<C>;
_GLIBCXX_END_NAMESPACE_CXX11
// ctype
ctype_byname<C>::ctype_byname(const string& __s, size_t __refs)
: ctype_byname(__s.c_str(), __refs) { }
 
#if ! _GLIBCXX_USE_CXX11_ABI
inline template class __ctype_abstract_base<C>;
template class ctype_byname<C>;
#endif
// codecvt
#if ! _GLIBCXX_USE_CXX11_ABI
inline template class __codecvt_abstract_base<C, char, mbstate_t>;
template class codecvt_byname<C, char, mbstate_t>;
#else
// Instantiate constructor taking __cxx11::string
template codecvt_byname<C, char, mbstate_t>::codecvt_byname(const string&, size_t);
#endif
 
// collate
_GLIBCXX_BEGIN_NAMESPACE_CXX11
template class collate<C>;
template class collate_byname<C>;
_GLIBCXX_END_NAMESPACE_CXX11
// use_facet
#if ! _GLIBCXX_USE_CXX11_ABI
template
const ctype<C>&
use_facet<ctype<C> >(const locale&);
 
template
const codecvt<C, char, mbstate_t>&
use_facet<codecvt<C, char, mbstate_t> >(const locale&);
#endif
 
template
const collate<C>&
use_facet<collate<C> >(const locale&);
 
template
const numpunct<C>&
use_facet<numpunct<C> >(const locale&);
 
#if ! _GLIBCXX_USE_CXX11_ABI
template
const num_put<C>&
use_facet<num_put<C> >(const locale&);
 
template
const num_get<C>&
use_facet<num_get<C> >(const locale&);
#endif
 
template
const moneypunct<C, true>&
use_facet<moneypunct<C, true> >(const locale&);
 
template
const moneypunct<C, false>&
use_facet<moneypunct<C, false> >(const locale&);
 
template
const money_put<C>&
use_facet<money_put<C> >(const locale&);
 
template
const money_get<C>&
use_facet<money_get<C> >(const locale&);
 
#if ! _GLIBCXX_USE_CXX11_ABI
template
const __timepunct<C>&
use_facet<__timepunct<C> >(const locale&);
 
template
const time_put<C>&
use_facet<time_put<C> >(const locale&);
#endif
 
template
const time_get<C>&
use_facet<time_get<C> >(const locale&);
 
template
const messages<C>&
use_facet<messages<C> >(const locale&);
 
// has_facet
#if ! _GLIBCXX_USE_CXX11_ABI
template
bool
has_facet<ctype<C> >(const locale&);
 
template
bool
has_facet<codecvt<C, char, mbstate_t> >(const locale&);
#endif
 
template
bool
has_facet<collate<C> >(const locale&);
 
template
bool
has_facet<numpunct<C> >(const locale&);
 
#if ! _GLIBCXX_USE_CXX11_ABI
template
bool
has_facet<num_put<C> >(const locale&);
 
template
bool
has_facet<num_get<C> >(const locale&);
#endif
 
template
bool
has_facet<moneypunct<C> >(const locale&);
 
template
bool
has_facet<money_put<C> >(const locale&);
 
template
bool
has_facet<money_get<C> >(const locale&);
 
#if ! _GLIBCXX_USE_CXX11_ABI
template
bool
has_facet<__timepunct<C> >(const locale&);
 
template
bool
has_facet<time_put<C> >(const locale&);
#endif
 
template
bool
has_facet<time_get<C> >(const locale&);
 
template
bool
has_facet<messages<C> >(const locale&);
 
 
#if ! _GLIBCXX_USE_CXX11_ABI
// locale functions.
template
C*
__add_grouping<C>(C*, C, char const*, size_t,
C const*, C const*);
 
template class __pad<C, char_traits<C> >;
 
template
int
__int_to_char(C*, unsigned long, const C*,
ios_base::fmtflags, bool);
 
#ifdef _GLIBCXX_USE_LONG_LONG
template
int
__int_to_char(C*, unsigned long long, const C*,
ios_base::fmtflags, bool);
#endif
#endif
 
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
 
// XXX GLIBCXX_ABI Deprecated
#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined C_is_char \
&& _GLIBCXX_USE_CXX11_ABI == 0
 
#define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \
extern "C" void ldbl (void) __attribute__ ((alias (#dbl), weak))
 
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIjEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIjEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIlEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIlEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intImEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intImEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intItEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intItEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIxEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIxEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIyEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIyEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIlEES4_S4_RSt8ios_basecT_,
_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIlEES3_S3_RSt8ios_basecT_);
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intImEES4_S4_RSt8ios_basecT_,
_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intImEES3_S3_RSt8ios_basecT_);
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIxEES4_S4_RSt8ios_basecT_,
_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIxEES3_S3_RSt8ios_basecT_);
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIyEES4_S4_RSt8ios_basecT_,
_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIyEES3_S3_RSt8ios_basecT_);
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE15_M_insert_floatIdEES4_S4_RSt8ios_baseccT_,
_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE15_M_insert_floatIdEES3_S3_RSt8ios_baseccT_);
_GLIBCXX_LDBL_COMPAT(_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE15_M_insert_floatIdEES3_S3_RSt8ios_baseccT_,
_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE15_M_insert_floatIeEES3_S3_RSt8ios_baseccT_);
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE10_M_extractILb0EEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRSs,
_ZNKSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE10_M_extractILb0EEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRSs);
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE10_M_extractILb1EEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRSs,
_ZNKSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE10_M_extractILb1EEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRSs);
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE9_M_insertILb0EEES4_S4_RSt8ios_basecRKSs,
_ZNKSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE9_M_insertILb0EEES3_S3_RSt8ios_basecRKSs);
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE9_M_insertILb1EEES4_S4_RSt8ios_basecRKSs,
_ZNKSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE9_M_insertILb1EEES3_S3_RSt8ios_basecRKSs);
 
#endif // _GLIBCXX_LONG_DOUBLE_COMPAT
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/mutex.cc
0,0 → 1,97
// mutex -*- C++ -*-
 
// Copyright (C) 2008-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
#include <mutex>
 
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
#ifndef _GLIBCXX_HAVE_TLS
namespace
{
inline std::unique_lock<std::mutex>*&
__get_once_functor_lock_ptr()
{
static std::unique_lock<std::mutex>* __once_functor_lock_ptr = 0;
return __once_functor_lock_ptr;
}
}
#endif
 
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
#ifdef _GLIBCXX_HAVE_TLS
__thread void* __once_callable;
__thread void (*__once_call)();
#else
// Explicit instantiation due to -fno-implicit-instantiation.
template class function<void()>;
function<void()> __once_functor;
 
mutex&
__get_once_mutex()
{
static mutex once_mutex;
return once_mutex;
}
 
// code linked against ABI 3.4.12 and later uses this
void
__set_once_functor_lock_ptr(unique_lock<mutex>* __ptr)
{
__get_once_functor_lock_ptr() = __ptr;
}
 
// unsafe - retained for compatibility with ABI 3.4.11
unique_lock<mutex>&
__get_once_functor_lock()
{
static unique_lock<mutex> once_functor_lock(__get_once_mutex(), defer_lock);
return once_functor_lock;
}
#endif
 
extern "C"
{
void __once_proxy()
{
#ifndef _GLIBCXX_HAVE_TLS
function<void()> __once_call = std::move(__once_functor);
if (unique_lock<mutex>* __lock = __get_once_functor_lock_ptr())
{
// caller is using new ABI and provided lock ptr
__get_once_functor_lock_ptr() = 0;
__lock->unlock();
}
else
__get_once_functor_lock().unlock(); // global lock
#endif
__once_call();
}
}
 
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
 
#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/ostream-inst.cc
0,0 → 1,117
// Explicit instantiation file.
 
// Copyright (C) 1997-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
//
// ISO C++ 14882:
//
 
#include <ostream>
#include <iomanip>
 
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
// ostream
template class basic_ostream<char>;
template ostream& endl(ostream&);
template ostream& ends(ostream&);
template ostream& flush(ostream&);
template ostream& operator<<(ostream&, char);
template ostream& operator<<(ostream&, unsigned char);
template ostream& operator<<(ostream&, signed char);
template ostream& operator<<(ostream&, const char*);
template ostream& operator<<(ostream&, const unsigned char*);
template ostream& operator<<(ostream&, const signed char*);
 
template ostream& operator<<(ostream&, _Setfill<char>);
template ostream& operator<<(ostream&, _Setiosflags);
template ostream& operator<<(ostream&, _Resetiosflags);
template ostream& operator<<(ostream&, _Setbase);
template ostream& operator<<(ostream&, _Setprecision);
template ostream& operator<<(ostream&, _Setw);
template ostream& __ostream_insert(ostream&, const char*, streamsize);
 
template ostream& ostream::_M_insert(long);
template ostream& ostream::_M_insert(unsigned long);
template ostream& ostream::_M_insert(bool);
#ifdef _GLIBCXX_USE_LONG_LONG
template ostream& ostream::_M_insert(long long);
template ostream& ostream::_M_insert(unsigned long long);
#endif
template ostream& ostream::_M_insert(double);
template ostream& ostream::_M_insert(long double);
template ostream& ostream::_M_insert(const void*);
 
#ifdef _GLIBCXX_USE_WCHAR_T
template class basic_ostream<wchar_t>;
template wostream& endl(wostream&);
template wostream& ends(wostream&);
template wostream& flush(wostream&);
template wostream& operator<<(wostream&, wchar_t);
template wostream& operator<<(wostream&, char);
template wostream& operator<<(wostream&, const wchar_t*);
template wostream& operator<<(wostream&, const char*);
 
template wostream& operator<<(wostream&, _Setfill<wchar_t>);
template wostream& operator<<(wostream&, _Setiosflags);
template wostream& operator<<(wostream&, _Resetiosflags);
template wostream& operator<<(wostream&, _Setbase);
template wostream& operator<<(wostream&, _Setprecision);
template wostream& operator<<(wostream&, _Setw);
template wostream& __ostream_insert(wostream&, const wchar_t*, streamsize);
 
template wostream& wostream::_M_insert(long);
template wostream& wostream::_M_insert(unsigned long);
template wostream& wostream::_M_insert(bool);
#ifdef _GLIBCXX_USE_LONG_LONG
template wostream& wostream::_M_insert(long long);
template wostream& wostream::_M_insert(unsigned long long);
#endif
template wostream& wostream::_M_insert(double);
template wostream& wostream::_M_insert(long double);
template wostream& wostream::_M_insert(const void*);
#endif
 
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
 
// XXX GLIBCXX_ABI Deprecated
#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
 
#define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \
extern "C" void ldbl (void) __attribute__ ((alias (#dbl), weak))
_GLIBCXX_LDBL_COMPAT (_ZNSolsEd, _ZNSolsEe);
#ifdef _GLIBCXX_USE_WCHAR_T
_GLIBCXX_LDBL_COMPAT (_ZNSt13basic_ostreamIwSt11char_traitsIwEElsEd,
_ZNSt13basic_ostreamIwSt11char_traitsIwEElsEe);
#endif
_GLIBCXX_LDBL_COMPAT (_ZNSo9_M_insertIdEERSoT_,
_ZNSo9_M_insertIeEERSoT_);
#ifdef _GLIBCXX_USE_WCHAR_T
_GLIBCXX_LDBL_COMPAT (_ZNSt13basic_ostreamIwSt11char_traitsIwEE9_M_insertIdEERS2_T_,
_ZNSt13basic_ostreamIwSt11char_traitsIwEE9_M_insertIeEERS2_T_);
#endif
 
#endif // _GLIBCXX_LONG_DOUBLE_COMPAT
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/placeholders.cc
0,0 → 1,67
// std::placeholders -*- C++ -*-
 
// Copyright (C) 2011-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
#if __cplusplus < 201103L
# error "placeholders.cc must be compiled with -std=gnu++0x"
#endif
 
#include <functional>
 
namespace std _GLIBCXX_VISIBILITY(default)
{
namespace placeholders
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
extern const _Placeholder<1> _1{};
extern const _Placeholder<2> _2{};
extern const _Placeholder<3> _3{};
extern const _Placeholder<4> _4{};
extern const _Placeholder<5> _5{};
extern const _Placeholder<6> _6{};
extern const _Placeholder<7> _7{};
extern const _Placeholder<8> _8{};
extern const _Placeholder<9> _9{};
extern const _Placeholder<10> _10{};
extern const _Placeholder<11> _11{};
extern const _Placeholder<12> _12{};
extern const _Placeholder<13> _13{};
extern const _Placeholder<14> _14{};
extern const _Placeholder<15> _15{};
extern const _Placeholder<16> _16{};
extern const _Placeholder<17> _17{};
extern const _Placeholder<18> _18{};
extern const _Placeholder<19> _19{};
extern const _Placeholder<20> _20{};
extern const _Placeholder<21> _21{};
extern const _Placeholder<22> _22{};
extern const _Placeholder<23> _23{};
extern const _Placeholder<24> _24{};
extern const _Placeholder<25> _25{};
extern const _Placeholder<26> _26{};
extern const _Placeholder<27> _27{};
extern const _Placeholder<28> _28{};
extern const _Placeholder<29> _29{};
_GLIBCXX_END_NAMESPACE_VERSION
}
}
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/random.cc
0,0 → 1,172
// random -*- C++ -*-
 
// Copyright (C) 2012-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
#define _GLIBCXX_USE_CXX11_ABI 1
#include <random>
 
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
 
#if defined __i386__ || defined __x86_64__
# include <cpuid.h>
#endif
 
#include <cerrno>
#include <cstdio>
 
#ifdef _GLIBCXX_HAVE_UNISTD_H
# include <unistd.h>
#endif
 
namespace std _GLIBCXX_VISIBILITY(default)
{
namespace
{
static unsigned long
_M_strtoul(const std::string& __str)
{
unsigned long __ret = 5489UL;
if (__str != "mt19937")
{
const char* __nptr = __str.c_str();
char* __endptr;
__ret = std::strtoul(__nptr, &__endptr, 0);
if (*__nptr == '\0' || *__endptr != '\0')
std::__throw_runtime_error(__N("random_device::_M_strtoul"
"(const std::string&)"));
}
return __ret;
}
 
#if (defined __i386__ || defined __x86_64__) && defined _GLIBCXX_X86_RDRAND
unsigned int
__attribute__ ((target("rdrnd")))
__x86_rdrand(void)
{
unsigned int retries = 100;
unsigned int val;
 
while (__builtin_ia32_rdrand32_step(&val) == 0)
if (--retries == 0)
std::__throw_runtime_error(__N("random_device::__x86_rdrand(void)"));
 
return val;
}
#endif
}
 
void
random_device::_M_init(const std::string& token)
{
const char *fname = token.c_str();
 
if (token == "default")
{
#if (defined __i386__ || defined __x86_64__) && defined _GLIBCXX_X86_RDRAND
unsigned int eax, ebx, ecx, edx;
// Check availability of cpuid and, for now at least, also the
// CPU signature for Intel's
if (__get_cpuid_max(0, &ebx) > 0 && ebx == signature_INTEL_ebx)
{
__cpuid(1, eax, ebx, ecx, edx);
if (ecx & bit_RDRND)
{
_M_file = nullptr;
return;
}
}
#endif
 
fname = "/dev/urandom";
}
else if (token != "/dev/urandom" && token != "/dev/random")
fail:
std::__throw_runtime_error(__N("random_device::"
"random_device(const std::string&)"));
 
_M_file = static_cast<void*>(std::fopen(fname, "rb"));
if (!_M_file)
goto fail;
}
 
void
random_device::_M_init_pretr1(const std::string& token)
{
_M_mt.seed(_M_strtoul(token));
}
 
void
random_device::_M_fini()
{
if (_M_file)
std::fclose(static_cast<FILE*>(_M_file));
}
 
random_device::result_type
random_device::_M_getval()
{
#if (defined __i386__ || defined __x86_64__) && defined _GLIBCXX_X86_RDRAND
if (!_M_file)
return __x86_rdrand();
#endif
 
result_type __ret;
void* p = &__ret;
size_t n = sizeof(result_type);
#ifdef _GLIBCXX_HAVE_UNISTD_H
do
{
const int e = read(fileno(static_cast<FILE*>(_M_file)), p, n);
if (e > 0)
{
n -= e;
p = static_cast<char*>(p) + e;
}
else if (e != -1 || errno != EINTR)
__throw_runtime_error(__N("random_device could not be read"));
}
while (n > 0);
#else
const size_t e = std::fread(p, n, 1, static_cast<FILE*>(_M_file));
if (e != 1)
__throw_runtime_error(__N("random_device could not be read"));
#endif
 
return __ret;
}
 
random_device::result_type
random_device::_M_getval_pretr1()
{
return _M_mt();
}
 
template class mersenne_twister_engine<
uint_fast32_t,
32, 624, 397, 31,
0x9908b0dfUL, 11,
0xffffffffUL, 7,
0x9d2c5680UL, 15,
0xefc60000UL, 18, 1812433253UL>;
}
#endif
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/regex.cc
0,0 → 1,39
// regex -*- C++ -*-
 
// Copyright (C) 2011-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
#include <stdexcept>
#include <bits/regex_error.h>
 
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
regex_error::regex_error(regex_constants::error_type __ecode)
: std::runtime_error("regex_error"), _M_code(__ecode)
{ }
 
regex_error::~regex_error() throw() { }
 
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/shared_ptr.cc
0,0 → 1,96
// Support for pointer abstractions -*- C++ -*-
 
// Copyright (C) 2011-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
#include <memory>
 
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
bad_weak_ptr::~bad_weak_ptr() noexcept = default;
 
char const*
bad_weak_ptr::what() const noexcept
{ return "bad_weak_ptr"; }
 
#ifdef __GTHREADS
namespace
{
const unsigned char mask = 0xf;
const unsigned char invalid = mask + 1;
 
inline unsigned char key(const void* addr)
{ return _Hash_impl::hash(addr) & mask; }
 
/* Returns different instances of __mutex depending on the passed address
* in order to limit contention.
*/
__gnu_cxx::__mutex&
get_mutex(unsigned char i)
{
static __gnu_cxx::__mutex m[mask + 1];
return m[i];
}
}
 
_Sp_locker::_Sp_locker(const void* p)
{
if (__gthread_active_p())
{
_M_key1 = _M_key2 = key(p);
get_mutex(_M_key1).lock();
}
else
_M_key1 = _M_key2 = invalid;
}
 
_Sp_locker::_Sp_locker(const void* p1, const void* p2)
{
if (__gthread_active_p())
{
_M_key1 = key(p1);
_M_key2 = key(p2);
if (_M_key2 < _M_key1)
get_mutex(_M_key2).lock();
get_mutex(_M_key1).lock();
if (_M_key2 > _M_key1)
get_mutex(_M_key2).lock();
}
else
_M_key1 = _M_key2 = invalid;
}
 
_Sp_locker::~_Sp_locker()
{
if (_M_key1 != invalid)
{
get_mutex(_M_key1).unlock();
if (_M_key2 != _M_key1)
get_mutex(_M_key2).unlock();
}
}
#endif
 
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/snprintf_lite.cc
0,0 → 1,161
// Debugging support -*- C++ -*-
 
// Copyright (C) 2013-2015 Free Software Foundation, Inc.
//
// This file is part of GCC.
//
// GCC 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, or (at your option)
// any later version.
//
// GCC 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.
//
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
#include <stdarg.h>
#include <bits/functexcept.h>
#include <bits/locale_facets.h>
 
namespace std {
_GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _CharT, typename _ValueT>
int
__int_to_char(_CharT* __bufend, _ValueT __v, const _CharT* __lit,
ios_base::fmtflags __flags, bool __dec);
_GLIBCXX_END_NAMESPACE_VERSION
}
 
namespace __gnu_cxx {
 
// Private helper to throw logic error if snprintf_lite runs out
// of space (which is not expected to ever happen).
// NUL-terminates __buf.
void
__throw_insufficient_space(const char *__buf, const char *__bufend)
__attribute__((__noreturn__));
 
void
__throw_insufficient_space(const char *__buf, const char *__bufend)
{
// Include space for trailing NUL.
const size_t __len = __bufend - __buf + 1;
 
const char __err[] = "not enough space for format expansion "
"(Please submit full bug report at http://gcc.gnu.org/bugs.html):\n ";
const size_t __errlen = sizeof(__err) - 1;
 
char *const __e
= static_cast<char*>(__builtin_alloca(__errlen + __len));
 
__builtin_memcpy(__e, __err, __errlen);
__builtin_memcpy(__e + __errlen, __buf, __len - 1);
__e[__errlen + __len - 1] = '\0';
std::__throw_logic_error(__e);
}
 
 
// Private routine to append decimal representation of VAL to the given
// BUFFER, but not more than BUFSIZE characters.
// Does not NUL-terminate the output buffer.
// Returns number of characters appended, or -1 if BUFSIZE is too small.
int __concat_size_t(char *__buf, size_t __bufsize, size_t __val)
{
// __int_to_char is explicitly instantiated and available only for
// some, but not all, types. See locale-inst.cc.
#ifdef _GLIBCXX_USE_LONG_LONG
unsigned long long __val2 = __val;
#else
unsigned long __val2 = __val;
#endif
// Long enough for decimal representation.
int __ilen = 3 * sizeof(__val2);
char *__cs = static_cast<char*>(__builtin_alloca(__ilen));
size_t __len = std::__int_to_char(__cs + __ilen, __val2,
std::__num_base::_S_atoms_out,
std::ios_base::dec, true);
if (__bufsize < __len)
return -1;
 
__builtin_memcpy(__buf, __cs + __ilen - __len, __len);
return __len;
}
 
 
// Private routine to print into __buf arguments according to format,
// not to exceed __bufsize.
// Only '%%', '%s' and '%zu' format specifiers are understood.
// Returns number of characters printed (excluding terminating NUL).
// Always NUL-terminates __buf.
// Throws logic_error on insufficient space.
int __snprintf_lite(char *__buf, size_t __bufsize, const char *__fmt,
va_list __ap)
{
char *__d = __buf;
const char *__s = __fmt;
const char *const __limit = __d + __bufsize - 1; // Leave space for NUL.
 
while (__s[0] != '\0' && __d < __limit)
{
if (__s[0] == '%')
switch (__s[1])
{
default: // Stray '%'. Just print it.
break;
case '%': // '%%'
__s += 1;
break;
case 's': // '%s'.
{
const char *__v = va_arg(__ap, const char *);
 
while (__v[0] != '\0' && __d < __limit)
*__d++ = *__v++;
 
if (__v[0] != '\0')
// Not enough space for __fmt expansion.
__throw_insufficient_space(__buf, __d);
 
__s += 2; // Step over %s.
continue;
}
break;
case 'z':
if (__s[2] == 'u') // '%zu' -- expand next size_t arg.
{
const int __len = __concat_size_t(__d, __limit - __d,
va_arg(__ap, size_t));
if (__len > 0)
__d += __len;
else
// Not enough space for __fmt expansion.
__throw_insufficient_space(__buf, __d);
 
__s += 3; // Step over %zu
continue;
}
// Stray '%zX'. Just print it.
break;
}
*__d++ = *__s++;
}
 
if (__s[0] != '\0')
// Not enough space for __fmt expansion.
__throw_insufficient_space(__buf, __d);
 
*__d = '\0';
return __d - __buf;
}
 
} // __gnu_cxx
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/sstream-inst.cc
0,0 → 1,53
// Explicit instantiation file.
 
// Copyright (C) 1997-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
//
// ISO C++ 14882:
//
 
#ifndef _GLIBCXX_USE_CXX11_ABI
// Instantiations in this file use the new SSO std::string ABI unless included
// by another file which defines _GLIBCXX_USE_CXX11_ABI=0.
# define _GLIBCXX_USE_CXX11_ABI 1
#endif
#include <sstream>
 
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
template class basic_stringbuf<char>;
template class basic_istringstream<char>;
template class basic_ostringstream<char>;
template class basic_stringstream<char>;
 
#ifdef _GLIBCXX_USE_WCHAR_T
template class basic_stringbuf<wchar_t>;
template class basic_istringstream<wchar_t>;
template class basic_ostringstream<wchar_t>;
template class basic_stringstream<wchar_t>;
#endif
 
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/streambuf-inst.cc
0,0 → 1,63
// Explicit instantiation file.
 
// Copyright (C) 1997-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
//
// ISO C++ 14882:
//
 
#include <ios>
#include <streambuf>
 
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
// streambuf
template class basic_streambuf<char>;
 
template
streamsize
__copy_streambufs(basic_streambuf<char>*, basic_streambuf<char>*);
 
template
streamsize
__copy_streambufs_eof(basic_streambuf<char>*,
basic_streambuf<char>*, bool&);
 
#ifdef _GLIBCXX_USE_WCHAR_T
// wstreambuf
template class basic_streambuf<wchar_t>;
 
template
streamsize
__copy_streambufs(basic_streambuf<wchar_t>*, basic_streambuf<wchar_t>*);
 
template
streamsize
__copy_streambufs_eof(basic_streambuf<wchar_t>*,
basic_streambuf<wchar_t>*, bool&);
#endif
 
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/string-inst.cc
0,0 → 1,115
// Components for manipulating sequences of characters -*- C++ -*-
 
// Copyright (C) 1997-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
//
// ISO C++ 14882: 21 Strings library
//
 
// Written by Jason Merrill based upon the specification by Takanori Adachi
// in ANSI X3J16/94-0013R2. Rewritten by Nathan Myers.
 
#ifndef _GLIBCXX_USE_CXX11_ABI
// Instantiations in this file use the new SSO std::string ABI unless included
// by another file which defines _GLIBCXX_USE_CXX11_ABI=0.
# define _GLIBCXX_USE_CXX11_ABI 1
#endif
 
#include <string>
 
// Instantiation configuration.
#ifndef C
# define C char
#endif
 
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
typedef basic_string<C> S;
 
template class basic_string<C>;
template S operator+(const C*, const S&);
template S operator+(C, const S&);
template S operator+(const S&, const S&);
 
// Only one template keyword allowed here.
// See core issue #46 (NAD)
// http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#46
template
S::basic_string(C*, C*, const allocator<C>&);
 
template
S::basic_string(const C*, const C*, const allocator<C>&);
 
template
S::basic_string(S::iterator, S::iterator, const allocator<C>&);
 
#if _GLIBCXX_USE_CXX11_ABI
template
void
S::_M_construct(S::iterator, S::iterator, forward_iterator_tag);
 
template
void
S::_M_construct(S::const_iterator, S::const_iterator,
forward_iterator_tag);
 
template
void
S::_M_construct(C*, C*, forward_iterator_tag);
 
template
void
S::_M_construct(const C*, const C*, forward_iterator_tag);
 
#else // !_GLIBCXX_USE_CXX11_ABI
 
template
C*
S::_S_construct(S::iterator, S::iterator,
const allocator<C>&, forward_iterator_tag);
 
template
C*
S::_S_construct(C*, C*, const allocator<C>&, forward_iterator_tag);
 
template
C*
S::_S_construct(const C*, const C*, const allocator<C>&,
forward_iterator_tag);
#endif
 
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
 
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
using std::S;
template bool operator==(const S::iterator&, const S::iterator&);
template bool operator==(const S::const_iterator&, const S::const_iterator&);
 
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/system_error.cc
0,0 → 1,184
// <system_error> implementation file
 
// Copyright (C) 2007-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
 
#define _GLIBCXX_USE_CXX11_ABI 1
#define __sso_string __sso_stringxxx
#include <cstring>
#include <system_error>
#include <bits/functexcept.h>
#include <limits>
#undef __sso_string
 
namespace
{
using std::string;
struct generic_error_category : public std::error_category
{
virtual const char*
name() const noexcept
{ return "generic"; }
 
_GLIBCXX_DEFAULT_ABI_TAG
virtual string
message(int i) const
{
// XXX locale issues: how does one get or set loc.
// _GLIBCXX_HAVE_STRERROR_L, strerror_l(i, cloc)
return string(strerror(i));
}
};
 
struct system_error_category : public std::error_category
{
virtual const char*
name() const noexcept
{ return "system"; }
 
_GLIBCXX_DEFAULT_ABI_TAG
virtual string
message(int i) const
{
// XXX locale issues: how does one get or set loc.
// _GLIBCXX_HAVE_STRERROR_L, strerror_l(i, cloc)
return string(strerror(i));
}
};
 
const generic_error_category generic_category_instance{};
const system_error_category system_category_instance{};
}
 
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
error_category::~error_category() noexcept = default;
 
const error_category&
_V2::system_category() noexcept { return system_category_instance; }
 
const error_category&
_V2::generic_category() noexcept { return generic_category_instance; }
system_error::~system_error() noexcept = default;
 
error_condition
error_category::default_error_condition(int __i) const noexcept
{ return error_condition(__i, *this); }
 
bool
error_category::equivalent(int __i,
const error_condition& __cond) const noexcept
{ return default_error_condition(__i) == __cond; }
 
bool
error_category::equivalent(const error_code& __code, int __i) const noexcept
{ return *this == __code.category() && __code.value() == __i; }
 
error_condition
error_code::default_error_condition() const noexcept
{ return category().default_error_condition(value()); }
 
#if _GLIBCXX_USE_CXX11_ABI
// Return error_category::message() as a COW string
__cow_string
error_category::_M_message(int i) const
{
string msg = this->message(i);
return {msg.c_str(), msg.length()};
}
#endif
 
#if _GLIBCXX_USE_DUAL_ABI
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wabi-tag"
// Redefine __sso_string so that we can define and export its members
// in terms of the SSO std::string.
struct __sso_string
{
struct __str
{
const char* _M_p;
size_t _M_string_length;
char _M_local_buf[16];
};
 
union {
__str _M_s;
char _M_bytes[sizeof(_M_s)];
std::string _M_str;
};
 
__sso_string();
__sso_string(const std::string& s);
__sso_string(const char*, size_t n);
__sso_string(const __sso_string&) noexcept;
__sso_string& operator=(const __sso_string&) noexcept;
~__sso_string();
__sso_string(__sso_string&&) noexcept;
__sso_string& operator=(__sso_string&&) noexcept;
};
#pragma GCC diagnostic pop
 
__sso_string::__sso_string() : _M_str() { }
 
#if _GLIBCXX_USE_CXX11_ABI
static_assert(sizeof(__sso_string) == sizeof(std::string),
"sizeof(std::string) has changed");
static_assert(alignof(__sso_string) == alignof(std::string),
"alignof(std::string) has changed");
 
// This constructor is defined in src/c++11/cow-stdexcept.cc for COW strings
__sso_string::__sso_string(const std::string& s) : _M_str(s) { }
#endif
 
__sso_string::__sso_string(const char* s, size_t n) : _M_str(s, n) { }
 
__sso_string::__sso_string(const __sso_string& s) noexcept
: _M_str(s._M_str) { }
 
__sso_string&
__sso_string::operator=(const __sso_string& s) noexcept
{
_M_str = s._M_str;
return *this;
}
 
__sso_string::~__sso_string() { _M_str.~basic_string(); }
 
__sso_string::__sso_string(__sso_string&& s) noexcept
: _M_str(std::move(s._M_str)) { }
 
__sso_string&
__sso_string::operator=(__sso_string&& s) noexcept
{
_M_str = std::move(s._M_str);
return *this;
}
#endif // _GLIBCXX_USE_DUAL_ABI
 
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/thread.cc
0,0 → 1,208
// thread -*- C++ -*-
 
// Copyright (C) 2008-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
 
#include <thread>
#include <system_error>
#include <cerrno>
#include <cxxabi_forced.h>
 
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
 
#if defined(_GLIBCXX_USE_GET_NPROCS)
# include <sys/sysinfo.h>
# define _GLIBCXX_NPROCS get_nprocs()
#elif defined(_GLIBCXX_USE_PTHREADS_NUM_PROCESSORS_NP)
# define _GLIBCXX_NPROCS pthread_num_processors_np()
#elif defined(_GLIBCXX_USE_SYSCTL_HW_NCPU)
# include <stddef.h>
# include <sys/sysctl.h>
static inline int get_nprocs()
{
int count;
size_t size = sizeof(count);
int mib[] = { CTL_HW, HW_NCPU };
if (!sysctl(mib, 2, &count, &size, NULL, 0))
return count;
return 0;
}
# define _GLIBCXX_NPROCS get_nprocs()
#elif defined(_GLIBCXX_USE_SC_NPROCESSORS_ONLN)
# include <unistd.h>
# define _GLIBCXX_NPROCS sysconf(_SC_NPROCESSORS_ONLN)
#elif defined(_GLIBCXX_USE_SC_NPROC_ONLN)
# include <unistd.h>
# define _GLIBCXX_NPROCS sysconf(_SC_NPROC_ONLN)
#else
# define _GLIBCXX_NPROCS 0
#endif
 
#ifndef _GLIBCXX_USE_NANOSLEEP
# ifdef _GLIBCXX_HAVE_SLEEP
# include <unistd.h>
# elif defined(_GLIBCXX_HAVE_WIN32_SLEEP)
# include <windows.h>
# else
# error "No sleep function known for this target"
# endif
#endif
 
namespace std _GLIBCXX_VISIBILITY(default)
{
extern "C"
{
static void*
execute_native_thread_routine(void* __p)
{
thread::_Impl_base* __t = static_cast<thread::_Impl_base*>(__p);
thread::__shared_base_type __local;
__local.swap(__t->_M_this_ptr);
 
__try
{
__t->_M_run();
}
__catch(const __cxxabiv1::__forced_unwind&)
{
__throw_exception_again;
}
__catch(...)
{
std::terminate();
}
 
return nullptr;
}
} // extern "C"
 
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
void
thread::join()
{
int __e = EINVAL;
 
if (_M_id != id())
__e = __gthread_join(_M_id._M_thread, 0);
 
if (__e)
__throw_system_error(__e);
 
_M_id = id();
}
 
void
thread::detach()
{
int __e = EINVAL;
 
if (_M_id != id())
__e = __gthread_detach(_M_id._M_thread);
 
if (__e)
__throw_system_error(__e);
 
_M_id = id();
}
 
void
thread::_M_start_thread(__shared_base_type __b)
{
if (!__gthread_active_p())
#if __cpp_exceptions
throw system_error(make_error_code(errc::operation_not_permitted),
"Enable multithreading to use std::thread");
#else
__throw_system_error(int(errc::operation_not_permitted));
#endif
 
_M_start_thread(std::move(__b), nullptr);
}
 
void
thread::_M_start_thread(__shared_base_type __b, void (*)())
{
auto ptr = __b.get();
ptr->_M_this_ptr = std::move(__b);
int __e = __gthread_create(&_M_id._M_thread,
&execute_native_thread_routine, ptr);
if (__e)
{
ptr->_M_this_ptr.reset();
__throw_system_error(__e);
}
}
 
unsigned int
thread::hardware_concurrency() noexcept
{
int __n = _GLIBCXX_NPROCS;
if (__n < 0)
__n = 0;
return __n;
}
 
_GLIBCXX_END_NAMESPACE_VERSION
 
namespace this_thread
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
void
__sleep_for(chrono::seconds __s, chrono::nanoseconds __ns)
{
#ifdef _GLIBCXX_USE_NANOSLEEP
__gthread_time_t __ts =
{
static_cast<std::time_t>(__s.count()),
static_cast<long>(__ns.count())
};
::nanosleep(&__ts, 0);
#elif defined(_GLIBCXX_HAVE_SLEEP)
# ifdef _GLIBCXX_HAVE_USLEEP
::sleep(__s.count());
if (__ns.count() > 0)
{
long __us = __ns.count() / 1000;
if (__us == 0)
__us = 1;
::usleep(__us);
}
# else
::sleep(__s.count() + (__ns.count() >= 1000000));
# endif
#elif defined(_GLIBCXX_HAVE_WIN32_SLEEP)
unsigned long ms = __ns.count() / 1000000;
if (__ns.count() > 0 && ms == 0)
ms = 1;
::Sleep(chrono::milliseconds(__s).count() + ms);
#endif
}
 
_GLIBCXX_END_NAMESPACE_VERSION
}
 
} // namespace std
 
#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/wlocale-inst.cc
0,0 → 1,77
// Locale support -*- C++ -*-
 
// Copyright (C) 1999-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
//
// ISO C++ 14882: 22.1 Locales
//
 
// Instantiate locales using COW std::wstring ABI
#define _GLIBCXX_USE_CXX11_ABI 0
#include <bits/c++config.h>
 
#ifdef _GLIBCXX_USE_WCHAR_T
#define C wchar_t
#include "locale-inst.cc"
 
// XXX GLIBCXX_ABI Deprecated
#if defined _GLIBCXX_LONG_DOUBLE_COMPAT
 
#define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \
extern "C" void ldbl (void) __attribute__ ((alias (#dbl), weak))
 
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intIjEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intIjEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intIlEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intIlEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intImEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intImEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intItEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intItEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intIxEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intIxEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intIyEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_,
_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intIyEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_);
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE13_M_insert_intIlEES4_S4_RSt8ios_basewT_,
_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE13_M_insert_intIlEES3_S3_RSt8ios_basewT_);
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE13_M_insert_intImEES4_S4_RSt8ios_basewT_,
_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE13_M_insert_intImEES3_S3_RSt8ios_basewT_);
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE13_M_insert_intIxEES4_S4_RSt8ios_basewT_,
_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE13_M_insert_intIxEES3_S3_RSt8ios_basewT_);
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE13_M_insert_intIyEES4_S4_RSt8ios_basewT_,
_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE13_M_insert_intIyEES3_S3_RSt8ios_basewT_);
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE15_M_insert_floatIdEES4_S4_RSt8ios_basewcT_,
_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE15_M_insert_floatIdEES3_S3_RSt8ios_basewcT_);
_GLIBCXX_LDBL_COMPAT(_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE15_M_insert_floatIdEES3_S3_RSt8ios_basewcT_,
_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE15_M_insert_floatIeEES3_S3_RSt8ios_basewcT_);
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE10_M_extractILb0EEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRSs,
_ZNKSt9money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE10_M_extractILb0EEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRSs);
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE10_M_extractILb1EEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRSs,
_ZNKSt9money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE10_M_extractILb1EEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRSs);
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE9_M_insertILb0EEES4_S4_RSt8ios_basewRKSbIwS3_SaIwEE,
_ZNKSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE9_M_insertILb0EEES3_S3_RSt8ios_basewRKSbIwS2_SaIwEE);
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE9_M_insertILb1EEES4_S4_RSt8ios_basewRKSbIwS3_SaIwEE,
_ZNKSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE9_M_insertILb1EEES3_S3_RSt8ios_basewRKSbIwS2_SaIwEE);
 
#endif // _GLIBCXX_LONG_DOUBLE_COMPAT
#endif
/contrib/toolchain/gcc/5x/libstdc++-v3/src/c++11/wstring-inst.cc
0,0 → 1,35
// wide string support -*- C++ -*-
 
// Copyright (C) 1999-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option)
// any later version.
 
// This library 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.
 
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
 
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
 
//
// ISO C++ 14882: 21 Strings library
//
 
#define _GLIBCXX_USE_CXX11_ABI 1
#include <bits/c++config.h>
 
#ifdef _GLIBCXX_USE_WCHAR_T
#define C wchar_t
#include "string-inst.cc"
#endif