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: 1899747 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ZSUe3RDB; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TbSQc6hmJz23hy for ; Fri, 16 Feb 2024 08:10:48 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D4E81386D637 for ; Thu, 15 Feb 2024 21:10:46 +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-Google-Smtp-Source: AGHT+IHmX2nUh0PmRrLNp4+bY6UuwW+CwyyuD9aQ3UHR+Tyog0Yyqdp6R57jH5KRw+UJ+FmpoLgCdA== 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+incoming=patchwork.ozlabs.org@gcc.gnu.org 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;