Tested x86_64-pc-linux-gnu, OK for trunk?

-- 8< --

-Wsign-compare complained about these comparisons between (unsigned) size_t
and (signed) streamsize, or between (unsigned) native_handle_type
and (signed) -1.  Fixed by adding casts to unify the types.

libstdc++-v3/ChangeLog:

        * include/std/istream: Add cast to avoid -Wsign-compare.
        * include/std/stacktrace: Likewise.
---
 libstdc++-v3/include/std/istream    | 2 +-
 libstdc++-v3/include/std/stacktrace | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/include/std/istream b/libstdc++-v3/include/std/istream
index a2b207dae78..730e413c290 100644
--- a/libstdc++-v3/include/std/istream
+++ b/libstdc++-v3/include/std/istream
@@ -909,7 +909,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
          __n /= sizeof(_CharT);
          streamsize __w = __in.width();
          std::__istream_extract(__in, __s, __n);
-         if (__in.good() && (__w <= 0 || __n < __w))
+         if (__in.good() && (__w <= 0 || __n < (size_t)__w))
            {
              // Stopped extracting early to avoid overflowing the buffer,
              // but might have stopped anyway (and set eofbit) if at EOF.
diff --git a/libstdc++-v3/include/std/stacktrace 
b/libstdc++-v3/include/std/stacktrace
index e0a543920bc..cd2606257fe 100644
--- a/libstdc++-v3/include/std/stacktrace
+++ b/libstdc++-v3/include/std/stacktrace
@@ -80,7 +80,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     constexpr native_handle_type
     native_handle() const noexcept { return _M_pc; }
 
-    constexpr explicit operator bool() const noexcept { return _M_pc != -1; }
+    constexpr explicit operator bool() const noexcept
+    { return _M_pc != (native_handle_type)-1; }
 
     // [stacktrace.entry.query], query
     [[nodiscard]]

base-commit: 7f4f1bb29a47fbe63a15dda8acfe247b2e934959
-- 
2.46.0

Reply via email to