From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 91366 invoked by alias); 16 Jan 2019 20:38:56 -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 91348 invoked by uid 89); 16 Jan 2019 20:38:55 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.9 required=5.0 tests=BAYES_00,GARBLED_BODY,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_SHORT,MIME_CHARSET_FARAWAY,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=H*x:iPad, H*UA:iPad X-HELO: mail-lf1-f67.google.com Received: from mail-lf1-f67.google.com (HELO mail-lf1-f67.google.com) (209.85.167.67) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 16 Jan 2019 20:38:52 +0000 Received: by mail-lf1-f67.google.com with SMTP id y11so6007732lfj.4 for ; Wed, 16 Jan 2019 12:38:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=frtk-ru.20150623.gappssmtp.com; s=20150623; h=references:in-reply-to:mime-version:content-transfer-encoding :message-id:cc:from:subject:date:to; bh=gwd6HHaoJy8qzQTbSlNu2kg3rHwgrd9QlR+paPrTyDU=; b=xoFnDJVOUsiWbqdEu5UMhqYDc1yT69PaePJ74UD6AvHapLahtfADDcbrbh20cZnRcv 1SUcD7iD5p8XhOfzhtFDLRfLnsxgt1Cdl6xAdryINO1LMym1gM6PcUy28G2/t7TWODem 5u5bZacRbD1by1E4kAml2XnAwwsAlJGlphDdz2KX+XsWoOyWbdfJMNFqsBZ5oKtEg0n5 YDHiaS8wUnRMWXfC1HgfGsF1VxpNhuuezUICbj47PWoJTAwErlT/QftoY5mR8uEYzfup XvGYJkUGRyc+Jt9TlgoiFQjRP34TeEQAWVuTR+X0QKuzsX6l1pzmNl/0CIqGRu76G2Ai ld5Q== Return-Path: Received: from [192.168.1.33] ([91.219.24.67]) by smtp.gmail.com with ESMTPSA id y11-v6sm1188366ljc.85.2019.01.16.12.38.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Jan 2019 12:38:49 -0800 (PST) References: <4943ce6216667607c40b630ecba6a4d1@polymtl.ca> In-Reply-To: <4943ce6216667607c40b630ecba6a4d1@polymtl.ca> Mime-Version: 1.0 (1.0) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=koi8-r Message-Id: <0E004E63-FE19-47E6-B6A7-C647B59F3ACB@frtk.ru> Cc: gdb-patches@sourceware.org From: Pavel Kryukov Subject: Re: [PATCH] Do not expand macros to 'defined' Date: Wed, 16 Jan 2019 20:38:00 -0000 To: Simon Marchi X-SW-Source: 2019-01/txt/msg00382.txt.bz2 > which supposedly can handle this fine Right, but not with '-Wall -Wextra -Werror' flags. These pedantic options help us (a little) keeping C++ project portable between compilers, although we do not intent to have this property on GDB i= ntegration. -- Pavel > 16 =D1=CE=D7. 2019 =C7., =D7 23:02, Simon Marchi =CE=C1=D0=C9=D3=C1=CC(=C1): >=20 >> On 2019-01-16 01:34, =F0=C1=D7=C5=CC =EB=D2=C0=CB=CF=D7 wrote: >> Expanding a macro which contains 'defined' PP keyword is UB. >> sim/common/Changelog: >> 2019-01-16 Pavel I. Kryukov >> * sim-arange.c: eliminate DEFINE_NON_INLINE_P >> --- >> sim/common/sim-arange.c | 11 +++-------- >> 1 file changed, 3 insertions(+), 8 deletions(-) >> diff --git a/sim/common/sim-arange.c b/sim/common/sim-arange.c >> index 6373b742ce8..b3488ab564a 100644 >> --- a/sim/common/sim-arange.c >> +++ b/sim/common/sim-arange.c >> @@ -32,10 +32,7 @@ along with this program. If not, see >> . */ >> #include >> #endif >> -#define DEFINE_INLINE_P (! defined (SIM_ARANGE_C_INCLUDED)) >> -#define DEFINE_NON_INLINE_P defined (SIM_ARANGE_C_INCLUDED) >> - >> -#if DEFINE_NON_INLINE_P >> +#ifdef SIM_ARANGE_C_INCLUDED >> /* Insert a range. */ >> @@ -280,9 +277,7 @@ sim_addr_range_delete (ADDR_RANGE *ar, >> address_word start, address_word end) >> build_search_tree (ar); >> } >> -#endif /* DEFINE_NON_INLINE_P */ >> - >> -#if DEFINE_INLINE_P >> +#else /* SIM_ARANGE_C_INCLUDED */ >> SIM_ARANGE_INLINE int >> sim_addr_range_hit_p (ADDR_RANGE *ar, address_word addr) >> @@ -301,4 +296,4 @@ sim_addr_range_hit_p (ADDR_RANGE *ar, address_word a= ddr) >> return 0; >> } >> -#endif /* DEFINE_INLINE_P */ >> +#endif /* SIM_ARANGE_C_INCLUDED */ >=20 > The patch LGTM, I agree these macros are not really needed. But I am con= fused, does this actually fix your c++ build? You mentioned you were using= g++ (and therefore cpp), which supposedly can handle this fine: >=20 > https://gcc.gnu.org/onlinedocs/cpp/Defined.html >=20 > If so, what did the error look like? >=20 > Simon