summaryrefslogtreecommitdiffstats
path: root/libcxx
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2012-12-27 23:24:31 +0000
committerHoward Hinnant <hhinnant@apple.com>2012-12-27 23:24:31 +0000
commit6b0101acae4828663cb466e8b2be40d2317bc2ed (patch)
treeb8e960faaade955271fae23750ae4af67794e3fa /libcxx
parent68441914a57a21019d0319ab2b6c3c05d1c49713 (diff)
downloadbcm5719-llvm-6b0101acae4828663cb466e8b2be40d2317bc2ed.tar.gz
bcm5719-llvm-6b0101acae4828663cb466e8b2be40d2317bc2ed.zip
Saleem Abdulrasool: cleanup a few more compile warnings emitted by GCC.
llvm-svn: 171173
Diffstat (limited to 'libcxx')
-rw-r--r--libcxx/src/locale.cpp31
-rw-r--r--libcxx/src/thread.cpp6
2 files changed, 35 insertions, 2 deletions
diff --git a/libcxx/src/locale.cpp b/libcxx/src/locale.cpp
index 34afe8c82e8..faceb4e840f 100644
--- a/libcxx/src/locale.cpp
+++ b/libcxx/src/locale.cpp
@@ -224,6 +224,11 @@ locale::__imp::__imp(const string& name, size_t refs)
#endif // _LIBCPP_NO_EXCEPTIONS
}
+// NOTE(saleem) avoid the `base class should be explicitly initialized in the
+// copy constructor` warning emitted by GCC
+#pragma GCC diagnostic ignored "-Wextra"
+#pragma GCC diagnostic push
+
locale::__imp::__imp(const __imp& other)
: facets_(max<size_t>(N, other.facets_.size())),
name_(other.name_)
@@ -234,6 +239,8 @@ locale::__imp::__imp(const __imp& other)
facets_[i]->__add_shared();
}
+#pragma GCC diagnostic pop
+
locale::__imp::__imp(const __imp& other, const string& name, locale::category c)
: facets_(N),
name_("*")
@@ -4601,7 +4608,10 @@ template <>
string
__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};
+#pragma GCC diagnostic pop
t.tm_sec = 59;
t.tm_min = 55;
t.tm_hour = 23;
@@ -4747,7 +4757,10 @@ template <>
wstring
__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};
+#pragma GCC diagnositc pop
t.tm_sec = 59;
t.tm_min = 55;
t.tm_hour = 23;
@@ -4901,7 +4914,10 @@ template <>
void
__time_get_storage<char>::init(const ctype<char>& ct)
{
+#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
+#pragma GCC diagnostic push
tm t = {0};
+#pragma GCC diagnostic pop
char buf[100];
// __weeks_
for (int i = 0; i < 7; ++i)
@@ -4938,11 +4954,17 @@ template <>
void
__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};
+#pragma GCC diagnostic pop
char buf[100];
wchar_t wbuf[100];
wchar_t* wbe;
+#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
+#pragma GCC diagnostic push
mbstate_t mb = {0};
+#pragma GCC diagnostic pop
// __weeks_
for (int i = 0; i < 7; ++i)
{
@@ -5296,7 +5318,10 @@ __time_put::__do_put(wchar_t* __wb, wchar_t*& __we, const tm* __tm,
char __nar[100];
char* __ne = __nar + 100;
__do_put(__nar, __ne, __tm, __fmt, __mod);
+#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
+#pragma GCC diagnostic push
mbstate_t mb = {0};
+#pragma GCC diagnostic pop
const char* __nb = __nar;
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
size_t j = mbsrtowcs_l(__wb, &__nb, countof(__wb, __we), &mb, __loc_);
@@ -5821,7 +5846,10 @@ moneypunct_byname<wchar_t, false>::init(const char* nm)
__thousands_sep_ = base::do_thousands_sep();
__grouping_ = lc->mon_grouping;
wchar_t wbuf[100];
+#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
+#pragma GCC diagnostic push
mbstate_t mb = {0};
+#pragma GCC diagnostic pop
const char* bb = lc->currency_symbol;
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
size_t j = mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get());
@@ -5904,7 +5932,10 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
__thousands_sep_ = base::do_thousands_sep();
__grouping_ = lc->mon_grouping;
wchar_t wbuf[100];
+#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
+#pragma GCC diagnostic push
mbstate_t mb = {0};
+#pragma GCC diagnostic pop
const char* bb = lc->int_curr_symbol;
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
size_t j = mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, loc.get());
diff --git a/libcxx/src/thread.cpp b/libcxx/src/thread.cpp
index 8747adf0b59..b2bd07e9d3b 100644
--- a/libcxx/src/thread.cpp
+++ b/libcxx/src/thread.cpp
@@ -67,8 +67,10 @@ thread::hardware_concurrency() _NOEXCEPT
return n;
#elif defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L) && defined(_SC_NPROCESSORS_ONLN)
long result = sysconf(_SC_NPROCESSORS_ONLN);
- if (result < 0 || result > UINT_MAX)
- result = 0;
+ // sysconf returns -1 if the name is invalid, the option does not exist or
+ // does not have a definite limit.
+ if (result == -1)
+ return 0;
return result;
#else // defined(CTL_HW) && defined(HW_NCPU)
// TODO: grovel through /proc or check cpuid on x86 and similar
OpenPOWER on IntegriCloud