From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by sourceware.org (Postfix) with ESMTPS id F03B43857C4C for ; Wed, 2 Nov 2022 10:52:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F03B43857C4C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linuxfoundation.org Received: by mail-wr1-x42a.google.com with SMTP id j15so23929974wrq.3 for ; Wed, 02 Nov 2022 03:52:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=pymfF9pvqb+CrZN3+hIWQAoLCdkqPaYIs3xt+bLYS9w=; b=Q6nS5exANHwpJfPiuiOvCymcqg0/876wfhp/tUrHeEYJFamHvM8a8DfeEwynr0XjDw KWwYql8MNOVHhQAqeQBTuw3BqBbJuzqdZbgssRdG0bJ7QWGxKr8n6H50oX1AiRKlWoZC G18pFLlW5KqxWLpgRp9hkWxj5lZdep3bszxLY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=pymfF9pvqb+CrZN3+hIWQAoLCdkqPaYIs3xt+bLYS9w=; b=kLZhtPrrWQs5imTkJPwj3XGbRPCnVX6cppzxvWIAQ5J5EeoWABdhNk0P+GXhz2PkNl 1ObEceo91+cMEYz0NrtA09zNlJDNGCmJCBDi90sorul58rFvGGjrMwpM9jWnDF2VoKTB Hm+uu6JXfEe/RmIY/ODW65OtCs9L/9IlazPMCjISwEqXOfTMgLYeK0BoIyQvC0HiysR3 OaJO1OqhEB5UhCkKSCQSjD8XVpmE4IVOJi9DPomRzZooAf00OhTpS9XyVOmeabv/cJ3T vQV9isrnhpsV7xgvmArhTUJBohK7wdbtt7xPp7bLUJ592N6Rp7b12tX24L3UTDyFXt1P /6Rg== X-Gm-Message-State: ACrzQf061tllUpJUjw3g7XLMXVwqxkvwMqSOVMx7QudT6UOxb5kEdHQw a771oIYawFXYJdZBjEMJayHoXw== X-Google-Smtp-Source: AMsMyM6fAp9iiPtSjzxj9bHz9fjcISsqnm8nyC6cQliEl2DIDVw6kEKQByK9xqBO1iJxubO1D0Pk+Q== X-Received: by 2002:a05:6000:15cd:b0:236:9701:7bad with SMTP id y13-20020a05600015cd00b0023697017badmr14401545wry.679.1667386362691; Wed, 02 Nov 2022 03:52:42 -0700 (PDT) Received: from ?IPv6:2001:8b0:aba:5f3c:b8b1:19d6:e9d8:a61a? ([2001:8b0:aba:5f3c:b8b1:19d6:e9d8:a61a]) by smtp.gmail.com with ESMTPSA id u13-20020a056000038d00b00236c1f2cecesm12180910wrf.81.2022.11.02.03.52.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Nov 2022 03:52:41 -0700 (PDT) Message-ID: <90f05d0e7dc209b554431ab56ec6aab92ae6f5c6.camel@linuxfoundation.org> Subject: Re: [PATCH 2/2] libcpp: Avoid remapping filenames within directives From: Richard Purdie To: Jeff Law , gcc-patches@gcc.gnu.org Date: Wed, 02 Nov 2022 10:52:41 +0000 In-Reply-To: References: <20220817121534.1825108-1-richard.purdie@linuxfoundation.org> <20220817121534.1825108-2-richard.purdie@linuxfoundation.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4-0ubuntu1 MIME-Version: 1.0 X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,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 Tue, 2022-11-01 at 13:32 -0600, Jeff Law wrote: > On 8/17/22 06:15, Richard Purdie via Gcc-patches wrote: > > Code such as: > #include __FILE__ > >=20 > > can interact poorly with file-prefix-map options when cross compiling. = In > > general you're after to remap filenames for use in target context but t= he > > local paths should be used to find include files at compile time. Ingor= ing > > filename remapping for directives is one way to avoid such failures. > >=20 > > libcpp/ChangeLog: > >=20 > > * macro.cc (_cpp_builtin_macro_text): Don't remap filenames within= directives >=20 > So I went back and reviewed the old PR which introduced this code.=C2=A0 = It=20 > was actually the Yocto project that got this code in to begin with :-) Thanks for the review! That sounds right, we use it heavily and originally had a few issues in this area. It now generally works really well, we just found this corner case :) =C2=A0=20 > There wasn't really any discussion AFAICT about whether or not to remap= =20 > in directives that I saw in the PR. I don't think we'd realised there was this corner case. Now we have found code doing it, I think the behaviour we should have is fairly clear which is why we're sending the patch. > ISTM that given the change in behavior, we should probably document that= =20 > we don't remap in directives.=C2=A0 Probably doc/invoke.texi. >=20 > With suitable documentation, this should be fine.=C2=A0 It seems like it= =20 > ought to be independent of the first patch in this series which adds=20 > support for remapping relative paths. Thanks for merging 1/2, it was independent, just related as a path mapping issue we found. I'll keep the coding style in mind in future. I've sent a new version of this patch which updates doc/invoke.texi, just adding to file-prefix-map as the others all reference it. Cheers, Richard