On Sat, 15 Oct 2022 at 11:52, Thomas Schwinge <tho...@codesourcery.com> wrote:
>
> Hi!
>
> On 2022-10-14T15:36:02+0100, Jonathan Wakely via Gcc-patches 
> <gcc-patches@gcc.gnu.org> wrote:
> > Tested powerpc64le-linux. Pushed to trunk.
> >
> > -- >8 --
> >
> > Replace two uses of print_raw where it's clearer to just use fprintf
> > directly. Then the only remaining use of print_raw is as the print_func
> > argument of pretty_print.
>
> OK to push the attached
> "libstdc++: Address '-Wunused-function' for 'print_raw'",
> or should this be addressed differently?

Oh yes, I didn't notice it's only used within the conditional block,
because I only tested with stacktrace enabled.

I think it would be a little better to move print_raw down to where
it's actually needed:

--- a/libstdc++-v3/src/c++11/debug.cc
+++ b/libstdc++-v3/src/c++11/debug.cc
@@ -609,14 +609,6 @@ namespace
    print_literal(PrintContext& ctx, const char(&word)[Length])
    { print_word(ctx, word, Length - 1); }

-  void
-  print_raw(PrintContext& ctx, const char* str, ptrdiff_t nbc)
-  {
-    if (nbc == -1)
-      nbc = INT_MAX;
-    ctx._M_column += fprintf(stderr, "%.*s", (int)nbc, str);
-  }
-
  void
  print_word(PrintContext& ctx, const char* word, ptrdiff_t nbc = -1)
  {
@@ -1092,6 +1084,14 @@ namespace
  { print_string(ctx, str, nbc, nullptr, 0); }

#if _GLIBCXX_HAVE_STACKTRACE
+  void
+  print_raw(PrintContext& ctx, const char* str, ptrdiff_t nbc)
+  {
+    if (nbc == -1)
+      nbc = INT_MAX;
+    ctx._M_column += fprintf(stderr, "%.*s", (int)nbc, str);
+  }
+
  int
  print_backtrace(void* data, __UINTPTR_TYPE__ pc, const char* filename,
                 int lineno, const char* function)


I'll push that later today, or feel free to do it yourself if you want
the warning to go away :-)

Reply via email to