This just rounds up a few compile warnings emitted by GCC (4.7.2).  Included
are:
    - missing field initializers
    - extraneous semicolon
    - unused variable
    - explicit instantiation of base class
    - comparisons between signed and unsigned values
    - array indexing via a char type

http://llvm-reviews.chandlerc.com/D242

Files:
  src/debug.cpp
  src/locale.cpp
  src/thread.cpp
Index: src/debug.cpp
===================================================================
--- src/debug.cpp
+++ src/debug.cpp
@@ -23,7 +23,7 @@
 {
     static __libcpp_db db;
     return &db;
-};
+}
 
 _LIBCPP_VISIBLE
 const __libcpp_db*
Index: src/locale.cpp
===================================================================
--- src/locale.cpp
+++ src/locale.cpp
@@ -207,7 +207,8 @@
 }
 
 locale::__imp::__imp(const __imp& other)
-    : facets_(max<size_t>(N, other.facets_.size())),
+    : facet(),
+      facets_(max<size_t>(N, other.facets_.size())),
       name_(other.name_)
 {
     facets_ = other.facets_;
@@ -865,7 +866,7 @@
     return isascii(c) ?
       static_cast<char>(_DefaultRuneLocale.__mapupper[static_cast<ptrdiff_t>(c)]) : c;
 #elif defined(__GLIBC__)
-    return isascii(c) ? __classic_upper_table()[c] : c;
+    return isascii(c) ? __classic_upper_table()[static_cast<size_t>(c)] : c;
 #else
     return (isascii(c) && islower_l(c, __cloc())) ? c-'a'+'A' : c;
 #endif
@@ -879,7 +880,7 @@
         *low = isascii(*low) ?
           static_cast<char>(_DefaultRuneLocale.__mapupper[static_cast<ptrdiff_t>(*low)]) : *low;
 #elif defined(__GLIBC__)
-        *low = isascii(*low) ? __classic_upper_table()[*low] : *low;
+        *low = isascii(*low) ? __classic_upper_table()[static_cast<size_t>(*low)] : *low;
 #else
         *low = (isascii(*low) && islower_l(*low, __cloc())) ? *low-'a'+'A' : *low;
 #endif
@@ -893,7 +894,7 @@
     return isascii(c) ?
       static_cast<char>(_DefaultRuneLocale.__maplower[static_cast<ptrdiff_t>(c)]) : c;
 #elif defined(__GLIBC__)
-    return isascii(c) ? __classic_lower_table()[c] : c;
+    return isascii(c) ? __classic_lower_table()[static_cast<size_t>(c)] : c;
 #else
     return (isascii(c) && isupper_l(c, __cloc())) ? c-'A'+'a' : c;
 #endif
@@ -906,7 +907,7 @@
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
         *low = isascii(*low) ? static_cast<char>(_DefaultRuneLocale.__maplower[static_cast<ptrdiff_t>(*low)]) : *low;
 #elif defined(__GLIBC__)
-        *low = isascii(*low) ? __classic_lower_table()[*low] : *low;
+        *low = isascii(*low) ? __classic_lower_table()[static_cast<size_t>(*low)] : *low;
 #else
         *low = (isascii(*low) && isupper_l(*low, __cloc())) ? *low-'A'+'a' : *low;
 #endif
@@ -1229,7 +1230,7 @@
 #else
     int r = __wctob_l(c, __l);
 #endif
-    return r != WEOF ? static_cast<char>(r) : dfault;
+    return r != static_cast<int>(WEOF) ? static_cast<char>(r) : dfault;
 }
 
 const wchar_t*
@@ -1242,7 +1243,7 @@
 #else
         int r = __wctob_l(*low, __l);
 #endif
-        *dest = r != WEOF ? static_cast<char>(r) : dfault;
+        *dest = r != static_cast<int>(WEOF) ? static_cast<char>(r) : dfault;
     }
     return low;
 }
