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.133.124]) by sourceware.org (Postfix) with ESMTPS id D29693858C53 for ; Sat, 15 Oct 2022 13:30:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D29693858C53 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=1665840623; 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=W7epG3mBk1DabCvkyo5AwlGdthQfYRoSmxJ62GIpC/Y=; b=TULzIDojxk3NyrMX/dm4xqCVPn1sR7X6QLicWK4oCZj17+LFnEE8tv6JeJBH96USrpUrYz yWY41AsgaMGSupcaFXNoRRwfs1XaB88ixhUwgLlhppFIek7T3dxFGQRkiM4i51JQVwi83w G01SsQ3iMIivgoFSD2pQbAVIfXLD4jg= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-548-anfpozNXMEaQCfxYEryovQ-1; Sat, 15 Oct 2022 09:30:21 -0400 X-MC-Unique: anfpozNXMEaQCfxYEryovQ-1 Received: by mail-qt1-f200.google.com with SMTP id n11-20020ac8674b000000b0039c9e248175so5521232qtp.14 for ; Sat, 15 Oct 2022 06:30:21 -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=W7epG3mBk1DabCvkyo5AwlGdthQfYRoSmxJ62GIpC/Y=; b=KsE6DPO7mvp5+/2/nZcccoyj6soA/E4A9ZsTuV0BZ+QPzllQD4I+IqeRtUl7dGepoO 1MGoTYRWyR8B9MBU6ugwduUGb5qkJ1V6BA0YxyT/Ra+bc3wz37FXtXW8wpoBQz3yLqh8 f2Pfibo0txACUR1aj5TCdPK6S93vchdI1Uckk35oXe53AOg2wkJNS5kw2PQ5NN6uDvYU eKzfuIUOQhMqoD77l5/2DymHVGFKRlnBd3uOzDfZvPw4lZWdGCv5iQVWgVdYgcLJBnQU sDNotOy1NfrufLNVCSrzxITeQAdEk4YrJSb3pg4hFqwsyo1xChr5zH0HR1jz9mcp9T7e MRMA== X-Gm-Message-State: ACrzQf2TNtXXUK+Gbl04RGTk2RDWiy7Z1fbZu4nCsu5fFctDWr44Bf72 xkpR7wvFFA1wyMQKiYdyz76DJwvyGbZtrmZNN+9cjN1IGYMtrAzcBC61vyrtWpJyphpjfnzW76Q 2KfFSNrhNsNW/TBn25x/Ph16XH+J+YKw= X-Received: by 2002:a05:620a:15b9:b0:6ee:7839:8dff with SMTP id f25-20020a05620a15b900b006ee78398dffmr1721869qkk.245.1665840621297; Sat, 15 Oct 2022 06:30:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM53vEBuSWINxn+lVa+MQa/3r9eJ7soM8CJn6xqBaSbrcE14xT7T/W5kZZXIRSCIP92IQpTb8E6N+yXlf5s9ogc= X-Received: by 2002:a05:620a:15b9:b0:6ee:7839:8dff with SMTP id f25-20020a05620a15b900b006ee78398dffmr1721848qkk.245.1665840621050; Sat, 15 Oct 2022 06:30:21 -0700 (PDT) MIME-Version: 1.0 References: <20221014143602.2512815-1-jwakely@redhat.com> <87sfjps6kf.fsf@euler.schwinge.homeip.net> In-Reply-To: <87sfjps6kf.fsf@euler.schwinge.homeip.net> From: Jonathan Wakely Date: Sat, 15 Oct 2022 14:30:10 +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=-6.1 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=ham 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 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 :-)