From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 01E983858280 for ; Sat, 15 Oct 2022 20:26:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 01E983858280 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665865587; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=epd6W8ZRSCzS1iHzD2Ywe0KhAGX4uMHrdR+ihO2giB0=; b=Fa4vafOz3YRJ9ZLaSWgBKpXX7EL0H1rAm3gAdM/9fZd7wXfz6kyJ1Tdn8lzGwHemgpRNC2 rSD0t8LGbxSk7mzqdvamRq3WkmNJ5SRiTtD2nuBlkLqiiGKdb3OUA6RrDXXkipstU46E7S 5ho8SmXlYJJgMCHJhBfhfAyiqSDpTm8= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-275-TUWxtkq6MbiCPhfLJAQqag-1; Sat, 15 Oct 2022 16:26:26 -0400 X-MC-Unique: TUWxtkq6MbiCPhfLJAQqag-1 Received: by mail-qk1-f197.google.com with SMTP id j13-20020a05620a288d00b006be7b2a758fso6213496qkp.1 for ; Sat, 15 Oct 2022 13:26:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=epd6W8ZRSCzS1iHzD2Ywe0KhAGX4uMHrdR+ihO2giB0=; b=2N4pPoXcKvAF26OX2W9G3vj8PeCcuzhtBkYLOgP4bhrmhNGlE1TK1Yr+2ILqp/79QJ MyPMQO+0+A9/LoznkGgKp8dotGpU2gyCAhCToWKaMr/rai4WD0eEXT0/wSZGysczCkJQ 4KzT8SyoFgCYxQ0rVWa9qBoCK0J4p+nQPIu+9SZYjWwqpsZkCtB+PbgxH+5aNLiVwIdq xyHIcG5HYPSUg2nBDkGFuEjPPUEQK6u7Ggv8Or5k5j2BlXqRHYacyIoyVZd7parC4Ah8 sI4RBTYz+qvy7Vs05p1qOrTOcXDAyiiTAwcOvMFVqwfm38/Th3psNaL1EO50lqgTUOil /7zQ== X-Gm-Message-State: ACrzQf2gC+mEvDPGQi/kcq0PbtYMf0bF5jf5dAtH5CadgvAHY+A6NWql MKzr/ymxYuNMQiHc+ryhwWab/o5hq29xgkA0yWonnUGX+ic1c6Ga+grpjwa8+R0wf7+FdSHcCa/ RdTI8QtTndxglZSA361r5Rk1/OIChDrI= X-Received: by 2002:a05:620a:13f2:b0:6ec:597f:eda6 with SMTP id h18-20020a05620a13f200b006ec597feda6mr2863531qkl.287.1665865586000; Sat, 15 Oct 2022 13:26:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Ljww4i+HIxcXd+rePjWN8T6h++OyrIQ/q+mkmxD8b1uXm7qKaJe8vpyNcnQwAWLZM19jKxW61cuBBlWJyCyc= X-Received: by 2002:a05:620a:13f2:b0:6ec:597f:eda6 with SMTP id h18-20020a05620a13f200b006ec597feda6mr2863524qkl.287.1665865585777; Sat, 15 Oct 2022 13:26:25 -0700 (PDT) MIME-Version: 1.0 References: <20221014143602.2512815-1-jwakely@redhat.com> <87sfjps6kf.fsf@euler.schwinge.homeip.net> In-Reply-To: From: Jonathan Wakely Date: Sat, 15 Oct 2022 21:26:14 +0100 Message-ID: Subject: Re: libstdc++: Address '-Wunused-function' for 'print_raw' (was: [committed] libstdc++: Simplify print_raw function for debug assertions) To: Thomas Schwinge Cc: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Sat, 15 Oct 2022 at 14:30, Jonathan Wakely wrote: > > On Sat, 15 Oct 2022 at 11:52, Thomas Schwinge wrote: > > > > Hi! > > > > On 2022-10-14T15:36:02+0100, Jonathan Wakely via Gcc-patches 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.