From d273c40a5568a1e2d048209826bdb778b4b75bde Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Fri, 18 Jan 2019 12:31:45 +0100 Subject: [PATCH] Update error message prefix in libgcov profiling. 2019-01-18 Martin Liska * libgcov-driver.c (GCOV_PROF_PREFIX): Define. (gcov_version): Use in gcov_error. (merge_one_data): Likewise. (dump_one_gcov): Likewise. From-SVN: r268070 --- libgcc/ChangeLog | 7 +++++++ libgcc/libgcov-driver.c | 19 +++++++++++-------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 055836fb2b0..94a8623958f 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,10 @@ +2019-01-18 Martin Liska + + * libgcov-driver.c (GCOV_PROF_PREFIX): Define. + (gcov_version): Use in gcov_error. + (merge_one_data): Likewise. + (dump_one_gcov): Likewise. + 2019-01-18 Martin Liska * libgcov-driver.c (gcov_version_string): New function. diff --git a/libgcc/libgcov-driver.c b/libgcc/libgcov-driver.c index 41d28ace926..5dc51df914f 100644 --- a/libgcc/libgcov-driver.c +++ b/libgcc/libgcov-driver.c @@ -53,6 +53,8 @@ static void gcov_error_exit (void); #include "gcov-io.c" +#define GCOV_PROF_PREFIX "libgcov profiling error:%s:" + struct gcov_fn_buffer { struct gcov_fn_buffer *next; @@ -151,7 +153,7 @@ buffer_fn_data (const char *filename, const struct gcov_info *gi_ptr, return &fn_buffer->next; fail: - gcov_error ("profiling:%s:Function %u %s %u \n", filename, fn_ix, + gcov_error (GCOV_PROF_PREFIX "Function %u %s %u \n", filename, fn_ix, len ? "cannot allocate" : "counter mismatch", len ? len : ix); return (struct gcov_fn_buffer **)free_fn_data (gi_ptr, fn_buffer, ix); @@ -195,7 +197,7 @@ gcov_version (struct gcov_info *ptr, gcov_unsigned_t version, GCOV_UNSIGNED2STRING (v, version); GCOV_UNSIGNED2STRING (e, GCOV_VERSION); - gcov_error ("profiling:%s:Version mismatch - expected %s (%.4s) " + gcov_error (GCOV_PROF_PREFIX "Version mismatch - expected %s (%.4s) " "got %s (%.4s)\n", filename? filename : ptr->filename, gcov_version_string (expected_string, e), e, @@ -234,7 +236,7 @@ merge_one_data (const char *filename, if (length != gi_ptr->stamp) { /* Read from a different compilation. Overwrite the file. */ - gcov_error ("profiling:%s:overwriting an existing profile data " + gcov_error (GCOV_PROF_PREFIX "overwriting an existing profile data " "with a different timestamp\n", filename); return 0; } @@ -314,7 +316,7 @@ merge_one_data (const char *filename, if (tag) { read_mismatch:; - gcov_error ("profiling:%s:Merge mismatch for %s %u\n", + gcov_error (GCOV_PROF_PREFIX "Merge mismatch for %s %u\n", filename, f_ix >= 0 ? "function" : "summary", f_ix < 0 ? -1 - f_ix : f_ix); return -1; @@ -322,7 +324,7 @@ merge_one_data (const char *filename, return 0; read_error: - gcov_error ("profiling:%s:%s merging\n", filename, + gcov_error (GCOV_PROF_PREFIX "%s merging\n", filename, error < 0 ? "Overflow": "Error"); return -1; } @@ -520,7 +522,8 @@ dump_one_gcov (struct gcov_info *gi_ptr, struct gcov_filename *gf, /* Merge data from file. */ if (tag != GCOV_DATA_MAGIC) { - gcov_error ("profiling:%s:Not a gcov data file\n", gf->filename); + gcov_error (GCOV_PROF_PREFIX "Not a gcov data file\n", + gf->filename); goto read_fatal; } error = merge_one_data (gf->filename, gi_ptr, &summary); @@ -541,8 +544,8 @@ read_fatal:; if ((error = gcov_close ())) gcov_error (error < 0 ? - "profiling:%s:Overflow writing\n" : - "profiling:%s:Error writing\n", + GCOV_PROF_PREFIX "Overflow writing\n" : + GCOV_PROF_PREFIX "Error writing\n", gf->filename); } -- 2.30.2