public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: Thomas Schwinge <thomas@codesourcery.com>
Cc: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: Re: libstdc++: Address '-Wunused-function' for 'print_raw' (was: [committed] libstdc++: Simplify print_raw function for debug assertions)
Date: Sat, 15 Oct 2022 21:26:14 +0100	[thread overview]
Message-ID: <CACb0b4=siDCHvmGpqq9HHL7QPZhWbniNu3B=PX_ST+2XHb3JnQ@mail.gmail.com> (raw)
In-Reply-To: <CACb0b4mz_gerFmVgQ689nr1GhcM7Ecc+zn=Ri7Zkibo-Yd7Ang@mail.gmail.com>

On Sat, 15 Oct 2022 at 14:30, Jonathan Wakely <jwakely@redhat.com> wrote:
>
> On Sat, 15 Oct 2022 at 11:52, Thomas Schwinge <thomas@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 :-)

Now pushed as r13-3314-g030a08c8572049

Thanks for pointing out the warning.


      reply	other threads:[~2022-10-15 20:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-14 14:36 [committed] libstdc++: Simplify print_raw function for debug assertions Jonathan Wakely
2022-10-15 10:51 ` libstdc++: Address '-Wunused-function' for 'print_raw' (was: [committed] libstdc++: Simplify print_raw function for debug assertions) Thomas Schwinge
2022-10-15 13:30   ` Jonathan Wakely
2022-10-15 20:26     ` Jonathan Wakely [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACb0b4=siDCHvmGpqq9HHL7QPZhWbniNu3B=PX_ST+2XHb3JnQ@mail.gmail.com' \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    --cc=thomas@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).