mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-21 00:21:03 +08:00
c++: Rename new -flang-note-module-read option [PR 99166]
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.
This commit is contained in:
parent
9f08c08531
commit
9592deabf3
@ -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.
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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} }
|
||||
|
@ -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} }
|
||||
|
@ -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} }
|
||||
|
Loading…
x
Reference in New Issue
Block a user