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 C4BA0385772E for ; Fri, 16 Jun 2023 13:07:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C4BA0385772E 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=1686920855; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=V+rpMOzNMgz6oX3oX31Y/3N83FkaM/z6be+u6pLI/Tc=; b=SMlrYrEiAK8iPsMIbibE6XcIGmgJ9em/DgN3T53TM795oXQlGRtFDcy2U0Ull8Qf2W+6fi DNPMu7QLJd3MpTWPFp15nBtvORW5zySd0S87Axc2THan/qLGBGHydjTtwj8+UQOTw+XNBZ q691Uh5Cw89uWwQU6Beo7uvwpIQtkvo= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-426-dVrQvQZCOXqVUrECKekUMw-1; Fri, 16 Jun 2023 09:07:34 -0400 X-MC-Unique: dVrQvQZCOXqVUrECKekUMw-1 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-75d8e5ddc93so111760485a.0 for ; Fri, 16 Jun 2023 06:07:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686920854; x=1689512854; h=content-transfer-encoding:in-reply-to:from:references:cc: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=V+rpMOzNMgz6oX3oX31Y/3N83FkaM/z6be+u6pLI/Tc=; b=Y8RqJ1XVibfdzc2x5XvQN0OQdY8Gx2asy2jMWMG4bpnXjK0ngMrjcl1pwuEG15HkhH NmZkupLlANEeiotxyyTVy30Bli/g3ErA9lQATF/JMG8KwU7E7QLukRTfiFz3PTjdv4m6 6J7eOq8WV1KMGhJkRrvTkuWTffuvHeiD52MPs8DSTa4A29xw0ee9XYDs1CNxz2t9DWht HGsvvBywYmqrCbYmqs6ve2BaqQ8ttQUeYIIzLfRfGJ6r+/TWtB+ZuHgDww/NsAA9xcO2 /uJpY/M0VsANZZnd0KaIrv/N8NIvS4fx7Aozqv/CcXJn0UlA1HCvjh//5ZLUqpuLwkpz xKIg== X-Gm-Message-State: AC+VfDx0NOefbm+RH0iYrF0tKmpfyLbUvQbzhQiNGwOv9wp8DJ0AXDHC 96HMplUgRmys1eOXEaQEYurGWpF1peQRUC2mz2pLQ1ExDrJRUVTLGLNM8AhxLNNVG//m89g6EBS wLGsE6Nja2cbWATchJw== X-Received: by 2002:a37:ad09:0:b0:762:256:e8fe with SMTP id f9-20020a37ad09000000b007620256e8femr1897693qkm.60.1686920853958; Fri, 16 Jun 2023 06:07:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4XncnXhXqkWp1xLoHGTW9+eeD08bd3KXYD0nonJSznMtNW1rYWwTT8VYgJ9beM7gJGokGupg== X-Received: by 2002:a37:ad09:0:b0:762:256:e8fe with SMTP id f9-20020a37ad09000000b007620256e8femr1897675qkm.60.1686920853669; Fri, 16 Jun 2023 06:07:33 -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 p22-20020a05620a15f600b0074e0e6aae1csm6490080qkm.36.2023.06.16.06.07.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 16 Jun 2023 06:07:33 -0700 (PDT) Message-ID: Date: Fri, 16 Jun 2023 09:07:32 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH v3] c++: Accept elaborated-enum-base with pedwarn To: Alex Coplan , gcc-patches@gcc.gnu.org Cc: Nathan Sidwell , Iain Sandoe 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=-6.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE 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 6/16/23 07:58, Alex Coplan wrote: > Hi, > > This is a v3 patch addressing feedback for: > https://gcc.gnu.org/pipermail/gcc-patches/2023-June/621714.html > > The only change since the previous version is that the new option is > documented in invoke.texi (and the description in c.opt was shortened as > requested). > > ------ > > macOS SDK headers using the CF_ENUM macro can expand to invalid C++ code > of the form: > > typedef enum T : BaseType T; > > i.e. an elaborated-type-specifier with an additional enum-base. > Upstream LLVM can be made to accept the above construct with > -Wno-error=elaborated-enum-base. > > This patch adds the -Welaborated-enum-base warning to GCC and adjusts > the C++ parser to emit this warning instead of rejecting this code > outright. > > The macro expansion in the macOS headers occurs in the case that the > compiler declares support for enums with underlying type using > __has_feature, see > https://gcc.gnu.org/pipermail/gcc-patches/2023-May/618450.html > > GCC rejecting this construct outright means that GCC fails to bootstrap > on Darwin in the case that it (correctly) implements __has_feature and > declares support for C++ enums with underlying type. > > With this patch, GCC can bootstrap on Darwin in combination with the > (WIP) __has_feature patch posted at: > https://gcc.gnu.org/pipermail/gcc-patches/2023-May/617878.html > > Bootstrapped/regtested on aarch64-linux-gnu and x86_64-apple-darwin. > OK for trunk? OK, thanks. > Thanks, > Alex > > gcc/c-family/ChangeLog: > > * c.opt (Welaborated-enum-base): New. > > gcc/ChangeLog: > > * doc/invoke.texi: Document -Welaborated-enum-base. > > gcc/cp/ChangeLog: > > * parser.cc (cp_parser_enum_specifier): Don't reject > elaborated-type-specifier with enum-base, instead emit new > Welaborated-enum-base warning. > > gcc/testsuite/ChangeLog: > > * g++.dg/cpp0x/enum40.C: Adjust expected diagnostics. > * g++.dg/cpp0x/forw_enum6.C: Likewise. > * g++.dg/cpp0x/elab-enum-base.C: New test.