From 71c4857a078506ef9fe9ac7c5be83864f45784ff Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Thu, 8 Mar 2012 20:50:28 +0000 Subject: [PATCH] Enable/silence -Wsign-compare. llvm-svn: 152335 --- libcxxabi/lib/buildit | 3 ++- libcxxabi/src/cxa_demangle.cpp | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/libcxxabi/lib/buildit b/libcxxabi/lib/buildit index e6870d2707ae..9b2464a59bd1 100755 --- a/libcxxabi/lib/buildit +++ b/libcxxabi/lib/buildit @@ -29,7 +29,8 @@ fi EXTRA_FLAGS="-std=c++0x -stdlib=libc++ -fstrict-aliasing -Wstrict-aliasing=2 \ -Wsign-conversion -Wshadow -Wconversion -Wunused-variable \ - -Wmissing-field-initializers -Wnewline-eof" + -Wmissing-field-initializers -Wchar-subscripts -Wmismatched-tags \ + -Wmissing-braces -Wshorten-64-to-32 -Wsign-compare -Wnewline-eof" case $TRIPLE in *-apple-*) diff --git a/libcxxabi/src/cxa_demangle.cpp b/libcxxabi/src/cxa_demangle.cpp index 7cfd1a81e105..95a873a89a9d 100644 --- a/libcxxabi/src/cxa_demangle.cpp +++ b/libcxxabi/src/cxa_demangle.cpp @@ -42,8 +42,8 @@ public: size_t __size_; __node* __left_; __node* __right_; - long double __value_; long __cached_size_; + long double __value_; public: __node() : __name_(0), __size_(0), __left_(0), __right_(0), __cached_size_(-1) @@ -3718,7 +3718,7 @@ public: { if (__left_ == 0) { - if (__size_ < t_end - t_begin) + if (__size_ < static_cast(t_end - t_begin)) { __left_ = t_begin[__size_]; __size_ = 0; @@ -8149,7 +8149,7 @@ __demangle_tree::__parse_template_param(const char* first, const char* last) if (t == last || *t != '_') return first; ++sub; - if (sub < __t_end_ - __t_begin_) + if (sub < static_cast(__t_end_ - __t_begin_)) { if (__make<__sub>(__t_begin_[sub])) first = t+1; @@ -10078,7 +10078,7 @@ __demangle_tree::__parse_source_name(const char* first, const char* last) if (++t == last) return first; } - if (last - t >= n && __make<__source_name>(t, n)) + if (static_cast(last - t) >= n && __make<__source_name>(t, n)) first = t + n; } } @@ -10576,7 +10576,7 @@ __demangle_tree::__parse_substitution(const char* first, const char* last) if (t == last || *t != '_') return first; ++sub; - if (sub < __sub_end_ - __sub_begin_) + if (sub < static_cast(__sub_end_ - __sub_begin_)) { if (__make<__sub>(__sub_begin_[sub])) first = t+1; @@ -10809,13 +10809,13 @@ printf("\n"); const unsigned N = 4096; char tmp[N]; ptrdiff_t s; - if (est <= bs) + if (static_cast(est) <= bs) { char* e = dmg_tree.__get_demangled_name(buf); *e++ = '\0'; s = e - buf; } - else if (est <= N) + else if (static_cast(est) <= N) { char* e = dmg_tree.__get_demangled_name(tmp); *e++ = '\0'; @@ -10823,7 +10823,7 @@ printf("\n"); } else s = static_cast(dmg_tree.size() + 1); - if (s > bs) + if (static_cast(s) > bs) { buf = static_cast(realloc(buf, static_cast(s))); if (buf == NULL) @@ -10835,9 +10835,9 @@ printf("\n"); if (n) *n = static_cast(s); } - if (est > bs) + if (static_cast(est) > bs) { - if (est <= N) + if (static_cast(est) <= N) strncpy(buf, tmp, static_cast(s)); else *dmg_tree.__get_demangled_name(buf) = '\0';