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.129.124]) by sourceware.org (Postfix) with ESMTPS id 9BC553858C39 for ; Tue, 27 Feb 2024 17:56:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9BC553858C39 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 9BC553858C39 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709056613; cv=none; b=av4Dgcd5knw3uVBLPRcC02gRjVIP340jCKi5ulCgWq2uwRwhuPtJwTVDbJ33RVx5rzBcIxq6ukCn4B5ccfElXzfoAZ/iu72nrfF1i98emXO6LLm/np/KY8qvdMx46ido5QV+9akbP7LXnsjYM15ScxBB8+9PyLvwZT1VKzfLVLU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709056613; c=relaxed/simple; bh=bbsLo2Lps0ARIl5O6QOuvYapL1znMAvExrRwKF6pFN0=; h=DKIM-Signature:From:Date:To:Subject:Message-ID:MIME-Version; b=UEmE+7Zxhr+asOiJkz8cRW64HqdpNT9+8h1f6FVuZSitJ4D4hXc1ynyyn77gGhURN9KUjp0yleILu80SndfNgkgzYBKYKqiZLQbjQdblNnxvkyvT2fwzDtGrOu5VGbUOSrxcZm8VTA/UfeoO7DWb/zgSVkGaIlUXzghr2siT9S8= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709056611; 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: in-reply-to:in-reply-to:references:references; bh=msX5CqOdDi4nBNJpxU6uIpt6OqGC+lrm9S1L/UFLeik=; b=SjpEHCDh2JY5bMj7OQoZoNVHA4M3gerwSGqP32udAQvgpysjAA1U2epdKYma/F1pzZrZPq YuKF2PaKyeXA2lkgGXEogbKBaTZ5yMQH+Q4wAxQsd1afZ3359QA4Voa23m7UGW10X+F0VX YbmXhJ2xCSbxe6f/VZP1Z2wOMVsK/tQ= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-423-cWJoIDcoN_e2mPekgiUA6A-1; Tue, 27 Feb 2024 12:56:49 -0500 X-MC-Unique: cWJoIDcoN_e2mPekgiUA6A-1 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-68fff2be754so31146586d6.3 for ; Tue, 27 Feb 2024 09:56:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709056609; x=1709661409; h=mime-version:references:message-id:in-reply-to:subject:cc:to:date :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=msX5CqOdDi4nBNJpxU6uIpt6OqGC+lrm9S1L/UFLeik=; b=i7CznzeDHXJL8aQtwXazWmi+E8z4uOhtZwoQuFwx8VKryMHK6WnBesC02i2YEiH80F DlwnOb1zQjFRyXQLOZWqGbbC/PjrWdlcpfA3Nme+e/sTmPMSUXbSHIqTPxilVETcDf+0 l91lGs8h3F/UpAnIO7ytQpLxmHpZOZlSv1u1HK3oLlRZs85mgdAnPycsTFn86y+MimrC UOQ3uVjXvJoOyKbfpHlCRXPSvFFOCK8WZJUknJ7z5fD1M0OO4O9tO4PwpahLf8+6RwLm cNJlWjy9MOCeQCWhcvmSrsZ4tAGoZq6xhDNMS7PokQAMqDqdKlmW2FHKQUEXH5EfNVdo Sgcw== X-Forwarded-Encrypted: i=1; AJvYcCW7Yc8Hqmy73ZmOch/kSFvnzNcDxpqojtGm/8d+sNhBIY1/H8ziyoQBR1G+Ks1zzLyYH6QeM0Kckol6/IGFnvz9/ewD+KMccg== X-Gm-Message-State: AOJu0YyVvHiR1fOfTPgNgJxFnS/AyHO2CevrZzVwbhZi/K9keu4dRwy6 s734le4EYL3ilBpWyM+8TGCSrMZwstcY9+wd1mlGl5lR/lmWwGGMzjTeUzVw7oWRdvaukSwpl9E CUmIyggOSduIKsiv80eE/ZxPgYWwGKSiRBsAOhyhz9H6Tw0kKTsqXNjU= X-Received: by 2002:a05:6214:401a:b0:690:61f:12b7 with SMTP id kd26-20020a056214401a00b00690061f12b7mr3796411qvb.23.1709056609367; Tue, 27 Feb 2024 09:56:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IEez3N1bU655Ah4aF/+SrOvdSfrd/v7BePgKbC6z2OMnAfzL+9UIC+mLc4EroFtDotRtvy7yg== X-Received: by 2002:a05:6214:401a:b0:690:61f:12b7 with SMTP id kd26-20020a056214401a00b00690061f12b7mr3796388qvb.23.1709056609031; Tue, 27 Feb 2024 09:56:49 -0800 (PST) Received: from [192.168.1.130] (ool-457670bb.dyn.optonline.net. [69.118.112.187]) by smtp.gmail.com with ESMTPSA id oo5-20020a056214450500b0068fda0c74b6sm4317611qvb.27.2024.02.27.09.56.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 09:56:48 -0800 (PST) From: Patrick Palka X-Google-Original-From: Patrick Palka Date: Tue, 27 Feb 2024 12:56:47 -0500 (EST) To: Patrick Palka cc: Jason Merrill , gcc-patches@gcc.gnu.org, nathan@acm.org Subject: Re: [PATCH] c++/modules: relax diagnostic about GMF contents In-Reply-To: <197b0a99-5e3f-ed40-271a-6fe86bbeb8df@idea> Message-ID: References: <20240215211019.340428-1-ppalka@redhat.com> <57d9a71a-998a-4ff6-ac0f-d99846fbab47@redhat.com> <197b0a99-5e3f-ed40-271a-6fe86bbeb8df@idea> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-13.0 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_H2,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 List-Id: On Thu, 15 Feb 2024, Patrick Palka wrote: > On Thu, 15 Feb 2024, Jason Merrill wrote: > > > On 2/15/24 16:10, Patrick Palka wrote: > > > 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"); > > > > Relaxing to pedwarn is fine, but I think it should be on by default, not just > > with -pedantic. So it should get a new option. > > Ah, like so? I'm not sure about naming the option Wmodules-gmf-contents > vs just Wgmf-contents, or something else... Ping. > > -- >8 -- > > Subject: [PATCH] c++/modules: relax diagnostic about GMF contents > > 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 that can be disabled > with -Wno-modules-gmf-contents. > > gcc/c-family/ChangeLog: > > * c.opt (Wmodules-gmf-contents): New warning. > > gcc/cp/ChangeLog: > > * parser.cc (cp_parser_translation_unit): Relax GMF contents > error into a pedwarn. > > gcc/ChangeLog: > > * doc/invoke.texi (-Wno-modules-gmf-contents): Document. > > gcc/testsuite/ChangeLog: > > * g++.dg/modules/friend-6_a.C: Pass -Wno-modules-gmf-contents > instead of -Wno-pedantic. Remove now unnecessary preprocessing > directives from GMF. > --- > gcc/c-family/c.opt | 4 ++++ > gcc/cp/parser.cc | 6 +++--- > gcc/doc/invoke.texi | 7 +++++++ > gcc/testsuite/g++.dg/modules/friend-6_a.C | 4 +--- > 4 files changed, 15 insertions(+), 6 deletions(-) > > diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt > index b7a4a1a68e3..6d5f3199b33 100644 > --- a/gcc/c-family/c.opt > +++ b/gcc/c-family/c.opt > @@ -993,6 +993,10 @@ Wmissing-variable-declarations > C ObjC Var(warn_missing_variable_declarations) Warning > Warn about global variables without previous declarations. > > +Wmodules-gmf-contents > +C++ ObjC++ Var(warn_modules_gmf_contents) Warning Init(1) > +Warn about the global module fragment not containing only preprocessing directives. > + > Wmudflap > C ObjC C++ ObjC++ WarnRemoved > > diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc > index 9d0914435fb..eb709fc9e38 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_Wmodules_gmf_contents, > + "global module fragment contents must be" > + " from preprocessor inclusion"); > } > } > } > diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi > index 511114cde59..e27fda88bc4 100644 > --- a/gcc/doc/invoke.texi > +++ b/gcc/doc/invoke.texi > @@ -261,6 +261,7 @@ in the following sections. > -Winvalid-constexpr -Winvalid-imported-macros > -Wno-invalid-offsetof -Wno-literal-suffix > -Wmismatched-new-delete -Wmismatched-tags > +-Wno-modules-gmf-contents > -Wmultiple-inheritance -Wnamespaces -Wnarrowing > -Wnoexcept -Wnoexcept-type -Wnon-virtual-dtor > -Wpessimizing-move -Wno-placement-new -Wplacement-new=@var{n} > @@ -4568,6 +4569,12 @@ unresolved references due to the difference in the mangling of symbols > declared with different class-keys. The option can be used either on its > own or in conjunction with @option{-Wredundant-tags}. > > +@opindex Wno-modules-gmf-contents > +@opindex Wmodules-gmf-contents > +@item -Wno-modules-gmf-contents @r{(C++ and Objective-C++ only)} > +Disable the diagnostic for when the global module fragment of a module > +unit does not consist only of preprocessor directives. > + > @opindex Wmultiple-inheritance > @opindex Wno-multiple-inheritance > @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)} > diff --git a/gcc/testsuite/g++.dg/modules/friend-6_a.C b/gcc/testsuite/g++.dg/modules/friend-6_a.C > index 7493e8f262f..429fb460eea 100644 > --- a/gcc/testsuite/g++.dg/modules/friend-6_a.C > +++ b/gcc/testsuite/g++.dg/modules/friend-6_a.C > @@ -1,11 +1,9 @@ > -// { dg-additional-options "-fmodules-ts -Wno-pedantic" } > +// { dg-additional-options "-fmodules-ts -Wno-modules-gmf-contents" } > // { 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; > -- > 2.44.0.rc1.15.g4fc51f00ef > >