From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 17806 invoked from network); 2 Mar 2023 08:25:33 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 2 Mar 2023 08:25:33 -0000 Received: (qmail 7663 invoked by uid 550); 2 Mar 2023 08:25:29 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 7631 invoked from network); 2 Mar 2023 08:25:28 -0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c6mY2JFH63K5lnx9VZwHb6/44pPJGISZBqJ9BJPxFyJdFiJu3lTgKIRc5ViyA0IQyVTCUAy7vXmj+Z3eQfC3KibggXs1ZDRiYFWH1XLVg3dhqxLSufdAEpMQNa8nje/yYwka7zasjed5VpjgzUt142aWQt4kpHXzwqw+hTkj2orejmdxz69kUt00ffb8sYb277i2yoKTu0LVd8h4eKecoQaj4QuA3KPGa6ppUuo3Hy6bfjoaXQnzh59OFDTYcsFVxcEiaFrz1bHeiY6tl0kf2pJV4phTC5D4bWx932oUzFfDcA08lQQfgfrLIk82uiGjn6qFp53d1hKNWjmjFMZSUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NTpFf4b8Z2mULmwDbcQK1D+JV5IX5pUP9kaKW25gIFI=; b=AWOdBjzACFFpYYk7dVvrET6cY4KpzNdY1xHHUNcUMPRDPNBZtl2Z5vcMKDwYY+4BbwWkT0OdXttkSdv40L/xANVBr4Ef7CeVkKTnFbt+DpGR8xCo4NSoiqR2d9M40dL4G3B8DU01xX0Nm9ZJrCxJcs0FiCd59QJCbWVPxrDFvTLjiCKJY+mkArhVmsLBh+RJlP/MZnhfPuQR3i+opeMuONdigSiydFiPa44P9sbL6DWTATHNE3O81EDZUMRK7nsg9KB36/+cKc7mfWgm6wFqM2te++JweIsBzz2js+jRM/gb6RNzvDy+gjSQpt+ahxhLlMRKLGR+dRDQ2AxecLBuQw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none X-Gm-Message-State: AO0yUKU+3Oj7yFI/aMpRTsX7HTIbq1swtQzMm1HBVy9y8Em5a1/szyLE +Tpy7SM8gGA+YH+eZCFj9LyAr7zYldGIAZji4BY= X-Google-Smtp-Source: AK7set+7cPQDBnwZLWnw9t9ZhnDbrL6/cU+cI0x3cZfy5AUgij4XdYrI/HPo6C5fOlxryAEj0XY3TdqfsK45bSXagM8= X-Received: by 2002:a17:902:7149:b0:19a:7e00:da70 with SMTP id u9-20020a170902714900b0019a7e00da70mr3449698plm.12.1677745155886; Thu, 02 Mar 2023 00:19:15 -0800 (PST) References: <20230218013333.844224-1-i@maskray.me> <20230218020320.GA4163@brightrain.aerifal.cx> <20230227222653.GI726682@port70.net> In-Reply-To: <20230227222653.GI726682@port70.net> From: Fangrui Song Date: Thu, 2 Mar 2023 00:19:04 -0800 X-Gmail-Original-Message-ID: Message-ID: To: musl@lists.openwall.com, lichray@gmail.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-TMN: [w0vn27WN5qlZWcMtOM286MEbe+2DiDyU] X-ClientProxiedBy: BN0PR04CA0041.namprd04.prod.outlook.com (2603:10b6:408:e8::16) To DS7PR12MB5765.namprd12.prod.outlook.com (2603:10b6:8:74::19) X-Microsoft-Original-Message-ID: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR12MB5765:EE_|MW4PR12MB7015:EE_ X-MS-Office365-Filtering-Correlation-Id: ded598a9-a5d7-4678-fedf-08db1af7a5f5 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DjE2hhcB/pMjscf8lKQFItDbM8+ZdiQccnkw78pZZL2aeXJM7w7BMhLNiOIdV62ZL3vDwDb5yXgWfmvVbv/qBdMfvGNOeKBct3ZRxuv6Lc4PKBJubFWA2keF5jjWd9BB/PuF/RYNB+BFy96+9SR68/OjjpI0yS3QVvX2C84F+Qs6h4X2cAki3sqCcZE27aFzo3Qz4Hn5wjMIJGr3E3ECJGQkfZbBA32ZvIgM7TT2qb3wxypNTvAyH4YISw8Bi3FrAX+DgG8fIZPHUyIrIWAXXzAu+bF0DBX93iACETAWEzjjisSMlKS+8rRrWLErnZ8TkL8gcqpVDLkRxvOsq6uDg4t9tW9Xe54I98OOPmKw9gUy6JxDVwxSR7UrnJH9zxmj//hLcYPj8CxVHVbOIHI1shKQgfbnB2Wyn7b1XSI9xlOPMQhcB2srGpG8JqWvoecT8IMzlF0tSA2hPIsalOFjOM+zgU7CxTUhiRU2cNllEQo5ilzSLu3FzzG4NKjM5gL8NljNYwKKGBy2Cn6i/fUE1bu1CMaIL2dhk3FlDalrdUldzAB3Uqvudsr7Wpb8mmJlCzGFzMRHD77KSO0/utWA/w5iSzG6wVMCMJjLCNmjtCyEMsHvS5+EzRr5jAGEgX8FroVEI3nqVjMQkfd7U1EGgA== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?WTBZMW4vaGptUDY2K29aYzdjV1Bqd3NrOVJlWDNJcjVLTnRKQjJ3OWZWTVBY?= =?utf-8?B?Ly93RC9nUnJ0cllHRXc1UW11OGptbE1QWmQ3ZWFpWlFZYWw1NE95NTFTSmtJ?= =?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E?= =?utf-8?B?bktUWlpoMXFDL3grTjFPNld0WFdQZzZXYVNGb2x1UldnRWxrZTZqTEl4dmw0?= =?utf-8?B?d0FZUlRDOURLd2VLWWI4WXdyYjJqUHYrUStFTVhYTGNMVFg5b1luZUJzZDR4?= =?utf-8?B?TWxjL1NiRjBQM3ltcE9mTCs0L3E3L0Q1Q3ZqSDRjNy9LaTFBbGx2UDhFaCtv?= =?utf-8?B?czlveU9OSmZjRWE5cTBzNGF5MEdJckc3ZVFMUlFoc2p0MjJvVmJMaE5tWVY3?= =?utf-8?B?Yy82TUl2T0VQckdSYXlmTHVSVlIwZDc3REFBQzBjaXh2QWZxei9CQjhidWNn?= =?utf-8?B?YnRqd1BnMjBVT1FjSGVNb2dWSDYxdmRZdTRidXUrS0p2K3c1UjJVSEs4Uk0w?= =?utf-8?B?TnZVRzUwOUx6Uk1GUFNxUU9MbDJYbnlwcHJmd2RwRVhOOUNBQlRwUUJyRkp3?= =?utf-8?B?TTIwSVdaR1pZNFpCRTNQMThWOGVBN2ExbDczR2NyTjBmc0lrNFRzMnlZQ3lY?= =?utf-8?B?YTluZHQ2U242d3VNSWhvYkZPb2NtKzY5dnZjOE9vWkgzZUhmZm5Bc2dDZmVw?= =?utf-8?B?clF6Y09aakIvUEo1N1E5YVVUZGg1eitCMFdBWXZFQ2dhdWlQZ2dXMENMelpG?= =?utf-8?B?TmcwbVlmcSt5VkVwdHVHWWxaMEY5aVZTSTBFMWtQak83a2Y2WFVaVnY3MHV3?= =?utf-8?Q?CB/apA/yhqRRkQwDKo8+?= X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-71ea3.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: ded598a9-a5d7-4678-fedf-08db1af7a5f5 X-MS-Exchange-CrossTenant-AuthSource: DS7PR12MB5765.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2023 08:25:14.9177 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7015 Subject: Re: [musl] [PATCH] Use __builtin_FILE/__builtin_LINE if available On Mon, Feb 27, 2023 at 2:27=E2=80=AFPM Szabolcs Nagy wrot= e: > > * Fangrui Song [2023-02-21 11:09:14 -0800]: > > > On Sat, Feb 18, 2023 at 4:17 AM Jon Chesterfield > > wrote: > > > > > > On Sat, 18 Feb 2023, 02:54 Fangrui Song, wrote: > > > > > > On Fri, Feb 17, 2023 at 6:03 PM Rich Felker wrote: > > > > > > > > On Fri, Feb 17, 2023 at 05:33:33PM -0800, Fangrui Song wrote: > > > > > C++ inline functions are requred to have exact same sequence of t= okens > > > > > in every translation unit, but __FILE__ and __LINE__ may expand t= o > > > > > different tokens. The ODR violatioin is usually benign, but it ca= n lead > > > > > to errors when C++20 modules are used. > > > > > > > > > > > > It is sad that C++ modules broke 'assert' but not surprising. Modules= were largely created out of aversion to macros. This isn't something libc = can fix though, I suggest a defect report against C++ instead. To lichray: ^^ > > > Changing the semantics of assert in C seems like a bad thing to do. > > > > > > Thanks > > > > I disagree. This is a footgun where the right fix (or workaround, if > > you prefer) is on the libc side. It is fairly reasonable for a header > > to use assert and not expect two includes using different paths to not > > cause C++ module problems. > > > > The current module behavior regarding macros is a reasonable > > compromise. It can be evolved (e.g. > > https://gracicot.github.io/modules/2018/05/14/modules-macro.html). > > i dont see how that solves the fundamental problem: > > the *behavior* of assert changes depending on which include path is > used and thus inline functions that are supposed to be equivalent > aren't. (__builtin_FILE makes the pp-token sequence the same across > the instances, but the actual code will have different paths, which > while not an odr violation per the literal words of the spec, it > clearly violates the reason the rule is there in the first place.) > libc can avoid printing the file path in the assert fail message for > c++. this makes assert less useful but it solves the conformance issue. > if c++ does not specify which path assert should print (or allow it to > be unpredictable) then it is difficult to do better than this. > > it would have been more useful to have a __builtin_canonical_FILE() > or similar that gives a path that is somehow independent of include > path, but we don't have that now. __FILE_NAME__ / __builtin_FILE_NAME just expands to the basename (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108978), which may help. I created this musl patch as I saw glibc made a similar change on 2023-02-1= 0. Rejecting this patch is fine. It probably needs some time for standard C++ modules to become mainstream to expose this deployment problem.