Saleem Abdulrasool: GCC complains about the template functions as potentially not being able to be

inlined.  These do not need to be always-inlined for ABI stability because they are not exported beyond this source due to the unnamed namespace.
Also simplified use of the Wmissing-field-initializers pragma as was done for clang.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@171202 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Howard Hinnant 2012-12-28 18:15:01 +00:00
parent 2328902ab1
commit 21772ec063

View File

@ -82,7 +82,7 @@ make(A0 a0, A1 a1, A2 a2)
} }
template <typename T, size_t N> template <typename T, size_t N>
_LIBCPP_ALWAYS_INLINE inline
_LIBCPP_CONSTEXPR _LIBCPP_CONSTEXPR
size_t size_t
countof(const T (&)[N]) countof(const T (&)[N])
@ -91,7 +91,7 @@ countof(const T (&)[N])
} }
template <typename T> template <typename T>
_LIBCPP_ALWAYS_INLINE inline
_LIBCPP_CONSTEXPR _LIBCPP_CONSTEXPR
size_t size_t
countof(const T * const begin, const T * const end) countof(const T * const begin, const T * const end)
@ -224,10 +224,10 @@ locale::__imp::__imp(const string& name, size_t refs)
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
} }
// NOTE(saleem) avoid the `base class should be explicitly initialized in the // NOTE avoid the `base class should be explicitly initialized in the
// copy constructor` warning emitted by GCC // copy constructor` warning emitted by GCC
#pragma GCC diagnostic ignored "-Wextra"
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wextra"
locale::__imp::__imp(const __imp& other) locale::__imp::__imp(const __imp& other)
: facets_(max<size_t>(N, other.facets_.size())), : facets_(max<size_t>(N, other.facets_.size())),
@ -4603,15 +4603,13 @@ __time_get::~__time_get()
} }
#pragma clang diagnostic ignored "-Wmissing-field-initializers" #pragma clang diagnostic ignored "-Wmissing-field-initializers"
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
template <> template <>
string string
__time_get_storage<char>::__analyze(char fmt, const ctype<char>& ct) __time_get_storage<char>::__analyze(char fmt, const ctype<char>& ct)
{ {
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#pragma GCC diagnostic push
tm t = {0}; tm t = {0};
#pragma GCC diagnostic pop
t.tm_sec = 59; t.tm_sec = 59;
t.tm_min = 55; t.tm_min = 55;
t.tm_hour = 23; t.tm_hour = 23;
@ -4757,10 +4755,7 @@ template <>
wstring wstring
__time_get_storage<wchar_t>::__analyze(char fmt, const ctype<wchar_t>& ct) __time_get_storage<wchar_t>::__analyze(char fmt, const ctype<wchar_t>& ct)
{ {
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#pragma GCC diagnostic push
tm t = {0}; tm t = {0};
#pragma GCC diagnositc pop
t.tm_sec = 59; t.tm_sec = 59;
t.tm_min = 55; t.tm_min = 55;
t.tm_hour = 23; t.tm_hour = 23;
@ -4914,10 +4909,7 @@ template <>
void void
__time_get_storage<char>::init(const ctype<char>& ct) __time_get_storage<char>::init(const ctype<char>& ct)
{ {
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#pragma GCC diagnostic push
tm t = {0}; tm t = {0};
#pragma GCC diagnostic pop
char buf[100]; char buf[100];
// __weeks_ // __weeks_
for (int i = 0; i < 7; ++i) for (int i = 0; i < 7; ++i)
@ -4954,17 +4946,11 @@ template <>
void void
__time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct) __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
{ {
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#pragma GCC diagnostic push
tm t = {0}; tm t = {0};
#pragma GCC diagnostic pop
char buf[100]; char buf[100];
wchar_t wbuf[100]; wchar_t wbuf[100];
wchar_t* wbe; wchar_t* wbe;
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#pragma GCC diagnostic push
mbstate_t mb = {0}; mbstate_t mb = {0};
#pragma GCC diagnostic pop
// __weeks_ // __weeks_
for (int i = 0; i < 7; ++i) for (int i = 0; i < 7; ++i)
{ {
@ -5318,10 +5304,7 @@ __time_put::__do_put(wchar_t* __wb, wchar_t*& __we, const tm* __tm,
char __nar[100]; char __nar[100];
char* __ne = __nar + 100; char* __ne = __nar + 100;
__do_put(__nar, __ne, __tm, __fmt, __mod); __do_put(__nar, __ne, __tm, __fmt, __mod);
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#pragma GCC diagnostic push
mbstate_t mb = {0}; mbstate_t mb = {0};
#pragma GCC diagnostic pop
const char* __nb = __nar; const char* __nb = __nar;
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS #ifdef _LIBCPP_LOCALE__L_EXTENSIONS
size_t j = mbsrtowcs_l(__wb, &__nb, countof(__wb, __we), &mb, __loc_); size_t j = mbsrtowcs_l(__wb, &__nb, countof(__wb, __we), &mb, __loc_);
@ -5846,10 +5829,7 @@ moneypunct_byname<wchar_t, false>::init(const char* nm)
__thousands_sep_ = base::do_thousands_sep(); __thousands_sep_ = base::do_thousands_sep();
__grouping_ = lc->mon_grouping; __grouping_ = lc->mon_grouping;
wchar_t wbuf[100]; wchar_t wbuf[100];
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#pragma GCC diagnostic push
mbstate_t mb = {0}; mbstate_t mb = {0};
#pragma GCC diagnostic pop
const char* bb = lc->currency_symbol; const char* bb = lc->currency_symbol;
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS #ifdef _LIBCPP_LOCALE__L_EXTENSIONS
size_t j = mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get()); size_t j = mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get());
@ -5932,10 +5912,7 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
__thousands_sep_ = base::do_thousands_sep(); __thousands_sep_ = base::do_thousands_sep();
__grouping_ = lc->mon_grouping; __grouping_ = lc->mon_grouping;
wchar_t wbuf[100]; wchar_t wbuf[100];
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#pragma GCC diagnostic push
mbstate_t mb = {0}; mbstate_t mb = {0};
#pragma GCC diagnostic pop
const char* bb = lc->int_curr_symbol; const char* bb = lc->int_curr_symbol;
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS #ifdef _LIBCPP_LOCALE__L_EXTENSIONS
size_t j = mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get()); size_t j = mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get());