From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 74180 invoked by alias); 11 Jan 2016 11:32:52 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 74166 invoked by uid 89); 11 Jan 2016 11:32:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.9 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=arm-c.c, UD:arm-c.c, armcc, fox X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 11 Jan 2016 11:32:50 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E378F3A8; Mon, 11 Jan 2016 03:32:13 -0800 (PST) Received: from [10.2.206.200] (e100706-lin.cambridge.arm.com [10.2.206.200]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1E6033F24D; Mon, 11 Jan 2016 03:32:47 -0800 (PST) Message-ID: <569392DE.1030809@foss.arm.com> Date: Mon, 11 Jan 2016 11:32:00 -0000 From: Kyrill Tkachov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Christian Bruel CC: gcc-patches@gcc.gnu.org Subject: Re: [PATCH, ARM] Fox target/69180] #pragma GCC target should not warn about redefined macros References: <568E8708.4050602@st.com> In-Reply-To: <568E8708.4050602@st.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2016-01/txt/msg00567.txt.bz2 Hi Christian, On 07/01/16 15:40, Christian Bruel wrote: > as discussed with Kyrill (https://gcc.gnu.org/ml/gcc-patches/2016-01/msg00307.html), this patch avoids confusing (for the testsuite) macro redefinition warning or pedantic errors when the user changes FP versions implicitly with a #pragma > GCC target. The warning is kept when the macro is redefined explicitly by the user. > > tested on arm-linux-gnueabi for {,-mfpu=neon-fp-armv8,-mfpu=neon} > > > Index: config/arm/arm-c.c > =================================================================== > --- config/arm/arm-c.c (revision 232101) > +++ config/arm/arm-c.c (working copy) > @@ -23,6 +23,7 @@ > #include "c-family/c-common.h" > #include "tm_p.h" > #include "c-family/c-pragma.h" > +#include "stringpool.h" > > /* Output C specific EABI object attributes. These can not be done in > arm.c because they require information from the C frontend. */ > @@ -245,8 +246,18 @@ arm_pragma_target_parse (tree args, tree > > /* Update macros. */ > gcc_assert (cur_opt->x_target_flags == target_flags); > - /* This one can be redefined by the pragma without warning. */ > - cpp_undef (parse_in, "__ARM_FP"); > + > + /* Don't warn for macros that have context sensitive values depending on > + other attributes. > + See warn_of_redefinition, Reset after cpp_create_definition. */ > + tree acond_macro = get_identifier ("__ARM_NEON_FP"); > + C_CPP_HASHNODE (acond_macro)->flags |= NODE_CONDITIONAL ; > + > + acond_macro = get_identifier ("__ARM_FP"); > + C_CPP_HASHNODE (acond_macro)->flags |= NODE_CONDITIONAL; > + > + acond_macro = get_identifier ("__ARM_FEATURE_LDREX"); > + C_CPP_HASHNODE (acond_macro)->flags |= NODE_CONDITIONAL; I see this mechanism also being used by rs6000, s390 and spu but I'm not very familiar with it. Could you please provide a short explanatino of what NODE_CONDITIONAL means? I suspec this is ok, but I'd like to get a better understanding of what's going on here. Thanks, Kyrill