]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: Rename new -flang-note-module-read option [PR 99166]
authorNathan Sidwell <nathan@acm.org>
Thu, 25 Feb 2021 16:33:05 +0000 (08:33 -0800)
committerNathan Sidwell <nathan@acm.org>
Thu, 25 Feb 2021 16:58:26 +0000 (08:58 -0800)
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.

gcc/c-family/c.opt
gcc/cp/module.cc
gcc/doc/invoke.texi
gcc/testsuite/g++.dg/modules/pr99166_a.X
gcc/testsuite/g++.dg/modules/pr99166_b.C
gcc/testsuite/g++.dg/modules/pr99166_c.C
gcc/testsuite/g++.dg/modules/pr99166_d.C

index 3264c646ad3f6a3c44752c229f47f803c4ea9ec5..64e46e7573ef58fac424bc40c7d5981fdca001c1 100644 (file)
@@ -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.
 
index e576face0d84ec76178060c2f9aa7e1751ba1da4..0cb5bd9b6440cc6cc30d7e2f94fe2b162aa05c05 100644 (file)
@@ -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;
 
index ea315f1be58a10bd435aa46fb310ba753480887f..546e95453c1cf0ec439155f87d8b9f95ac0d1a1a 100644 (file)
@@ -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{<system>} 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
 
index ad7ce7edf45763faa497126367d8d2dab12b66e0..0649d053b306b4cea6a32df81a392635eb8625b8 100644 (file)
@@ -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
index 64c5a8647ecd64312d9fd5a3073c835572a5f37d..ac20116e641e945d297305979106db0d759b9345 100644 (file)
@@ -1,7 +1,7 @@
-// { dg-additional-options {-fmodules-ts -flang-info-module-read=<iostream>} }
+// { dg-additional-options {-fmodules-ts -flang-info-module-cmi=<iostream>} }
 export module Foo;
 import <iostream>;
 
 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} }
index d098f07279d01733d8fb7a861e82a8e2e66fff7b..424aa1d108acc3577aed5ab5846240330c0d559c 100644 (file)
@@ -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} }
index 423053ec9ff94fa50d80677656788cd43a70bb16..dbdfacc22a4b87696262e21378221f98679ee976 100644 (file)
@@ -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} }