From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 93885 invoked by alias); 19 May 2016 18:40:44 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 93873 invoked by uid 89); 19 May 2016 18:40:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=headquarters, ride, gcov, U*nathan X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 19 May 2016 18:40:33 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 661564AD75; Thu, 19 May 2016 18:40:30 +0000 (UTC) Received: from aconole-fed23 (dhcp-25-9.bos.redhat.com [10.18.25.9]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u4JIeSft025633 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 19 May 2016 14:40:28 -0400 From: Aaron Conole To: Nathan Sidwell Cc: gcc-patches@gcc.gnu.org, Jan Hubicka , Nathan Sidwell Subject: Re: [PATCH v2] gcov: Runtime configurable destination output References: <1456350732-8272-1-git-send-email-aconole@bytheb.org> Date: Thu, 19 May 2016 18:40:00 -0000 In-Reply-To: (Nathan Sidwell's message of "Fri, 6 May 2016 09:18:01 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2016-05/txt/msg01553.txt.bz2 Nathan Sidwell writes: > On 02/24/16 16:52, Aaron Conole wrote: >> The previous gcov behavior was to always output errors on the stderr channel. >> This is fine for most uses, but some programs will require stderr to be >> untouched by libgcov for certain tests. This change allows configuring >> the gcov output via an environment variable which will be used to open >> the appropriate file. > > this is ok in principle. I have a couple of questions & nits below though. Thank you for the consideration. I will be submitting a new patch that I hope fully addresses your comments below, either tomorrow or Monday. Thanks so much for the review. > I don't see a previous commit from you -- do you have a copyright > assignment with the FSF? (although this patch is simple, my guess is > the idea it implements is sufficiently novel to need one). We can > handle that off list. I'm happy to report that I did send in some FSF paperwork this week. Hopefully it is on record now, but even if it isn't I live a train ride away from the FSF headquarters so I'd be happy to take the time to make sure it's all signed correctly. >> diff --git a/libgcc/libgcov-driver-system.c b/libgcc/libgcov-driver-system.c >> index 4e3b244..0eb9755 100644 >> --- a/libgcc/libgcov-driver-system.c >> +++ b/libgcc/libgcov-driver-system.c >> @@ -23,6 +23,24 @@ a copy of the GCC Runtime Library Exception along >> with this program; >> see the files COPYING3 and COPYING.RUNTIME respectively. If not, see >> . */ >> >> +FILE *__gcov_error_file = NULL; > > Unless I'm missing something, isn't this only accessed from this file? > (So could be static with a non-underbarred name) Ack. >> @@ -30,12 +48,27 @@ gcov_error (const char *fmt, ...) >> { >> int ret; >> va_list argp; >> + >> + if (!__gcov_error_file) >> + __gcov_error_file = get_gcov_error_file(); > > Needs space before () Ack. >> + >> va_start (argp, fmt); >> - ret = vfprintf (stderr, fmt, argp); >> + ret = vfprintf (__gcov_error_file, fmt, argp); >> va_end (argp); >> return ret; >> } >> >> +#if !IN_GCOV_TOOL > > And this protection here, makes me wonder what happens if one is > IN_GCOV_TOOL. Does it pay attention to GCOV_ERROR_FILE? That would > seem incorrect, and thus the above should be changed so that stderr is > unconditionally used when IN_GCOV_TOOL? You are correct. I will fix it. >> +static void >> +gcov_error_exit(void) >> +{ >> + if (__gcov_error_file && __gcov_error_file != stderr) >> + { > > Braces are not needed here. Ack. >> --- a/libgcc/libgcov-driver.c >> +++ b/libgcc/libgcov-driver.c >> @@ -46,6 +46,10 @@ void __gcov_init (struct gcov_info *p >> __attribute__ ((unused))) {} > >> + gcov_error_exit(); > > Needs space before (). Ack. > nathan