From: marxin Date: Mon, 27 Aug 2018 08:01:54 +0000 (+0000) Subject: Do not read gcda files multiple times (PR gcov-profile/87069). X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7a1613eab16c08a6c429cbe9000ff11faa903b3d;p=thirdparty%2Fgcc.git Do not read gcda files multiple times (PR gcov-profile/87069). 2018-08-27 Martin Liska PR gcov-profile/87069 * gcov.c (process_file): Record files already processed and warn about a file being processed multiple times. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@263871 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fa112074f0a1..bc3f2e0da38a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-08-27 Martin Liska + + PR gcov-profile/87069 + * gcov.c (process_file): Record files already processed + and warn about a file being processed multiple times. + 2018-08-27 Martin Liska PR driver/83193 diff --git a/gcc/gcov.c b/gcc/gcov.c index 43dfc9a4b2c9..ff4020c713e6 100644 --- a/gcc/gcov.c +++ b/gcc/gcov.c @@ -408,6 +408,10 @@ static vector sources; /* Mapping of file names to sources */ static vector names; +/* Record all processed files in order to warn about + a file being read multiple times. */ +static vector 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 (); }