@@ -4583,7 +4584,7 @@
 string
 __time_get_storage<char>::__analyze(char fmt, const ctype<char>& ct)
 {
-    tm t = {0};
+    tm t = {0,0,0,0,0,0,0,0,0,0,0};
     t.tm_sec = 59;
     t.tm_min = 55;
     t.tm_hour = 23;
@@ -4729,7 +4730,7 @@
 wstring
 __time_get_storage<wchar_t>::__analyze(char fmt, const ctype<wchar_t>& ct)
 {
-    tm t = {0};
+    tm t = {0,0,0,0,0,0,0,0,0,0,0};
     t.tm_sec = 59;
     t.tm_min = 55;
     t.tm_hour = 23;
@@ -4746,7 +4747,7 @@
     strftime_l(buf, 100, f, &t, __loc_);
     wchar_t wbuf[100];
     wchar_t* wbb = wbuf;
-    mbstate_t mb = {0};
+    mbstate_t mb = {0,{0}};
     const char* bb = buf;
 #ifdef _LIBCPP_LOCALE__L_EXTENSIONS
     size_t j = mbsrtowcs_l( wbb, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
@@ -4883,7 +4884,7 @@
 void
 __time_get_storage<char>::init(const ctype<char>& ct)
 {
-    tm t = {0};
+    tm t = {0,0,0,0,0,0,0,0,0,0,0};
     char buf[100];
     // __weeks_
     for (int i = 0; i < 7; ++i)
@@ -4920,17 +4921,16 @@
 void
 __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
 {
-    tm t = {0};
+    tm t = {0,0,0,0,0,0,0,0,0,0,0};
     char buf[100];
-    size_t be;
     wchar_t wbuf[100];
     wchar_t* wbe;
-    mbstate_t mb = {0};
+    mbstate_t mb = {0,{0}};
     // __weeks_
     for (int i = 0; i < 7; ++i)
     {
         t.tm_wday = i;
-        be = strftime_l(buf, 100, "%A", &t, __loc_);
+        strftime_l(buf, 100, "%A", &t, __loc_);
         mb = mbstate_t();
         const char* bb = buf;
 #ifdef _LIBCPP_LOCALE__L_EXTENSIONS
@@ -4942,7 +4942,7 @@
             __throw_runtime_error("locale not supported");
         wbe = wbuf + j;
         __weeks_[i].assign(wbuf, wbe);
-        be = strftime_l(buf, 100, "%a", &t, __loc_);
+        strftime_l(buf, 100, "%a", &t, __loc_);
         mb = mbstate_t();
         bb = buf;
 #ifdef _LIBCPP_LOCALE__L_EXTENSIONS
@@ -4959,7 +4959,7 @@
     for (int i = 0; i < 12; ++i)
     {
         t.tm_mon = i;
-        be = strftime_l(buf, 100, "%B", &t, __loc_);
+        strftime_l(buf, 100, "%B", &t, __loc_);
         mb = mbstate_t();
         const char* bb = buf;
 #ifdef _LIBCPP_LOCALE__L_EXTENSIONS
@@ -4971,7 +4971,7 @@
             __throw_runtime_error("locale not supported");
         wbe = wbuf + j;
         __months_[i].assign(wbuf, wbe);
-        be = strftime_l(buf, 100, "%b", &t, __loc_);
+        strftime_l(buf, 100, "%b", &t, __loc_);
         mb = mbstate_t();
         bb = buf;
 #ifdef _LIBCPP_LOCALE__L_EXTENSIONS
@@ -4986,7 +4986,7 @@
     }
     // __am_pm_
     t.tm_hour = 1;
-    be = strftime_l(buf, 100, "%p", &t, __loc_);
+    strftime_l(buf, 100, "%p", &t, __loc_);
     mb = mbstate_t();
     const char* bb = buf;
 #ifdef _LIBCPP_LOCALE__L_EXTENSIONS
@@ -4999,7 +4999,7 @@
     wbe = wbuf + j;
     __am_pm_[0].assign(wbuf, wbe);
     t.tm_hour = 13;
-    be = strftime_l(buf, 100, "%p", &t, __loc_);
+    strftime_l(buf, 100, "%p", &t, __loc_);
     mb = mbstate_t();
     bb = buf;
 #ifdef _LIBCPP_LOCALE__L_EXTENSIONS
@@ -5279,7 +5279,7 @@
     char __nar[100];
     char* __ne = __nar + 100;
     __do_put(__nar, __ne, __tm, __fmt, __mod);
-    mbstate_t mb = {0};
+    mbstate_t mb = {0,{0}};
     const char* __nb = __nar;
 #ifdef _LIBCPP_LOCALE__L_EXTENSIONS
     size_t j = mbsrtowcs_l(__wb, &__nb, 100, &mb, __loc_);
@@ -5804,7 +5804,7 @@
         __thousands_sep_ = base::do_thousands_sep();
     __grouping_ = lc->mon_grouping;
     wchar_t wbuf[100];
-    mbstate_t mb = {0};
+    mbstate_t mb = {0,{0}};
     const char* bb = lc->currency_symbol;
 #ifdef _LIBCPP_LOCALE__L_EXTENSIONS
     size_t j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
@@ -5887,7 +5887,7 @@
         __thousands_sep_ = base::do_thousands_sep();
     __grouping_ = lc->mon_grouping;
     wchar_t wbuf[100];
-    mbstate_t mb = {0};
+    mbstate_t mb = {0,{0}};
     const char* bb = lc->int_curr_symbol;
 #ifdef _LIBCPP_LOCALE__L_EXTENSIONS
     size_t j = mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
Index: src/thread.cpp
===================================================================
--- src/thread.cpp
+++ src/thread.cpp
@@ -67,7 +67,7 @@
     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)
+    if (result < 0 || result > static_cast<long>(UINT_MAX))
         result = 0;
     return result;
 #else  // defined(CTL_HW) && defined(HW_NCPU)
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to