diff mbox

[v2] gcov: Runtime configurable destination output

Message ID f7ty46l9mqp.fsf@redhat.com
State New
Headers show

Commit Message

Aaron Conole June 4, 2016, 12:12 p.m. UTC
> It breaks profiledbootstrap:
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71400

I am including a patch that should fix the issues introduced by my
patch.  I have confirmed behavior on my system, and built with
profiledbootstrap as well as bootstrap.

libgcc/ChangeLog:
2016-06-04  Aaron Conole  <aconole@redhat.com>

	* libgcov-driver-system.c (gcov_error): Remove
          redundant assignment.
          (get_gcov_error_file): Invert the IN_GCOV_TOOL test
          (__gcov_error_file): Only use this when !IN_GCOV_TOOL

---
 libgcc/libgcov-driver-system.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
diff mbox

Patch

diff --git a/libgcc/libgcov-driver-system.c b/libgcc/libgcov-driver-system.c
index ff8a521..6bfe6ba 100644
--- a/libgcc/libgcov-driver-system.c
+++ b/libgcc/libgcov-driver-system.c
@@ -27,7 +27,9 @@  see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
    it will either be stderr, or a file of the user's choosing.
    Non-static to prevent multiple gcov-aware shared objects from
    instantiating their own copies. */
+#if !IN_GCOV_TOOL
 FILE *__gcov_error_file = NULL;
+#endif
 
 /* A utility function to populate the __gcov_error_file pointer.
    This should NOT be called outside of the gcov system driver code. */
@@ -35,7 +37,7 @@  FILE *__gcov_error_file = NULL;
 static FILE *
 get_gcov_error_file(void)
 {
-#if !IN_GCOV_TOOL
+#if IN_GCOV_TOOL
   return stderr;
 #else
   char *gcov_error_filename = getenv ("GCOV_ERROR_FILE");
@@ -60,11 +62,8 @@  gcov_error (const char *fmt, ...)
   int ret;
   va_list argp;
 
-  if (!__gcov_error_file)
-    __gcov_error_file = get_gcov_error_file ();
-
   va_start (argp, fmt);
-  ret = vfprintf (__gcov_error_file, fmt, argp);
+  ret = vfprintf (get_gcov_error_file (), fmt, argp);
   va_end (argp);
   return ret;
 }