From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-sender-0.a4lg.com (mail-sender.a4lg.com [153.120.152.154]) by sourceware.org (Postfix) with ESMTPS id 97D4F3858CDB for ; Wed, 21 Sep 2022 06:13:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 97D4F3858CDB Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=irq.a4lg.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=irq.a4lg.com Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id EFA3A300089; Wed, 21 Sep 2022 06:13:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irq.a4lg.com; s=2017s01; t=1663740807; bh=t62Z14PS1tIFwnYxBxLlCX9dSU9cncQRj6oObE7BZRk=; h=Message-ID:Date:Mime-Version:Subject:To:References:From: In-Reply-To:Content-Type:Content-Transfer-Encoding; b=n9oZ6+QacLjm0eb2kMcpXwB+7UrTFhh7XZ/udP7YscYgf9VqoNVYf88Gp3MEqywNQ cdxmNiPan0j98nx6fWcObFMJYdBV4H65S8rLsSq92wuNAj/l3FZKN4Ux7vL6wfhwDt YzoArGF1BcuKdbfxcDtLJESXEhuisddrml1xAFyw= Message-ID: Date: Wed, 21 Sep 2022 15:13:25 +0900 Mime-Version: 1.0 Subject: Re: [PATCH 1/4] include: Add macro to ignore -Wuser-defined-warnings Content-Language: en-US To: Nick Clifton , Binutils References: <5b9e49a21f757c68951b5b37c9008e22c0fd1271.1663211419.git.research_trasio@irq.a4lg.com> <5333c388-9fc9-1a45-01da-835ad81541cc@redhat.com> From: Tsukasa OI In-Reply-To: <5333c388-9fc9-1a45-01da-835ad81541cc@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,SPF_PASS,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 2022/09/21 1:36, Nick Clifton wrote: > Hi Tsukasa, > >> +# if __has_warning ("-Wuser-defined-warnings") > > I have not seen __has_warning () before.  Is this a new feature of > recent GCCs and Clang, or am I just behind the times ? Nick, this is one of the Clang language extensions: and already used in Binutils, include/diagnostics.h:58 (latest master) # if __has_warning ("-Wenum-compare-switch") This and my new line with __has_warning are surrounded by "#if defined (__clang__)" (a Clang-only part of the code) and should not expand to a non-zero value unless: 1. __has_warning is implemented as either a Clang extension or a custom macro (I will not assume this for obvious reasons). 2. Builtin __has_warning (as I assumed above) detects given warning is implemented. __has_warning is a Clang extension but similar standard feature testing macros with arguments are defined in recent C++ versions (not usable as standard language features in Binutils, though): - __has_include (C++17 or later) - __has_cpp_attribute (C++20 or later) Thanks, Tsukasa > > Cheers >   Nick >