gcov: Fix first time gcov info dump

This patch fixes an issue introduced by commit
ef9a53feae:

gcc --coverage main.c && ./a.out
libgcov profiling error:a-main.gcda:Error writing

gcc/ChangeLog:

	* gcov-io.cc (gcov_rewrite):  Clear the file error status.
This commit is contained in:
Sebastian Huber 2022-05-02 08:44:16 +02:00
parent 3a3eda000f
commit 880a9845dc

View File

@ -79,11 +79,14 @@ gcov_is_error (void)
}
#if IN_LIBGCOV
/* Move to beginning of file and initialize for writing. */
/* Move to beginning of file, initialize for writing, and clear file error
status. */
GCOV_LINKAGE inline void
gcov_rewrite (void)
{
gcov_var.mode = -1;
gcov_var.error = GCOV_FILE_NO_ERROR;
fseek (gcov_var.file, 0L, SEEK_SET);
}
#endif