From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 111172 invoked by alias); 22 Dec 2016 15:09:24 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 111136 invoked by uid 89); 22 Dec 2016 15:09:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.0 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Meanwhile, H*f:sk:874m1w6, H*MI:sk:874m1w6, H*i:sk:874m1w6 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 22 Dec 2016 15:09:12 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BEB2C7EBAA; Thu, 22 Dec 2016 15:09:11 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.phx2.redhat.com [10.5.9.4]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uBMF9Atj010367; Thu, 22 Dec 2016 10:09:11 -0500 Subject: Re: [RFA 7/8] Use unique_xmalloc_ptr in execute_gdb_command To: Tom Tromey References: <1480395946-10924-1-git-send-email-tom@tromey.com> <1480395946-10924-8-git-send-email-tom@tromey.com> <878ts2yi5m.fsf@tromey.com> <87inqletsw.fsf@tromey.com> <7f11b7bb-bebb-1cd3-1e92-266638272443@redhat.com> <87vaueuqoh.fsf@tromey.com> <819d6d1b-1afb-277c-3bf4-e8cc5884ac43@redhat.com> <874m1w6mt0.fsf@tromey.com> Cc: gdb-patches@sourceware.org From: Pedro Alves Message-ID: <2061e336-0e17-fd9a-b746-61f6fa788beb@redhat.com> Date: Thu, 22 Dec 2016 15:09:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <874m1w6mt0.fsf@tromey.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2016-12/txt/msg00373.txt.bz2 On 12/22/2016 02:49 PM, Tom Tromey wrote: >>>>>> "Pedro" == Pedro Alves writes: > > Tom> Probably this should use __attribute__((warn_unused_result)), but that > Tom> isn't wrapped in ansidecl.h (yet) and I don't know offhand what version > Tom> test to use for it. Do you? > > Pedro> Good idea. Looks like it's GCC 3.4. > > This turns out not to work :( > > FWIW in addition to the ATTRIBUTE_WARN_UNUSED_RESULT patch, I also had > to patch gdb's configure script to add -Wunused-result, as -Wunused > turns this off. > Bummer. :-( > The g++ bug is known: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38172 > > It looks like the accepted fix upstream to use the C++17 [[nodiscard]] > attribute; not sure if we can use that somehow. Can't see why not, if we put it behind some ATTRIBUTE_NODISCARD or some such define. Sounds like with that we could put the attribute in the scoped_restore_impl template itself ('struct [[nodiscard]] foo'), and get the warning for all similar make_foo_scoped_restore-like functions for free. > > Meanwhile I'm going to drop this part of my patch. That's fine, we can always add it later. Thanks much for experimenting. Thanks, Pedro Alves