Hi. This is simple fix of situation when a source file is passed on command line multiple times.
I'm planning to install that if no objection. Survives regression tests of gcov.exp. Martin gcc/ChangeLog: 2018-08-23 Martin Liska <mli...@suse.cz> PR gcov-profile/87069 * gcov.c (process_file): Record files already processed and warn about a file being processed multiple times. --- gcc/gcov.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
diff --git a/gcc/gcov.c b/gcc/gcov.c index 43dfc9a4b2c..ff4020c713e 100644 --- a/gcc/gcov.c +++ b/gcc/gcov.c @@ -408,6 +408,10 @@ static vector<source_info> sources; /* Mapping of file names to sources */ static vector<name_map> names; +/* Record all processed files in order to warn about + a file being read multiple times. */ +static vector<char *> processed_files; + /* This holds data summary information. */ static unsigned object_runs; @@ -1146,6 +1150,17 @@ static void process_file (const char *file_name) { create_file_names (file_name); + + for (unsigned i = 0; i < processed_files.size (); i++) + if (strcmp (da_file_name, processed_files[i]) == 0) + { + fnotice (stderr, "'%s' file is already processed\n", + file_name); + return; + } + + processed_files.push_back (xstrdup (da_file_name)); + read_graph_file (); read_count_file (); }