From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id D3D233858D32 for ; Thu, 10 Aug 2023 21:44:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D3D233858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691703865; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=O9EhrjKzYB/fwnEuHI/XUV6fW03MxxC7rDv+BwP/PKI=; b=H6JCH5e6JbVTMcabdCfFvkj7PQ0RZ7T06X2uUN7I3C2zR1h0aqogXV1A3JSblw/AlvzS4e bV4tw8Kj/++M6EQsJc2bnK249ipdUmPC5OUx9lSnouFLkkWbjkeCEo8J3RTt+Aaoe4W68J I8h0TpdT2DOiKERA9/MxyQdijG9jEyc= Received: from mail-oi1-f197.google.com (mail-oi1-f197.google.com [209.85.167.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-204--SIHNFVvNG6ZXwPT6aQJ8A-1; Thu, 10 Aug 2023 17:44:23 -0400 X-MC-Unique: -SIHNFVvNG6ZXwPT6aQJ8A-1 Received: by mail-oi1-f197.google.com with SMTP id 5614622812f47-3a7697e580fso1552755b6e.1 for ; Thu, 10 Aug 2023 14:44:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691703862; x=1692308662; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=e0/Vs0833u5JsT6K5W/RYpr51edfClfZKcfmPHg2g3w=; b=R+9eFV528TLhitNjAb3obz90ao/Qkn6DQhC9e3YQetHTe9SNbNDJFjl5wJ1cbqxGx1 B9DATSDyGCuzz93xe519O2lH4eRxBHLB/j7UYeZEjK16aXMCN+ozJNa44cTDF5Kbz+i2 2KaNjEQNWw8ywdPfQkv+Ap1LQyHe6063h5T6ajB68UsAEYXYfuYM/iM+oYwFH1ebnLDA 5sDvScPPMAbJr0kyqG+881qr5giNUCpGFuftGVc3DOkf7mfC1MEBDAoeX/FSdVdNHo6r cK2wCLqJ4eNGhbSZi+58acApN/RJJAEOKVkbCG2jZS3NZfkdebsVIbNuf4BUZDn59pI9 jftg== X-Gm-Message-State: AOJu0Yx/NDwjl/MIfIEfupHJWsirEeqKX61AJrEA7R1Wa55MPCKdBCD6 FRbHgUusFzprK8eb0Bbd/PJqnqm/r/8DXQOqLZlGDoHJjpbv9V9pRVrjDhHz/XIWSVOoWJNCG7o lwpC3hqd1TQkcScP1Qw== X-Received: by 2002:a05:6808:23d3:b0:3a1:c75d:b6ab with SMTP id bq19-20020a05680823d300b003a1c75db6abmr55687oib.40.1691703862699; Thu, 10 Aug 2023 14:44:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFLtJ3/RKc0kRZjkk9mGkxdWvg7aT09inm3qCo5MRkLn6DXo///7z2vaZBvbQ+qu3fU5aYG3Q== X-Received: by 2002:a05:6808:23d3:b0:3a1:c75d:b6ab with SMTP id bq19-20020a05680823d300b003a1c75db6abmr55674oib.40.1691703862324; Thu, 10 Aug 2023 14:44:22 -0700 (PDT) Received: from [192.168.1.108] (130-44-146-16.s12558.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.146.16]) by smtp.gmail.com with ESMTPSA id v14-20020a0cdd8e000000b0063fbfbde4adsm755980qvk.129.2023.08.10.14.44.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 10 Aug 2023 14:44:21 -0700 (PDT) Message-ID: Date: Thu, 10 Aug 2023 17:44:20 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH] c, c++, v2: Accept __builtin_classify_type (typename) To: Jakub Jelinek , "Joseph S. Myers" , Marek Polacek , gcc-patches@gcc.gnu.org References: From: Jason Merrill In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-19.6 required=5.0 tests=BAYES_00,DKIM_INVALID,DKIM_SIGNED,KAM_DMARC_NONE,KAM_DMARC_STATUS,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP 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: On 8/10/23 11:35, Jakub Jelinek wrote: > Hi! > > I'd like to ping this patch. Reposting it as I found a typo in the > documentation - s/builtin-in/built-in/. Bootstrapped/regtested again > on x86_64-linux and i686-linux, ok for trunk? > > On Mon, Jun 12, 2023 at 09:57:17PM +0200, Jakub Jelinek via Gcc-patches wrote: >> As mentioned in my stdckdint.h mail, __builtin_classify_type has >> a problem that argument promotion (the argument is passed to ... >> prototyped builtin function) means that certain type classes will >> simply never appear. >> I think it is too late to change how it behaves, lots of code in the >> wild might rely on the current behavior. Hmm, you really think there's any code at all in the wild relying on __builtin_classify_type + array/function decay? It's a (previously) undocumented built-in, I wouldn't expect anyone outside the project to be using it. So at first glance I'd be inclined to fix it whether or not we also allow it to accept a type. But I don't actually know how it's used, so could well be wrong... > --- gcc/cp/parser.cc.jj 2023-06-06 20:02:35.631211230 +0200 > +++ gcc/cp/parser.cc 2023-06-12 16:19:04.892202240 +0200 > @@ -48,6 +48,7 @@ along with GCC; see the file COPYING3. > #include "c-family/known-headers.h" > #include "contracts.h" > #include "bitmap.h" > +#include "builtins.h" > > > /* The lexer. */ > @@ -7850,6 +7851,50 @@ cp_parser_postfix_expression (cp_parser > = parser->non_integral_constant_expression_p; > parser->integral_constant_expression_p = false; > } > + else if (TREE_CODE (stripped_expression) == FUNCTION_DECL > + && fndecl_built_in_p (stripped_expression, > + BUILT_IN_CLASSIFY_TYPE)) > + { > + /* __builtin_classify_type (type) */ > + auto cl1 = make_temp_override > + (parser->type_definition_forbidden_message, > + G_("types may not be defined in " > + "%<__builtin_classify_type%> calls")); > + auto cl2 = make_temp_override > + (parser->type_definition_forbidden_message_arg, > + NULL); > + auto cl3 = make_temp_override (parser->in_type_id_in_expr_p, > + true); > + cp_evaluated ev; > + ++cp_unevaluated_operand; > + ++c_inhibit_evaluation_warnings; These three lines seem unnecessary for parsing a type. > + tentative_firewall firewall (parser); I think you only need a tentative_firewall if you're going to call cp_parser_commit_to_tentative_parse yourself, which you don't. Jason