From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on2084.outbound.protection.outlook.com [40.107.15.84]) by sourceware.org (Postfix) with ESMTPS id F0E603858D33 for ; Thu, 6 Jul 2023 14:02:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F0E603858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hNgx1/YPQ1bdHNU7CgpuIRSFlayW8RXrCSRP+HkR4Gc=; b=QX0HabIBXL9z5sAuax41KylRXN8EptXoHvvbQ+XLKjrIPTzp3s34UUl+JyjUijqaRxp+xz3JESXsHPOeWDXJMuPo9JGnAITImW7+O6ptFdJ8wqE8ZmWEfs/CJE/EoKN2QMIu59DphrL2p3ROyPxx3ohv6d9u2Q0xm9n4xVF9WdA= Received: from AS9PR05CA0021.eurprd05.prod.outlook.com (2603:10a6:20b:488::17) by AS8PR08MB9337.eurprd08.prod.outlook.com (2603:10a6:20b:5a5::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.17; Thu, 6 Jul 2023 14:02:00 +0000 Received: from AM7EUR03FT061.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:488:cafe::b2) by AS9PR05CA0021.outlook.office365.com (2603:10a6:20b:488::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.18 via Frontend Transport; Thu, 6 Jul 2023 14:02:00 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM7EUR03FT061.mail.protection.outlook.com (100.127.140.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.24 via Frontend Transport; Thu, 6 Jul 2023 14:02:00 +0000 Received: ("Tessian outbound b11b8bb4dfe8:v142"); Thu, 06 Jul 2023 14:01:59 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 84b9eed86e43e010 X-CR-MTA-TID: 64aa7808 Received: from 4bccdbcea969.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id FAE4C0D3-6E4E-4814-A6AA-883C142F54D2.1; Thu, 06 Jul 2023 14:01:53 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 4bccdbcea969.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 06 Jul 2023 14:01:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lPBwhX3EFxNEqRocBMRxcDnFNxRIujLf9RO6GnvSrkTM901COVw/DlXvNMGUsWx2p1aTvwB0rLP3CqTxLwAJ3c/JEtRju44AOMnRvBaqlJvOHa18SEFx/C3Gyr1cY4tG5QcYDUyhrExpm0A+fbA87oUeQz78g9CDtsgO/rrrRLR25Wzxc4jiwuEQcdrzryG1JF7lKSJymK+aR5y4ugZQIGdiA3pIAj/9utXJsojL+scIqH+ojV3qX1uG9lZi8z8kga0CQoqiDJOp1X9azkKGtF9QmNSNENOf6QBDQ+PmYK3zVeRIlEmiefakcIcXpdSKC8OxrzQf68M+EsOovP1mAA== 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=hNgx1/YPQ1bdHNU7CgpuIRSFlayW8RXrCSRP+HkR4Gc=; b=DQrEnxD9kKxtFMWdCP4NzaT9JGLE0Om7qu/cbV+SAflqSTTqBCh3kq6sU9kBFOt1kBj/xFnMcYZwYZ2hWzwSDaDnO6x7ODGMjZCKvghChH726QbxAo+qcu3BiEcwvIy/D/4D2jZldp2RSxu2VykqQ7mwHS3KZxLq76187JsjfmrfXD0+PA6dcdDUqg8QkG2Ly7BxFklyd0peI50HDfNVRwkUklV5k4y/F6qUNMxCr/9971aKgAPxyXjEIO7Ln8k0llefGVYCnWyrKd35DQ9+cKaVNFMcifgYgLH1fDCpGucRcEzG6Eq1qc7bHkmq/VQ6UYVo3lmjhPBJjTn19Dv3Tg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hNgx1/YPQ1bdHNU7CgpuIRSFlayW8RXrCSRP+HkR4Gc=; b=QX0HabIBXL9z5sAuax41KylRXN8EptXoHvvbQ+XLKjrIPTzp3s34UUl+JyjUijqaRxp+xz3JESXsHPOeWDXJMuPo9JGnAITImW7+O6ptFdJ8wqE8ZmWEfs/CJE/EoKN2QMIu59DphrL2p3ROyPxx3ohv6d9u2Q0xm9n4xVF9WdA= Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from PAWPR08MB8958.eurprd08.prod.outlook.com (2603:10a6:102:33e::15) by AS8PR08MB8489.eurprd08.prod.outlook.com (2603:10a6:20b:568::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.17; Thu, 6 Jul 2023 14:01:51 +0000 Received: from PAWPR08MB8958.eurprd08.prod.outlook.com ([fe80::202a:45b7:3be8:47d5]) by PAWPR08MB8958.eurprd08.prod.outlook.com ([fe80::202a:45b7:3be8:47d5%7]) with mapi id 15.20.6565.016; Thu, 6 Jul 2023 14:01:51 +0000 Date: Thu, 6 Jul 2023 15:01:47 +0100 From: Alex Coplan To: Iain Sandoe Cc: GCC Patches , Joseph Myers , Jason Merrill , Nathan Sidwell Subject: Re: [PATCH][RFC] c-family: Implement __has_feature and __has_extension [PR60512] Message-ID: References: <77197F1C-5183-4F12-8701-83ACFF5FC96F@sandoe.co.uk> <9CCD1364-B659-4788-834F-5ECF52944660@sandoe.co.uk> Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <9CCD1364-B659-4788-834F-5ECF52944660@sandoe.co.uk> X-ClientProxiedBy: LO4P123CA0168.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18a::11) To PAWPR08MB8958.eurprd08.prod.outlook.com (2603:10a6:102:33e::15) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: PAWPR08MB8958:EE_|AS8PR08MB8489:EE_|AM7EUR03FT061:EE_|AS8PR08MB9337:EE_ X-MS-Office365-Filtering-Correlation-Id: 57b3666c-b1a5-4608-f2c0-08db7e299177 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 0lYqQ2twgutW2RPQ/FdV4xSJkd1shzpzxT0dsbxs4PyhuY23fRocPjlyp21jtDNelRuxXdAPDxH8gyufXSnyvP8QPaKFpwHNXQFLMbcMSIaUPoom5sNQY66rzu6Lsccn/b3NrPWcnx5T7IIAJIYfy8zuZ5ryKtv+YOl5YSrYUw71o01vUoXRh0WUNAkEjWB1JyZkfrSHHUrZPX1VpD8pNyUa9dRNS7Z76Vc8k5cM4cH6SKBdqk375OfUAcCoooHZDGUKTetCID6KOyopwnwMexDyNN9xH518znAUdLjCOkSPjJdyyDvvB3HDoXaNqxl6/wEODWm+GklOQl4t4Lv9dOz4NtmbQ0gNNo13ZsUFEVQX/Ed/1YacWULGFfYaW/uIVMASttoEaRhkn2QOL0GyV2XWzGC/bSiOBzQ5qvLy+3mjDXgPKSpZxZRXoJ5mbGYihTj40RdbU0FP8LCPrpSZ8i0kqexCe4rsVN4w1pV/eozSdU8o46dR4eYVADOQIN86eiB/Ezsdd8Xsu3LrYtZxTUPhdPh6REw0hDugvzX4E6U= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAWPR08MB8958.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(346002)(366004)(376002)(39860400002)(136003)(451199021)(66946007)(2906002)(44832011)(66899021)(8676002)(86362001)(2616005)(8936002)(5660300002)(54906003)(53546011)(6486002)(6666004)(966005)(186003)(6512007)(316002)(26005)(38100700002)(6506007)(83380400001)(66556008)(6916009)(36756003)(4326008)(66476007)(478600001)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8489 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT061.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 25788a9b-8329-443d-7ee2-08db7e298c27 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: n5H9cpzf3AAv4/+aXYbQpD3l+6CuA3OgzhVKzGpmAHsWIW1Up/Qvadf6r5P/ImRS/5aCCThPPI9N3VqvZkbir1vMLcfKWdt30ki0UUMHm2LW2v82vtEj2deVZU4PmUOh19Rrdwj+FgyZgu2a9t9rpW9LAIwGQMMRRsSZvqTG4uo6t0+TL8ZLeh43zbeCIczUusMtLLaF5mdNsRZyh+HIu88MJl70mfWaWCZMrhlLRjGEFUektIMNtF9bTVc2IV0TFuhok+PEuexm3UizDWdf0aXrVy2aFp0NtVXrwqxxzNeYR9JkKNWsQboegxeqWkW9jmgW5YmShkPqUNLWH049YFqqHXy4JFXfyhKHKFVmpERdvLDzg0VYJCB5fviABiqNydgPx+zplGbx+F5NFtmhwxDcGtwvvFLBeg1tTPe0kMIQvhRTNL6CL/ouwQW7r8EAXSBfRzpn1BjO5GddpA2LqUz87S0ukkIMKxN+WuRIr8oQYAhjOOqw0Yz5gVkda1aokJDQOCyLoMAuzZcF+b6Z/m+kw3XNGwGtIQ+DIwSz5rrc/sTwBJFRneT9Jb8lgaY8g2BzO7jdOjk1J5hWu0sX6Y7Vue8SU6Wt4wOzKiaGYhatJGAPvz5erOlsnEhWAvg5r9Pj/kOZHuC0r2TVBA+P9kOi66jOtzFU1l3TcyRtt5dZNLoq5DCaqVdvwk6dAS+U/RCZ7IO4+qUZ65tjbQSxcug1Z2DxDRHX/hTlH8xfh/U= X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230028)(4636009)(376002)(136003)(346002)(396003)(39860400002)(451199021)(36840700001)(46966006)(40470700004)(44832011)(6506007)(8936002)(5660300002)(478600001)(6862004)(8676002)(2616005)(40480700001)(36860700001)(86362001)(356005)(40460700003)(54906003)(83380400001)(47076005)(82740400003)(41300700001)(70206006)(4326008)(316002)(36756003)(81166007)(70586007)(966005)(6512007)(336012)(26005)(53546011)(6666004)(186003)(6486002)(82310400005)(2906002)(66899021);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jul 2023 14:02:00.1748 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 57b3666c-b1a5-4608-f2c0-08db7e299177 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM7EUR03FT061.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB9337 X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,FORGED_SPF_HELO,KAM_DMARC_NONE,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi Iain, On 20/06/2023 15:08, Iain Sandoe wrote: > Hi Alex > > again, thanks for working on this and for fixing the SDK blocker. > > > On 20 Jun 2023, at 13:30, Alex Coplan wrote: > > > > > The patch can now survive bootstrap on Darwin (it looks like we'll need > > to adjust some Objective-C++ tests in light of the new pedwarn, but that > > looks to be straightforward). > > Yes, I’ll deal with that soon (I was trying to decide whether to fix the the > header we have copied from GNUStep, or whether to mark it as a system > header). > > >> (one reason to allow target opt-in/out of specific features) > >> > >>> with the following omissions: > >> > >>> - Objective-C-specific features. > >> > >> I can clearly append the objective-c(++) cases to the end of the respective > >> lists, but then we need to make them conditional on language, version and > >> dialect (some will not be appropriate to GNU runtime). > >> > >> this is why I think we need more flexible predicates on declaring features > >> and extensions. > > > > Would it help mitigate these concerns if I implemented some Objective-C > > features as part of this patch (say, those implemented by your WIP > > patch)? > > > > My feeling is that the vast majority of extensions / features have > > similar logic, so we should exploit that redundancy to keep things terse > > in the encoding for the general case. Where we need more flexible > > predicates (e.g. for objc_nonfragile_abi in your WIP patch), those can > > be handled on a case-by-case basis by adding a new enumerator and logic > > to handle that specially. > > > > What do you think, does that sound OK to you? > > Sketching out what you have in mind using one or two examples would be > helpful. Again, the fact that some of the answers are target-dependent, is > what makes me think of needing a little more generality. FWIW I've implemented some Objective-C features (those from your WIP patch) in a v2 patch here: https://gcc.gnu.org/pipermail/gcc-patches/2023-June/623057.html I also tweaked the design to be closer to your patch in that we now have a hash table which allows for registering features dynamically. Hopefully it's clear that it should be easier to handle target-specific features in that version. Any thoughts on the new version? Thanks, Alex > > >> What about things like this: > >> > >> attribute_availability_tvos, > >> attribute_availability_watchos, > >> attribute_availability_driverkit, > > > > FWIW, clang looks to define these unconditionally, so restricting these > > to a given target would be deviating from its precedent. > > Hmm.. i did not check that although (for the sake of keeping target-specific > code localised) my current availabilty attribute implementation is Darwin- > specific. > > Having said that, interoperability with clang is also a very useful goal - for > Darwin, the SDK headers have only been (fully) tested with clang up to > now and I am sure we will find more gotchas as we expand what we can > parse. > > > However, I don't think it would be hard to extend the implementation in > > this patch to support target-specific features if required. I think > > perhaps a langhook that targets can call to add their own features would > > be a reasonable approach. > > Indeed, that could work if the result is needed later than pre-processing. > > In my patch, IIRC, I added another entry to the libcpp callbacks to handle > target-specific __has_xxxx queries. > > cheers > Iain > >