From patchwork Tue Sep 20 19:54:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Palka X-Patchwork-Id: 1323 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp1618989wrt; Tue, 20 Sep 2022 12:55:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4iy4ibpxsyC9UoEWuzANheWTWhkM1qhXczvfmsAScdpFTWCc0GWqrtNoEKuovZOwnQWYoO X-Received: by 2002:aa7:cd05:0:b0:44f:2776:2ff with SMTP id b5-20020aa7cd05000000b0044f277602ffmr21346163edw.49.1663703753452; Tue, 20 Sep 2022 12:55:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663703753; cv=none; d=google.com; s=arc-20160816; b=RcHSwygNile1ljzTTNTaIDymmhiDU2kPN2Su81lOSBZ/qumQUrIRKwIBk65ZKL1cKR cetqAxU0caVVhi/CyE6qcdrucJnUEhT+4aI+Z5HabxaXI0zQCWemD6ThJ1vlv3NLB7fZ icniSacGp0iNTTtLKySceIeooQUz2vyEekl/xJkX4DcZjhSuLA/FJMcjvexF1/udY4GG reKjMkF50LfqGTzA6MCYshQECWDaVNcYbylKfOYq91GoXREtqOiDI8sVEX4whznw8eef XgTb30LZ3lQ+mi6KR6jpql2pFU/ji6bgPNSgNw2t8HPF9iK05Om6NvHRy2FsqVImWH0D pMkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=ES4pYw272r65+HdeYMqhu6NCFrHw5aUDzfwA1qTa5vQ=; b=qgzhOBXiLS2P/91qQFgGMefB33il5D+dWYVXr0FLkFNiHOlRJqlgXCyKp4F8/g9Rvp 5Qix1HWHudpP3Df77PkQRES0mr5DAYJNsfB32Rzg1HYsvgxw3AaZciXIzR2uayRJy6J9 jm9W98oZS0nJ23qY9LWNxT9AzrR4LuLcr9hFP25vi/PbdIbmhic9aAuanZzFGfbDtpgd E/8bglbkqHHJGZDrb6SyGmOUg5cId5OPQumnKEGAq1tARu+dh2ce/7Cbeao1NHbCY4gh 4530E5gvQf3GSzdvhU5fk2f4AZZlYjzfHotOg4M5ZxDpbdxhHFAxkUzg+efSnFgr3OvN zYpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=ByQCKh+D; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id sc9-20020a1709078a0900b0073d76d8af85si784871ejc.231.2022.09.20.12.55.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Sep 2022 12:55:53 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=ByQCKh+D; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1253A3857C60 for ; Tue, 20 Sep 2022 19:55:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1253A3857C60 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1663703744; bh=ES4pYw272r65+HdeYMqhu6NCFrHw5aUDzfwA1qTa5vQ=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=ByQCKh+D3sUYeZ5qY5Tyg8Tn/DN9U2NW0kHHa772yNEOVQWZlEbRWJhsyUaFmqAmt tXDdyky3hlrkg+rpD81RRdAnLDLnG9+vzmtkNep+4uihAk1XdVwITKHp3NLGfqiRWa qT1fmJv7TGQkLLcg7rjK61r6HPK5fypVjibarhV4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id CD3A53858C55 for ; Tue, 20 Sep 2022 19:55:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CD3A53858C55 Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-607-IuDYvCzLNnW7_7586lMJtA-1; Tue, 20 Sep 2022 15:54:59 -0400 X-MC-Unique: IuDYvCzLNnW7_7586lMJtA-1 Received: by mail-qk1-f198.google.com with SMTP id bl17-20020a05620a1a9100b006cdf19243acso2778215qkb.4 for ; Tue, 20 Sep 2022 12:54:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=ES4pYw272r65+HdeYMqhu6NCFrHw5aUDzfwA1qTa5vQ=; b=vZ51qZCebR12OFDcOhppRmv4SBXB6Fuw3Z5KS+BTQFLUh2Zvth3CV9lyPaCPJqMV3L jzuGzaun6Pz4cztgqwCGgxK4IGQA86NtxElagitT4wPE4q8rfwUQLCjQOyBv5fQwwbE+ XbrEazcOeeedJg39rAICmEL42S00GpgFLcIReldMwAfs13JVjaIY3rz70fJhKoO5zly0 RzGKTl61tpndFjPChYdfMTwMFDkf6euhTZEPONuoXUBZGQz7ZyZOI2qZVYnKEDqTeOCD b+HGwZXsE9wwWetwueq6x69Anh+EnmJuScstcqD6DVI8X3V6CM/mMFjA4uvhTlj+Uwem IQXw== X-Gm-Message-State: ACrzQf3WpiZ2eXHpAaWGE+Xr5/q6Mugzs+2wF+ZbU7PdxOw6DWHDOYLJ lSgzFY5dV34E9MQkmxxWnN7WvU4QVdmouhJSaLeS/ktNa1lVP0wK4d5vFOXiEVhtNwdKj1oMig2 gF/UZDHok29k+OLkELkf0DDKvHLO0IXj9PyWUDPMaluPSvURWc2SxVg21t8jshZvyqSY= X-Received: by 2002:a0c:e190:0:b0:49c:cd5e:53d with SMTP id p16-20020a0ce190000000b0049ccd5e053dmr21323030qvl.71.1663703698378; Tue, 20 Sep 2022 12:54:58 -0700 (PDT) X-Received: by 2002:a0c:e190:0:b0:49c:cd5e:53d with SMTP id p16-20020a0ce190000000b0049ccd5e053dmr21323014qvl.71.1663703698115; Tue, 20 Sep 2022 12:54:58 -0700 (PDT) Received: from localhost.localdomain (ool-457670bb.dyn.optonline.net. [69.118.112.187]) by smtp.gmail.com with ESMTPSA id bm22-20020a05620a199600b006bb9125363fsm419439qkb.121.2022.09.20.12.54.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Sep 2022 12:54:57 -0700 (PDT) To: gcc-patches@gcc.gnu.org Subject: [PATCH 1/2] c++: modules and non-dependent auto deduction Date: Tue, 20 Sep 2022 15:54:30 -0400 Message-Id: <20220920195431.1527042-1-ppalka@redhat.com> X-Mailer: git-send-email 2.38.0.rc0.52.gdda7228a83 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-14.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Patrick Palka via Gcc-patches From: Patrick Palka Reply-To: Patrick Palka Cc: nathan@acm.org Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1744519827150666614?= X-GMAIL-MSGID: =?utf-8?q?1744519827150666614?= The modules streaming code seems to rely on the invariant that a TEMPLATE_DECL and its DECL_TEMPLATE_RESULT have the same TREE_TYPE. But for a templated VAR_DECL with deduced non-dependent type, the two TREE_TYPEs end up diverging: cp_finish_decl deduces the type of the initializer ahead of time and updates the TREE_TYPE of the VAR_DECL, but neglects to update the corresponding TEMPLATE_DECL as well, which leads to a "conflicting global module declaration" error for each of the __phase_alignment decls in the below testcase (and for the xtreme-header testcases if we try including ). This patch makes cp_finish_decl update the TREE_TYPE of the corresponding TEMPLATE_DECL so that the invariant is maintained. Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk? gcc/cp/ChangeLog: * decl.cc (cp_finish_decl): After updating the deduced type of a VAR_DECL, also update the corresponding TEMPLATE_DECL if there is one. gcc/testsuite/ChangeLog: * g++.dg/modules/auto-3.h: New test. * g++.dg/modules/auto-3_a.H: New test. * g++.dg/modules/auto-3_b.C: New test. --- gcc/cp/decl.cc | 6 ++++++ gcc/testsuite/g++.dg/modules/auto-3.h | 10 ++++++++++ gcc/testsuite/g++.dg/modules/auto-3_a.H | 4 ++++ gcc/testsuite/g++.dg/modules/auto-3_b.C | 4 ++++ 4 files changed, 24 insertions(+) create mode 100644 gcc/testsuite/g++.dg/modules/auto-3.h create mode 100644 gcc/testsuite/g++.dg/modules/auto-3_a.H create mode 100644 gcc/testsuite/g++.dg/modules/auto-3_b.C diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc index 070f673c3a2..80467c19254 100644 --- a/gcc/cp/decl.cc +++ b/gcc/cp/decl.cc @@ -8180,6 +8180,12 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p, return; } cp_apply_type_quals_to_decl (cp_type_quals (type), decl); + + /* Update the type of the corresponding TEMPLATE_DECL to match. */ + if (DECL_LANG_SPECIFIC (decl) + && DECL_TEMPLATE_INFO (decl) + && DECL_TEMPLATE_RESULT (DECL_TI_TEMPLATE (decl)) == decl) + TREE_TYPE (DECL_TI_TEMPLATE (decl)) = type; } if (ensure_literal_type_for_constexpr_object (decl) == error_mark_node) diff --git a/gcc/testsuite/g++.dg/modules/auto-3.h b/gcc/testsuite/g++.dg/modules/auto-3.h new file mode 100644 index 00000000000..f129433cbcb --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/auto-3.h @@ -0,0 +1,10 @@ +template +struct __tree_barrier { + static const auto __phase_alignment_1 = 0; + + template + static const auto __phase_alignment_2 = 0; +}; + +template +inline auto __phase_alignment_3 = 0; diff --git a/gcc/testsuite/g++.dg/modules/auto-3_a.H b/gcc/testsuite/g++.dg/modules/auto-3_a.H new file mode 100644 index 00000000000..25a7a73e73e --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/auto-3_a.H @@ -0,0 +1,4 @@ +// { dg-additional-options "-fmodule-header" } +// { dg-module-cmi {} } + +#include "auto-3.h" diff --git a/gcc/testsuite/g++.dg/modules/auto-3_b.C b/gcc/testsuite/g++.dg/modules/auto-3_b.C new file mode 100644 index 00000000000..03b6d46f476 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/auto-3_b.C @@ -0,0 +1,4 @@ +// { dg-additional-options "-fmodules-ts -fno-module-lazy" } + +#include "auto-3.h" +import "auto-3_a.H"; From patchwork Tue Sep 20 19:54:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Palka X-Patchwork-Id: 1324 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp1619021wrt; Tue, 20 Sep 2022 12:55:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7j1a80eg55GmPCbxhsXFzaR06YOr64IDKQfVpQw23RqkIHYlFmqLeUodMK3ovdDVIF8DBW X-Received: by 2002:a05:6402:1910:b0:450:fb10:fddf with SMTP id e16-20020a056402191000b00450fb10fddfmr21552075edz.321.1663703758859; Tue, 20 Sep 2022 12:55:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663703758; cv=none; d=google.com; s=arc-20160816; b=xz9Fs0U/Y9lQ7vJRls/wSKgies3qN9gUd0ZHbzWpFzEShHKdtkwTBt17bCWAZ+yMl2 oD8tVMp0LgxfEYLa6prJQnMdh4MV9yCjMlwHFaElKoDPXUNTa6QVV5cDqI8oWGTtHmK/ m8XcAF1Uv/HNf2LzXLd/ps0MIVVcEm1EiLdoNf1tD+lqPdPeWeixIEt0J3isu6cusfZv Y56zWwTIha3sp9abYoF6pywZeY6LWS3BgwyBSyZ1Vy/l6YC/VDI7BoMFJ8Lo7sH9zSfV xL8j9F8Esk3BpgEx5e4WmNQp5dYV5WlVnh905V7ZraN7rYCNX6YUTRaN2Fnhw6mhtAyx S9GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:dmarc-filter:delivered-to:dkim-signature :dkim-filter; bh=CMeuLg1i0i/K6UMjDqqa/u9zmDqaewrjpGytWSnnrCo=; b=sSIVg3Lb5oqbemyC9zuLMRq8cRXLVyxx03etI71rgbnhs73XBbQuFkC5Hgh/JnE+sT ME51eaaSJjtjNURpZUdym/lcA4JShR9BwnGOjhY6kDmueVlYAu3cX4+6tkzgNhVFueII 0QFDUpTRhXmA/NTYv7QuAgBFoRWRzYKJBJTmB0LZOLW3QG8zG4U10HIOtflaCbl2fEs7 xCTJ4bDy1ZVSMJ8lmqEP2b1SdlCXecNgKgrzEu+Uc0ycHGrYf8pjsAq9/mhJvFhAHL84 KGcX80vZPy8RQ3pNoUFDb6GVdMDnk7zdLDwD+0wJQ7j4ekXoxyfwrUGPivf1kgwiU883 3AAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=mUUNyYOV; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id au16-20020a170907093000b00780076c3322si459228ejc.432.2022.09.20.12.55.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Sep 2022 12:55:58 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=mUUNyYOV; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C8EDA3857BAA for ; Tue, 20 Sep 2022 19:55:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C8EDA3857BAA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1663703748; bh=CMeuLg1i0i/K6UMjDqqa/u9zmDqaewrjpGytWSnnrCo=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=mUUNyYOV4o25mZlBFAT/SmYSpmVk+1ZYReMNVJulwypq9PNUKAoh457dmpYv6Mv5E AoH1cxHRalvNxiXBry1SFbsIInbIugI+S3UW59tMEW8UJfzxj6OE+TIP2BxSvKVJej +XvmQ+v6zknxO/ckZS5jFrVAXTUz8sVIuJ80HU7Q= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 CC63B3858284 for ; Tue, 20 Sep 2022 19:55:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CC63B3858284 Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-392-ofIRT8ePOSS0H8cmCJQg7g-1; Tue, 20 Sep 2022 15:55:01 -0400 X-MC-Unique: ofIRT8ePOSS0H8cmCJQg7g-1 Received: by mail-qv1-f72.google.com with SMTP id w19-20020a0562140b3300b0049cad77df78so2761610qvj.6 for ; Tue, 20 Sep 2022 12:55:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=CMeuLg1i0i/K6UMjDqqa/u9zmDqaewrjpGytWSnnrCo=; b=fOiy86TtDO0YbcvyBVqgrRNlMV4c90/mubt+PUFxU0PLxJBrwj6cAYCuowBZnC0Mpe VYLhf+zzKePhmz/kZroWUU0CCi1ICV+m43dlnog3QiPtEZig51q0dFN6T4fZhdrAMR6C h0TtrfzKlE956XK5X7iC5wR8bXLYtptdVUOWjcQh72xZWUU5/Rv3R1slIK48cFvs9X0J O5ZAqzQt3bxJWg61U8JSh8Lw/49S6PIB5HL3NpdP0c629jAU/3dtiirfcVyCLzd8huVP /EqwMrEEVOvhevfkxLhE7c5h5TQjWBNsOTTnoM26pm5c3OlynK9I5+35o2NlytGDSkAE 2AKA== X-Gm-Message-State: ACrzQf1LUsYbrSrDTdPI4PGfhFkvRd0nc3HHUIdV9Dve4rCmvkQl3W1F dZ7CG7Ch4f0jLDs51ax5PwgfJm9mBZygTZ8ouoDv19XOZkrM5hwjfXKvKqo9GiS7ZHvobcyDMiV wIEhLSBcftBq/XtcwDX9xxXfCSkO7LFJVf8RSqsnKnSV6h2vI0pJjqBqs/R4fQ5TQd20= X-Received: by 2002:a05:620a:9d0:b0:6ce:1aac:8642 with SMTP id y16-20020a05620a09d000b006ce1aac8642mr18067251qky.305.1663703700131; Tue, 20 Sep 2022 12:55:00 -0700 (PDT) X-Received: by 2002:a05:620a:9d0:b0:6ce:1aac:8642 with SMTP id y16-20020a05620a09d000b006ce1aac8642mr18067234qky.305.1663703699810; Tue, 20 Sep 2022 12:54:59 -0700 (PDT) Received: from localhost.localdomain (ool-457670bb.dyn.optonline.net. [69.118.112.187]) by smtp.gmail.com with ESMTPSA id bm22-20020a05620a199600b006bb9125363fsm419439qkb.121.2022.09.20.12.54.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Sep 2022 12:54:59 -0700 (PDT) To: gcc-patches@gcc.gnu.org Subject: [PATCH 2/2] c++: xtreme-header modules tests cleanups Date: Tue, 20 Sep 2022 15:54:31 -0400 Message-Id: <20220920195431.1527042-2-ppalka@redhat.com> X-Mailer: git-send-email 2.38.0.rc0.52.gdda7228a83 In-Reply-To: <20220920195431.1527042-1-ppalka@redhat.com> References: <20220920195431.1527042-1-ppalka@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-14.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Patrick Palka via Gcc-patches From: Patrick Palka Reply-To: Patrick Palka Cc: nathan@acm.org Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1744519833002127150?= X-GMAIL-MSGID: =?utf-8?q?1744519833002127150?= This adds some recently implemented C++20/23 library headers to the xtreme-header tests as appropriate. Also, it looks like we can safely re-add and remove the NO_ASSOCIATED_LAMBDA workaround. Tested on x86_64-pc-linux-gnu, does this look OK for trunk? gcc/testsuite/ChangeLog: * g++.dg/modules/xtreme-header-2.h: Include . * g++.dg/modules/xtreme-header-6.h: Include , , , and . * g++.dg/modules/xtreme-header.h: Likewise. Remove NO_ASSOCIATED_LAMBDA workaround. Include implemented C++23 library headers. --- .../g++.dg/modules/xtreme-header-2.h | 3 +- .../g++.dg/modules/xtreme-header-6.h | 10 ++-- gcc/testsuite/g++.dg/modules/xtreme-header.h | 60 +++++++------------ 3 files changed, 29 insertions(+), 44 deletions(-) diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header-2.h b/gcc/testsuite/g++.dg/modules/xtreme-header-2.h index ded093e533c..dfe94aa6988 100644 --- a/gcc/testsuite/g++.dg/modules/xtreme-header-2.h +++ b/gcc/testsuite/g++.dg/modules/xtreme-header-2.h @@ -1,8 +1,7 @@ // Everything that transitively includes #include -// FIXME: PR 97549 -// #include +#include #include #include #include diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header-6.h b/gcc/testsuite/g++.dg/modules/xtreme-header-6.h index 85894b2b20a..8d024b69bac 100644 --- a/gcc/testsuite/g++.dg/modules/xtreme-header-6.h +++ b/gcc/testsuite/g++.dg/modules/xtreme-header-6.h @@ -1,22 +1,22 @@ // C++20 headers #if __cplusplus > 201703 #include +#include #include #include #include #if __cpp_coroutines #include #endif +#include #include +#include +#include #include #include +#include #if 0 // Unimplemented -#include #include -#include -#include -#include -#include #endif #endif diff --git a/gcc/testsuite/g++.dg/modules/xtreme-header.h b/gcc/testsuite/g++.dg/modules/xtreme-header.h index 41302c780b5..124e2f82277 100644 --- a/gcc/testsuite/g++.dg/modules/xtreme-header.h +++ b/gcc/testsuite/g++.dg/modules/xtreme-header.h @@ -1,17 +1,8 @@ // All the headers! -#if __cplusplus > 201703L -// FIXME: if we include everything, something goes wrong with location -// information. We used to not handle lambdas attached to global -// vars, and this is a convienient flag to stop including everything. -#define NO_ASSOCIATED_LAMBDA 1 -#endif - // C++ 17 and below #if 1 -#if !NO_ASSOCIATED_LAMBDA #include -#endif #include #include #include @@ -26,19 +17,12 @@ #include #include #include -#if !NO_ASSOCIATED_LAMBDA -// FIXME: PR 97549 -//#include -#endif +#include #include #include #include -#if !NO_ASSOCIATED_LAMBDA #include -#endif -#if !NO_ASSOCIATED_LAMBDA #include -#endif #include #include #include @@ -49,12 +33,8 @@ #include #include #include -#if !NO_ASSOCIATED_LAMBDA #include -#endif -#if !NO_ASSOCIATED_LAMBDA #include -#endif #include #include #include @@ -63,12 +43,8 @@ #include #include #include -#if !NO_ASSOCIATED_LAMBDA #include -#endif -#if !NO_ASSOCIATED_LAMBDA #include -#endif #include #include #include @@ -78,9 +54,7 @@ #include #include #include -#if !NO_ASSOCIATED_LAMBDA #include -#endif #include #include #include @@ -88,9 +62,7 @@ #include #include #include -#if !NO_ASSOCIATED_LAMBDA #include -#endif #include #include #endif @@ -119,26 +91,40 @@ #if __cplusplus > 201703 #if 1 #include +#include #include #include #include #if __cpp_coroutines #include #endif -#if !NO_ASSOCIATED_LAMBDA -#include -#endif +#include #include +#include +#include +#include #include #include +#include #if 0 // Unimplemented -#include #include -#include -#include -#include -#include #endif #endif #endif + +// C++23 +#if __cplusplus > 202002L +#include +#include +#include +#if 0 +// Unimplemented +#include +#include +#include +#include +#include +#endif +#endif +