@@ -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;
}