From patchwork Thu Feb 15 21:10:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Palka X-Patchwork-Id: 201750 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp124266dyb; Thu, 15 Feb 2024 13:11:13 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXVSOouz2R/eL0MboT/n+37BUn3+lDu0AcCjOI8hqiEJeLpI+5KcC5AqLncJ7jVwyvVyFiVKKDRzC1olddKAnlmvFd5lA== X-Google-Smtp-Source: AGHT+IGMrcKMvgEJ5hvyycMMXEKaaUMeognGRvYdaCU6xRjN+wLd9D5bMH4d5706nTWeu0iEJIBD X-Received: by 2002:a05:622a:10f:b0:42c:6ed7:fcf9 with SMTP id u15-20020a05622a010f00b0042c6ed7fcf9mr3901974qtw.19.1708031472825; Thu, 15 Feb 2024 13:11:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708031472; cv=pass; d=google.com; s=arc-20160816; b=XdE2SP72KSqbo3DXQ5CvD1DaMd+903rI4LObp6bD/M/XSZIgeDULpAArz44hxq8XWe midsnnDSDKU//B1rhDCK2e6GpU6ocPSi2jAGq1XlX9mZLagjXgP1lvHib/f+ZuR55sCc 59pkxOfhvhUQXVN7JG8aH7O215qTnKoBgUOpk/KhAP88h4T90qP23RVd/1vGvSkr3RDB JVoiSL/00VFwOEhp2Rij+Ks1bQe3Ri13fk5ajR3eO3QLameYesJYoROP0f7+FrTjiLu0 0WueB0PVFv7mMgAnPeafv41QVprcuqDiEb9YuztFX2QGu25gGlCzw3NNYSsLPNSmRhz0 o8uQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=gYi48aHC63x0ui67GLk0A2SUdEGFu+9Z0v001egpwXY=; fh=2rASkADSwGVpvDy7jg5DSLYvTiE4uxP+mXuVMyfs8f4=; b=UqBbRuji06otj3Xoer1PLGmBSnLICQjpEbDqnDz9p/AAujc1YViXOwY7rJRwlYQ5gP wWnQb/qB0t+varJwPEW/2W7rmhAQ3y5Fy0ZS5ubEBR3dX2ev4bKp3zXDxKGw1qTRaM8N 0UoHPqUCyWzCTtrlU5mxhpRsI2Pp2qBDSQj1EwOZRCOFE19ImfAAw4mG9L5th+HaMfN1 jVfwpZGV8QMOIhsv/TaNJmrjq9tmdC0CaL8d8MJWMrCgyID6iYf5Nlbssa7KmNQv0gPi u70F5SYYRT+tHW1/vlJuRr0aDCQq+2IXWMTw0tkJ50hPH+Qx31/FODYCuVI47/rqEt3A /E6A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZSUe3RDB; arc=pass (i=1); 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=redhat.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id f10-20020ac8470a000000b0042c71310957si2161005qtp.175.2024.02.15.13.11.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 13:11:12 -0800 (PST) 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=@redhat.com header.s=mimecast20190719 header.b=ZSUe3RDB; arc=pass (i=1); 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=redhat.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7B0FA386D639 for ; Thu, 15 Feb 2024 21:11:12 +0000 (GMT) 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 527EC3857B88 for ; Thu, 15 Feb 2024 21:10:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 527EC3857B88 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 527EC3857B88 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708031431; cv=none; b=JraF2+3/NSrDpvkE+jl4gbXAJCq4c2ch4kk4k/OC0Rym5em4mbiDvr/Fu29PiKyrElyH4jHzXPGaexsA7x4R05bBnB2rSDF3L+eSaJfIr/+JyP+yNK2EQeuCpB+g+af3QSaLPLCAxPIRHhbB/n68x/v+gog2W9Hox+Kob2c3b1I= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708031431; c=relaxed/simple; bh=km8+rrR1cgRmT+ImFTS2scpjVCViSMmYuzeFgoaL3CQ=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=UVVGoaosdMboNsLP5UifU3H5UNNqoqlktuWieTyHXYFHTJfneIQD6CUjklXJLia+EmhUI6x09Ln0HzE+LFGmPZci5WL1txyGggRrshXaLvrN/zWO3bRqHAb4zEgjwAz6qfXIJT3xlx6/kDqSQtbFgnyoPoJ5dqQcCDkpp8lMhmg= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708031428; 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; bh=gYi48aHC63x0ui67GLk0A2SUdEGFu+9Z0v001egpwXY=; b=ZSUe3RDBOqLUXDGzA8gGQVcvexxFDtJBEz8H7F2vspMJSSMwIM8cJQ985aKbfJDymut/y6 6m58WLhYn3BOGQgTUcccC+Oai1jXg/ZDJ2PkDlv7AnWU7FT3u7u7Fk7MvGiEBm1/XpgXFS 4PjQj1Dh6V01Jqkt0n3V1aQziFBj5Bg= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-260-gwIW39BQNc6f69cu8P3efA-1; Thu, 15 Feb 2024 16:10:26 -0500 X-MC-Unique: gwIW39BQNc6f69cu8P3efA-1 Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-42c6fa2059cso587551cf.1 for ; Thu, 15 Feb 2024 13:10:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708031425; x=1708636225; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=gYi48aHC63x0ui67GLk0A2SUdEGFu+9Z0v001egpwXY=; b=C2DNY4dsWOXAHFA4WMBqAH+VcI8C6s+oznLBag9PdY4H40P7Q/TTMBaC+UyDggb8fu VU6zxtcxBv8q//ar/QYdkWau+VDZ1PMp4PlkoRb27IwKHy/UiOi1TFqSpewEDCd6m9eP 9oqZ+K9OGaFhBaj9yEPFBFqZo2HxOF5irIcGPUo1txULyqQ2nydBPcT2unt+njgo7TL5 U96fW21adNFTjpzm8k67LiYEEMF8JRGp7j/WWfg5k0McWQxhXHf6+Ol074nmeeaeAQAZ w2+rPfZgP1h4ob9yq8P01kNlJqxuNKx4mdqHHrXoLIsc9r5Qwha2eEZn/wdGpUydqQgD QmVA== X-Gm-Message-State: AOJu0YxUBDZYTn8psJBn1XVsh2jZmEgK/qi3+MWofQMnnCdd4phQZP26 GvxvhANrqtP3zEebpcGdhXYp8wDw84HxGfV2zLe5jPOTBru0X/8M5Ye2ZMHNM+Ni8jwvSxcAKkt YS9SQr/jYCvdlJ31do5wyy6yh9E8XGhds6/s1NsDI6BZbf7PC7WeXflEwCAwaGgHNikO1YazdTu O/v5lS/HpjnV7ISXgE/Txz+UA3l499SVuAMjgN X-Received: by 2002:a0c:c983:0:b0:686:90c3:374b with SMTP id b3-20020a0cc983000000b0068690c3374bmr2801195qvk.31.1708031424987; Thu, 15 Feb 2024 13:10:24 -0800 (PST) X-Received: by 2002:a0c:c983:0:b0:686:90c3:374b with SMTP id b3-20020a0cc983000000b0068690c3374bmr2801180qvk.31.1708031424664; Thu, 15 Feb 2024 13:10:24 -0800 (PST) Received: from localhost.localdomain (ool-457670bb.dyn.optonline.net. [69.118.112.187]) by smtp.gmail.com with ESMTPSA id kr28-20020a0562142b9c00b0068cc4248169sm1017220qvb.100.2024.02.15.13.10.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 13:10:23 -0800 (PST) From: Patrick Palka To: gcc-patches@gcc.gnu.org Cc: jason@redhat.com, nathan@acm.org, Patrick Palka Subject: [PATCH] c++/modules: relax diagnostic about GMF contents Date: Thu, 15 Feb 2024 16:10:19 -0500 Message-ID: <20240215211019.340428-1-ppalka@redhat.com> X-Mailer: git-send-email 2.44.0.rc1.15.g4fc51f00ef MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-13.2 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_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, RCVD_IN_SORBS_WEB, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791000809695810478 X-GMAIL-MSGID: 1791000809695810478 Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk? -- >8 -- Issuing a hard error when the GMF doesn't contain preprocessing directives is inconvenient for automated testcase reduction via cvise. This patch relaxes this diagnostic into a pedwarn. gcc/cp/ChangeLog: * parser.cc (cp_parser_translation_unit): Relax GMF contents error into a pedwarn. gcc/testsuite/ChangeLog: * g++.dg/modules/friend-6_a.C: Remove now unnecessary preprocessing directives from GMF. --- gcc/cp/parser.cc | 6 +++--- gcc/testsuite/g++.dg/modules/friend-6_a.C | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc index 9d0914435fb..e60f0425035 100644 --- a/gcc/cp/parser.cc +++ b/gcc/cp/parser.cc @@ -5253,9 +5253,9 @@ cp_parser_translation_unit (cp_parser* parser) if (!warned) { warned = true; - error_at (token->location, - "global module fragment contents must be" - " from preprocessor inclusion"); + pedwarn (token->location, OPT_Wpedantic, + "global module fragment contents must be" + " from preprocessor inclusion"); } } } diff --git a/gcc/testsuite/g++.dg/modules/friend-6_a.C b/gcc/testsuite/g++.dg/modules/friend-6_a.C index 7493e8f262f..c7868556a3e 100644 --- a/gcc/testsuite/g++.dg/modules/friend-6_a.C +++ b/gcc/testsuite/g++.dg/modules/friend-6_a.C @@ -2,10 +2,8 @@ // { dg-module-cmi friend_6 } module; -# 1 "" 1 template struct Trans_NS___cxx11_basic_string { template friend class basic_stringbuf; }; template struct Trans_NS___cxx11_basic_string; -# 6 "" 2 export module friend_6;