From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 88999 invoked by alias); 22 Jun 2017 09:34:57 -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 88660 invoked by uid 89); 22 Jun 2017 09:34:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= 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 Jun 2017 09:34:49 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 13AF241A29; Thu, 22 Jun 2017 09:34:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 13AF241A29 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=palves@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 13AF241A29 Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5F8E860602; Thu, 22 Jun 2017 09:34:44 +0000 (UTC) Subject: Re: [PATCH 1/4] environ-selftests: Ignore -Wself-move warning To: Simon Marchi 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> <1eb85c254f6948eb4a1c79462f0d98ab@polymtl.ca> Cc: Sergio Durigan Junior , Simon Marchi , gdb-patches@sourceware.org From: Pedro Alves Message-ID: <4f10c70b-c02a-98cb-3ad8-8fc9432340b3@redhat.com> Date: Thu, 22 Jun 2017 09:34: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: <1eb85c254f6948eb4a1c79462f0d98ab@polymtl.ca> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-SW-Source: 2017-06/txt/msg00625.txt.bz2 On 06/22/2017 08:44 AM, Simon Marchi wrote: > 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" > ^ > Ah, but that's a different kind of complaint. Since both compilers understand "#pragma GCC" but only one understands "#pragma clang", then it seems clearly better to me to write the infrastructure macros in terms of the former. It'll make it a bit easier to reuse the macros for other warnings. >> 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. Right. Thanks, Pedro Alves