smeenai created this revision. smeenai added reviewers: EricWF, mclow.lists. Herald added a subscriber: cfe-commits.
clang 6 has a new diagnostic -Wtautological-constant-compare, which fires for the code in question when int and long have the same size (for example, when compiling for a 32-bit target, or for Windows 64-bit). The warning is somewhat bogus here, since the code is only tautological on Repository: rCXX libc++ https://reviews.llvm.org/D41368 Files: include/istream src/string.cpp Index: src/string.cpp =================================================================== --- src/string.cpp +++ src/string.cpp @@ -80,6 +80,11 @@ V as_integer(const string& func, const S& s, size_t* idx, int base); +#if __clang_major__ >= 6 +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wtautological-constant-compare" +#endif + // string template<> inline @@ -93,6 +98,10 @@ return static_cast<int>(r); } +#if __clang_major__ >= 6 +#pragma clang diagnostic pop +#endif + template<> inline long @@ -125,6 +134,11 @@ return as_integer_helper<unsigned long long>( func, s, idx, base, strtoull ); } +#if __clang_major__ >= 6 +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wtautological-constant-compare" +#endif + // wstring template<> inline @@ -138,6 +152,10 @@ return static_cast<int>(r); } +#if __clang_major__ >= 6 +#pragma clang diagnostic pop +#endif + template<> inline long Index: include/istream =================================================================== --- include/istream +++ include/istream @@ -695,6 +695,11 @@ return *this; } +#if __clang_major__ >= 6 +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wtautological-constant-compare" +#endif + template <class _CharT, class _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(int& __n) @@ -735,6 +740,10 @@ return *this; } +#if __clang_major__ >= 6 +#pragma clang diagnostic pop +#endif // __clang__ + template<class _CharT, class _Traits> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, _CharT* __s)
Index: src/string.cpp =================================================================== --- src/string.cpp +++ src/string.cpp @@ -80,6 +80,11 @@ V as_integer(const string& func, const S& s, size_t* idx, int base); +#if __clang_major__ >= 6 +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wtautological-constant-compare" +#endif + // string template<> inline @@ -93,6 +98,10 @@ return static_cast<int>(r); } +#if __clang_major__ >= 6 +#pragma clang diagnostic pop +#endif + template<> inline long @@ -125,6 +134,11 @@ return as_integer_helper<unsigned long long>( func, s, idx, base, strtoull ); } +#if __clang_major__ >= 6 +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wtautological-constant-compare" +#endif + // wstring template<> inline @@ -138,6 +152,10 @@ return static_cast<int>(r); } +#if __clang_major__ >= 6 +#pragma clang diagnostic pop +#endif + template<> inline long Index: include/istream =================================================================== --- include/istream +++ include/istream @@ -695,6 +695,11 @@ return *this; } +#if __clang_major__ >= 6 +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wtautological-constant-compare" +#endif + template <class _CharT, class _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(int& __n) @@ -735,6 +740,10 @@ return *this; } +#if __clang_major__ >= 6 +#pragma clang diagnostic pop +#endif // __clang__ + template<class _CharT, class _Traits> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, _CharT* __s)
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits