From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22991 invoked by alias); 22 Jun 2017 07:44:34 -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 22978 invoked by uid 89); 22 Jun 2017 07:44:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=HContent-Transfer-Encoding:8bit X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 22 Jun 2017 07:44:30 +0000 Received: by simark.ca (Postfix, from userid 33) id 3D2011E4E8; Thu, 22 Jun 2017 03:44:28 -0400 (EDT) To: Pedro Alves Subject: Re: [PATCH 1/4] environ-selftests: Ignore -Wself-move warning X-PHP-Originating-Script: 33:rcube.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Thu, 22 Jun 2017 07:44:00 -0000 From: Simon Marchi Cc: Sergio Durigan Junior , Simon Marchi , gdb-patches@sourceware.org In-Reply-To: References: <1498076108-29914-1-git-send-email-simon.marchi@ericsson.com> <1498076108-29914-2-git-send-email-simon.marchi@ericsson.com> <87mv91ccey.fsf@sergiodj.net> <884719ed975085085337b2972a9c2ac4@polymtl.ca> Message-ID: <1eb85c254f6948eb4a1c79462f0d98ab@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.2.5 X-IsSubscribed: yes X-SW-Source: 2017-06/txt/msg00621.txt.bz2 On 2017-06-21 23:28, Pedro Alves wrote: > On 06/21/2017 10:05 PM, Simon Marchi wrote: > >> Yeah, I didn't expect to have to put the #ifdefs for __clang__ though. >> Without them, gcc emits a warning [-Wunknown-pragma]. We always have >> the option to turn -Wunknown-pragma off globally, what do you prefer? >> > > Don't both GCC and Clang understand "#pragma GCC diagnostic" instead? Yes, but then it's GCC that complains that it doesn't know the warning: /home/emaisin/src/binutils-gdb/gdb/unittests/environ-selftests.c:141:32: error: unknown option after ‘#pragma GCC diagnostic’ kind [-Werror=pragmas] #pragma GCC diagnostic ignored "-Wself-move" ^ > Or better even, wrap it in some macros (and use _Pragma): > > #define DIAGNOSTIC_PUSH _Pragma ("GCC diagnostic push") > #define DIAGNOSTIC_POP _Pragma ("GCC diagnostic pop") > #define DIAGNOSTIC_IGNORE(option) \ > _Pragma (STRINGIFY (GCC diagnostic ignored option)) Oh that's interesting. The gcc doc said that _Pragma was added exactly for this purpose (to be usable in macros). I'll try that. > Alternatively, you could replace the std::move with a cast > to rvalue ref, which is just what std::move really is: > > -env = std::move (env); > +env = static_cast (env); I guess that with a comment explaining why we use that it would be ok, but that would not be my first choice either. Thanks, Simon