From patchwork Thu Feb 25 16:57:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 1444542 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=VOx3dr5/; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Dmf9R5lY6z9sBJ for ; Fri, 26 Feb 2021 03:57:46 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F14743851C3E; Thu, 25 Feb 2021 16:57:43 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-qv1-xf2f.google.com (mail-qv1-xf2f.google.com [IPv6:2607:f8b0:4864:20::f2f]) by sourceware.org (Postfix) with ESMTPS id 6B2B53857003 for ; Thu, 25 Feb 2021 16:57:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6B2B53857003 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=acm.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=nathanmsidwell@gmail.com Received: by mail-qv1-xf2f.google.com with SMTP id 2so3099006qvd.0 for ; Thu, 25 Feb 2021 08:57:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=4VuOe415ClsU8r+d2lu2OrioQw66yuXaKVVmJDox4lM=; b=VOx3dr5//WCI6mn69qZiACLixBZDprrqpJYT/PLQXe4IhMIBNf4q/4ydrdAMEcRgdi pEHefIubeyQ06PAvMXkLvO671FLV7GtejM7ouwYC1a08B+jkxJ48W3FaREYuy63B5Vre TyQRnkTON76Rq5OaZ7g8kKxOHhu1WcHfJzZ8sic5C/plxzRf8KNIFMVGhGy4IPXaylVp S/sbMtg9ClYHPM4mZra3bmycnnvQzT5VEwkIsQL92TU59J3VfIJXp7KA3FBXiQmRR0au 5B6tFmslwtcytH3twGytwk7ctOxoDtJDOtZT+KRBjDT4g1OBm1s0XF5GLBNu3PSPWPSI v9RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:to:from:subject:message-id:date :user-agent:mime-version:content-language; bh=4VuOe415ClsU8r+d2lu2OrioQw66yuXaKVVmJDox4lM=; b=PJGP9/cHpRXuEfxxc9/SvbZ+N8sE3rsfyj9X34d8ytJo3x7Cpe5k4FAcKCWtG3BY+v FiBZGjelfQR7zHiajPqWj9VQtAZ55Og/TXYpgWEM1A3wo5EEtzu/3os8GGXMK654GLnJ ZlMciljNSKz1VriFAFWa1JIhzOh+kJOc5sLy6UcZ24kcwb7s69cmW01T84by3NVXIp7y 1qVSXULa4/AwNGFCB5iAXQ+1ZJ4sa5W1wOD3EZkRtatKQidgsi6z8M0zh3h4Tc3xqQCz /l1aTiXKUxfq95+Frh5aSGXK1ESRGX/sm7GnafG28WAy0paoBWkx7GS4kjCr4/6PQuQc 39WQ== X-Gm-Message-State: AOAM5317MOhFFV9O9knU7A6oADgJG7fTsSwT7EEU2MWyVLgPRId+thNO +pscOpvSYNn38y3Bc2Dk5bw= X-Google-Smtp-Source: ABdhPJwzZz94WmC8lHVpfh9ZxbZ3pmbp326Whl3c4XovbmCUf/iVlGdjOPB6ecUoqMTwTurPYy/OWw== X-Received: by 2002:a05:6214:1d05:: with SMTP id e5mr3572044qvd.36.1614272259962; Thu, 25 Feb 2021 08:57:39 -0800 (PST) Received: from ?IPv6:2620:10d:c0a8:1102:2c94:8b30:36b0:69d? ([2620:10d:c091:480::1:6adc]) by smtp.googlemail.com with ESMTPSA id v12sm3869299qtw.73.2021.02.25.08.57.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 25 Feb 2021 08:57:39 -0800 (PST) To: GCC Patches From: Nathan Sidwell Subject: c++: Rename new -flang-note-module-read option [PR 99166] Message-ID: <388002cc-6657-f58f-76ac-24f791234674@acm.org> Date: Thu, 25 Feb 2021 11:57:38 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 Content-Language: en-US X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" I realized that the just-added flang-note-module-read option should also cover module writes, and was therefore misnamed. This addresses that, replacing it with a -flang-note-module-cmi pair of options. As this was such a recent addition, I didn't leave the old option available. PR c++/99166 gcc/c-family/ * c.opt (-flang-info-module-cmi): Renamed option. gcc/ * doc/invoke.texi (flang-info-module-cmi): Renamed option. gcc/cp/ * module.cc (module_state::inform_cmi_p): Renamed field. (module_state::do_import): Adjust. (init_modules, finish_module_processing): Likewise. (handle_module_option): Likewise. gcc/testsuite/ * g++.dg/modules/pr99166_a.X: Adjust. * g++.dg/modules/pr99166_b.C: Adjust. * g++.dg/modules/pr99166_c.C: Adjust. * g++.dg/modules/pr99166_d.C: Adjust. diff --git c/gcc/c-family/c.opt w/gcc/c-family/c.opt index 3264c646ad3..64e46e7573e 100644 --- c/gcc/c-family/c.opt +++ w/gcc/c-family/c.opt @@ -1752,11 +1752,11 @@ flang-info-include-translate= C++ Joined RejectNegative MissingArgError(missing header name) Note a #include translation of a specific header. -flang-info-module-read -C++ Var(note_module_read_yes) +flang-info-module-cmi +C++ Var(note_module_cmi_yes) Note Compiled Module Interface pathnames. -flang-info-module-read= +flang-info-module-cmi= C++ Joined RejectNegative MissingArgError(missing module name) Note Compiled Module Interface pathname of a specific module or header-unit. diff --git c/gcc/cp/module.cc w/gcc/cp/module.cc index e576face0d8..0cb5bd9b644 100644 --- c/gcc/cp/module.cc +++ w/gcc/cp/module.cc @@ -3552,7 +3552,7 @@ class GTY((chain_next ("%h.parent"), for_user)) module_state { do it again */ bool call_init_p : 1; /* This module's global initializer needs calling. */ - bool inform_read_p : 1; /* Inform of a read. */ + bool inform_cmi_p : 1; /* Inform of a read/write. */ bool visited_p : 1; /* A walk-once flag. */ /* Record extensions emitted or permitted. */ unsigned extensions : SE_BITS; @@ -3789,7 +3789,7 @@ module_state::module_state (tree name, module_state *parent, bool partition) partition_p = partition; - inform_read_p = false; + inform_cmi_p = false; visited_p = false; extensions = 0; @@ -18699,7 +18699,7 @@ module_state::do_import (cpp_reader *reader, bool outermost) { const char *file = maybe_add_cmi_prefix (filename); dump () && dump ("CMI is %s", file); - if (note_module_read_yes || inform_read_p) + if (note_module_cmi_yes || inform_cmi_p) inform (loc, "reading CMI %qs", file); fd = open (file, O_RDONLY | O_CLOEXEC | O_BINARY); e = errno; @@ -19695,7 +19695,7 @@ init_modules (cpp_reader *reader) 0, is_pathname, name, len); } if (auto module = get_module (name)) - module->inform_read_p = 1; + module->inform_cmi_p = 1; else error ("invalid module name %qs", name); } @@ -19903,6 +19903,8 @@ finish_module_processing (cpp_reader *reader) break; create_dirs (tmp_name); } + if (note_module_cmi_yes || state->inform_cmi_p) + inform (state->loc, "writing CMI %qs", path); dump () && dump ("CMI is %s", path); } @@ -19915,7 +19917,7 @@ finish_module_processing (cpp_reader *reader) if (to.begin ()) { auto loc = input_location; - /* So crashes finger point the module decl. */ + /* So crashes finger-point the module decl. */ input_location = state->loc; state->write (&to, reader); input_location = loc; @@ -20085,7 +20087,7 @@ handle_module_option (unsigned code, const char *str, int) vec_safe_push (note_includes, str); return true; - case OPT_flang_info_module_read_: + case OPT_flang_info_module_cmi_: vec_safe_push (note_cmis, str); return true; diff --git c/gcc/doc/invoke.texi w/gcc/doc/invoke.texi index ea315f1be58..546e95453c1 100644 --- c/gcc/doc/invoke.texi +++ w/gcc/doc/invoke.texi @@ -242,7 +242,7 @@ in the following sections. -fext-numeric-literals @gol -flang-info-include-translate@r{[}=@var{header}@r{]} @gol -flang-info-include-translate-not @gol --flang-info-module-read@r{[}=@var{module}@r{]} @gol +-flang-info-module-cmi@r{[}=@var{module}@r{]} @gol -stdlib=@var{libstdc++,libc++} @gol -Wabi-tag -Wcatch-value -Wcatch-value=@var{n} @gol -Wno-class-conversion -Wclass-memaccess @gol @@ -3390,9 +3390,9 @@ translations relating to that specific header. If @var{header} is of the form @code{"user"} or @code{} it will be resolved to a specific user or system header using the include path. -@item -flang-info-module-read -@itemx -flang-info-module-read=@var{module} -@opindex flang-info-module-read +@item -flang-info-module-cmi +@itemx -flang-info-module-cmi=@var{module} +@opindex flang-info-module-cmi Inform of Compiled Module Interface pathnames. The first will note all read CMI pathnames. The @var{module} form will not reading a specific module's CMI. @var{module} may be a named module or a @@ -33063,7 +33063,7 @@ option may be helpful in determining whether include translation is happening---if it is working correctly, it behaves as if it isn't there at all. -The @option{-flang-info-module-read} option can be used to determine +The @option{-flang-info-module-cmi} option can be used to determine where the compiler is reading a CMI from. Without the option, the compiler is silent when such a read is successful. This option has an optional argument, which will restrict the notification to just the @@ -33142,7 +33142,8 @@ pairs, one per line. Only the mappings for the direct imports and any module export name need be provided. If other mappings are provided, they override those stored in any imported CMI files. A repository root may be specified in the mapping file by using @samp{$root} as the -module name in the first active line. +module name in the first active line. Use of this option will disable +any default module->CMI name mapping. @end table diff --git c/gcc/testsuite/g++.dg/modules/pr99166_a.X w/gcc/testsuite/g++.dg/modules/pr99166_a.X index ad7ce7edf45..0649d053b30 100644 --- c/gcc/testsuite/g++.dg/modules/pr99166_a.X +++ w/gcc/testsuite/g++.dg/modules/pr99166_a.X @@ -1,6 +1,7 @@ // PR c++/99166, diagnostic -// { dg-additional-options {-x c++-system-header iostream -fmodules-ts} } +// { dg-additional-options {-x c++-system-header iostream -fmodules-ts -flang-info-module-cmi} } +// { dg-regexp {[^\n]*iostream: note: writing CMI 'gcm.cache/[^[\n]*iostream.gcm'\n} } // { dg-prune-output {linker input file unused} } NO DO NOT COMPILE diff --git c/gcc/testsuite/g++.dg/modules/pr99166_b.C w/gcc/testsuite/g++.dg/modules/pr99166_b.C index 64c5a8647ec..ac20116e641 100644 --- c/gcc/testsuite/g++.dg/modules/pr99166_b.C +++ w/gcc/testsuite/g++.dg/modules/pr99166_b.C @@ -1,7 +1,7 @@ -// { dg-additional-options {-fmodules-ts -flang-info-module-read=} } +// { dg-additional-options {-fmodules-ts -flang-info-module-cmi=} } export module Foo; import ; export void frob (); -// { dg-regexp {In module imported at [^\n]*pr99166_b.C:[0-9:]*\n[^\b]*iostream: note: reading CMI 'gcm.cache/[^[\n]*iostream.gcm'\n} } +// { dg-regexp {In module imported at [^\n]*pr99166_b.C:[0-9:]*\n[^\n]*iostream: note: reading CMI 'gcm.cache/[^[\n]*iostream.gcm'\n} } diff --git c/gcc/testsuite/g++.dg/modules/pr99166_c.C w/gcc/testsuite/g++.dg/modules/pr99166_c.C index d098f07279d..424aa1d108a 100644 --- c/gcc/testsuite/g++.dg/modules/pr99166_c.C +++ w/gcc/testsuite/g++.dg/modules/pr99166_c.C @@ -1,4 +1,4 @@ -// { dg-additional-options {-fmodules-ts -flang-info-module-read=Foo} } +// { dg-additional-options {-fmodules-ts -flang-info-module-cmi=Foo} } module Foo; -// { dg-regexp {In module imported at [^\n]*pr99166_c.C:[0-9:]*\n[^\b]*Foo: note: reading CMI 'gcm.cache/Foo.gcm'\n} } +// { dg-regexp {In module imported at [^\n]*pr99166_c.C:[0-9:]*\n[^\n]*Foo: note: reading CMI 'gcm.cache/Foo.gcm'\n} } diff --git c/gcc/testsuite/g++.dg/modules/pr99166_d.C w/gcc/testsuite/g++.dg/modules/pr99166_d.C index 423053ec9ff..dbdfacc22a4 100644 --- c/gcc/testsuite/g++.dg/modules/pr99166_d.C +++ w/gcc/testsuite/g++.dg/modules/pr99166_d.C @@ -1,6 +1,6 @@ -// { dg-additional-options {-fmodules-ts -flang-info-module-read} } +// { dg-additional-options {-fmodules-ts -flang-info-module-cmi} } import Foo; -// { dg-regexp {In module imported at [^\n]*pr99166_d.C:[0-9:]*\n[^\b]*Foo: note: reading CMI 'gcm.cache/Foo.gcm'\n} } +// { dg-regexp {In module imported at [^\n]*pr99166_d.C:[0-9:]*\n[^\n]*Foo: note: reading CMI 'gcm.cache/Foo.gcm'\n} } -// { dg-regexp {In module imported at [^\n]*pr99166_b.C:[0-9:]*,\nof module Foo, imported at [^\n]*pr99166_d.C:[0-9:]:\n[^\b]*iostream: note: reading CMI 'gcm.cache/[^[\n]*iostream.gcm'\n} } +// { dg-regexp {In module imported at [^\n]*pr99166_b.C:[0-9:]*,\nof module Foo, imported at [^\n]*pr99166_d.C:[0-9:]:\n[^\n]*iostream: note: reading CMI 'gcm.cache/[^[\n]*iostream.gcm'\n} }