diff options
author | Martin Liska <mliska@suse.cz> | 2018-06-07 06:21:35 +0200 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2018-06-07 04:21:35 +0000 |
commit | 6c086e8c75deaedb7db807d8008529747b275275 (patch) | |
tree | bf1b9fcbe6c7ae18bf10e75a89c7d5437a865a21 /libgcc/libgcov-driver.c | |
parent | 37777cd0335f3220e4cbe263099af633f1e1c645 (diff) | |
download | gcc-6c086e8c75deaedb7db807d8008529747b275275.zip gcc-6c086e8c75deaedb7db807d8008529747b275275.tar.gz gcc-6c086e8c75deaedb7db807d8008529747b275275.tar.bz2 |
Fix libgcov-driver-system bootstrap failure (PR bootstrap/86057).
2018-06-07 Martin Liska <mliska@suse.cz>
PR bootstrap/86057
* libgcov-driver-system.c (replace_filename_variables): Use
memcpy instead of mempcpy.
(allocate_filename_struct): Do not allocate filename, allocate
prefix and set it.
(gcov_exit_open_gcda_file): Allocate memory for gf->filename
here and properly copy content into it.
* libgcov-driver.c (struct gcov_filename): Remove max_length
field, change prefix from size_t into char *.
(compute_summary): Do not calculate longest filename.
(gcov_do_dump): Release memory of gf.filename after each file.
* libgcov-util.c (compute_summary): Use new signature of
compute_summary.
(calculate_overlap): Likewise.
From-SVN: r261260
Diffstat (limited to 'libgcc/libgcov-driver.c')
-rw-r--r-- | libgcc/libgcov-driver.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/libgcc/libgcov-driver.c b/libgcc/libgcov-driver.c index 922d9dd..7ae33b8 100644 --- a/libgcc/libgcov-driver.c +++ b/libgcc/libgcov-driver.c @@ -72,9 +72,8 @@ struct gcov_summary_buffer struct gcov_filename { char *filename; /* filename buffer */ - size_t max_length; /* maximum filename length */ int strip; /* leading chars to strip from filename */ - size_t prefix; /* chars to prepend to filename */ + char *prefix; /* prefix string */ }; static struct gcov_fn_buffer * @@ -259,15 +258,13 @@ static struct gcov_fn_buffer *fn_buffer; static struct gcov_summary_buffer *sum_buffer; /* This function computes the program level summary and the histo-gram. - It computes and returns CRC32 and stored summary in THIS_PRG. - Also determines the longest filename length of the info files. */ + It computes and returns CRC32 and stored summary in THIS_PRG. */ #if !IN_GCOV_TOOL static #endif gcov_unsigned_t -compute_summary (struct gcov_info *list, struct gcov_summary *this_prg, - size_t *max_length) +compute_summary (struct gcov_info *list, struct gcov_summary *this_prg) { struct gcov_info *gi_ptr; const struct gcov_fn_info *gfi_ptr; @@ -278,13 +275,8 @@ compute_summary (struct gcov_info *list, struct gcov_summary *this_prg, /* Find the totals for this execution. */ memset (this_prg, 0, sizeof (*this_prg)); - *max_length = 0; for (gi_ptr = list; gi_ptr; gi_ptr = gi_ptr->next) { - size_t len = strlen (gi_ptr->filename); - if (len > *max_length) - *max_length = len; - crc32 = crc32_unsigned (crc32, gi_ptr->stamp); crc32 = crc32_unsigned (crc32, gi_ptr->n_functions); @@ -799,7 +791,7 @@ gcov_do_dump (struct gcov_info *list, int run_counted) struct gcov_summary all_prg; struct gcov_summary this_prg; - crc32 = compute_summary (list, &this_prg, &gf.max_length); + crc32 = compute_summary (list, &this_prg); allocate_filename_struct (&gf); #if !GCOV_LOCKED @@ -808,9 +800,12 @@ gcov_do_dump (struct gcov_info *list, int run_counted) /* Now merge each file. */ for (gi_ptr = list; gi_ptr; gi_ptr = gi_ptr->next) - dump_one_gcov (gi_ptr, &gf, run_counted, crc32, &all_prg, &this_prg); + { + dump_one_gcov (gi_ptr, &gf, run_counted, crc32, &all_prg, &this_prg); + free (gf.filename); + } - free (gf.filename); + free (gf.prefix); } #if IN_GCOV_TOOL |