From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) by sourceware.org (Postfix) with ESMTPS id 72136399E031; Thu, 5 Aug 2021 12:10:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 72136399E031 Received: by mail-io1-xd29.google.com with SMTP id n19so6471410ioz.0; Thu, 05 Aug 2021 05:10:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=OwfcHP715a6QwSqpnWOXTKbQyC744KbCLESM98aDCJ8=; b=gdVe+ufB2bxcmjDLWQ5xoLP0Rr6k3M4JY59a8962uvzoWpfYGDBUk5p1LIlky+ORF5 2hZy/P4R2w2H6E3QZPY9EgNb0Rkek90tF16iw+pUUyNM3K3obf2tNwtfoBikqSpb4QCD edktk9jAyzt7jrt/EXoO+J+yN9VrIBc1LLmkrEwKT1mUaJyzCUjSC7CohhN5CYS9BtRs Pezqai/LZm1u6quKHOqegbU91cYpHa6whXmUno5w5HKYOf3dLz7sYK5V6wLST6t1QLP4 cTzZnV1mUnyhTDuBwNWzazsKNQ8ZFQGM6aVFc9Joo99ruTufg4h9XEEZO08ChWiIv6Vr +vKw== X-Gm-Message-State: AOAM532BOBJCKxqiaMZkP7ygXAJzqnKaRLPnMMuggc+Ob0xSvjmym0ih VluG4tkwFG0rmRE+QZYcFganzPKNxQmDPJb4yJM= X-Google-Smtp-Source: ABdhPJwgfKMUUzxkAUKkP0h/qOdtB1eadeeTnckb5sQgHMUg0ibkn9vgs9OOhVmclBh/LKY9Tdhlc9hLz6x1hvDcOCE= X-Received: by 2002:a6b:7012:: with SMTP id l18mr70281ioc.44.1628165402961; Thu, 05 Aug 2021 05:10:02 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Christophe Lyon Date: Thu, 5 Aug 2021 14:09:52 +0200 Message-ID: Subject: Re: [committed 2/2] libstdc++: Add [[nodiscard]] to sequence containers To: Jonathan Wakely Cc: libstdc++@gcc.gnu.org, GCC Patches X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 12:10:05 -0000 Hi Jonathan, On Wed, Aug 4, 2021 at 2:04 PM Jonathan Wakely via Gcc-patches < gcc-patches@gcc.gnu.org> wrote: > On 04/08/21 12:56 +0100, Jonathan Wakely wrote: > >... and container adaptors. > > > >This adds the [[nodiscard]] attribute to functions with no side-effects > >for the sequence containers and their iterators, and the debug versions > >of those containers, and the container adaptors, > > I don't plan to add any more [[nodiscard]] attributes for now, but > these two commits should demonstrate how to do it for anybody who > wants to contribute similar patches. > > I didn't add tests that verify we do actually warn on each of those > functions, because there are hundreds of them, and I know they're > working because I had to alter existing tests to not warn. > > I've noticed a regression on aarch64/arm: FAIL: g++.old-deja/g++.other/inline7.C -std=gnu++17 (test for excess errors) Excess errors: /gcc/testsuite/g++.old-deja/g++.other/inline7.C:11:11: warning: ignoring return value of 'std::__cxx11::list<_Tp, _Alloc>::size_type std::__cxx11::list<_Tp, _Alloc>::size() const [with _Tp = int*; _Alloc = std::allocator; std::__cxx11::list<_Tp, _Alloc>::size_type = long unsigned int]', declared with attribute 'nodiscard' [-Wunused-result] FAIL: g++.old-deja/g++.other/inline7.C -std=gnu++2a (test for excess errors) Excess errors: /gcc/testsuite/g++.old-deja/g++.other/inline7.C:11:11: warning: ignoring return value of 'std::__cxx11::list<_Tp, _Alloc>::size_type std::__cxx11::list<_Tp, _Alloc>::size() const [with _Tp = int*; _Alloc = std::allocator; std::__cxx11::list<_Tp, _Alloc>::size_type = long unsigned int]', declared with attribute 'nodiscard' [-Wunused-result] Not sure why you didn't see it? Christophe