From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 56457 invoked by alias); 9 Nov 2017 09:12:41 -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 55924 invoked by uid 89); 9 Nov 2017 09:12:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_PASS autolearn=ham version=3.3.2 spammy=greater, HContent-Transfer-Encoding:8bit X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 09 Nov 2017 09:12:39 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 538B4AC08; Thu, 9 Nov 2017 09:12:36 +0000 (UTC) Subject: Re: [PATCH 8/N][RFC][v3]: GCOV: support multiple functions per a line To: Nathan Sidwell , gcc-patches@gcc.gnu.org References: <60989f3c-46cf-8955-06f4-e3216290a2a8@suse.cz> <4a1cdc29-7771-75a9-4731-eba29253ab40@acm.org> <939d4c6e-5aa4-9e56-4258-2449a526df5a@suse.cz> <02118052-011b-1354-490a-e0fb5672845f@acm.org> From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Message-ID: <4302e1d7-fd83-abea-dea9-46805c6cd0bd@suse.cz> Date: Thu, 09 Nov 2017 09:47:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <02118052-011b-1354-490a-e0fb5672845f@acm.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2017-11/txt/msg00703.txt.bz2 On 11/08/2017 03:57 PM, Nathan Sidwell wrote: > On 11/08/2017 06:03 AM, Martin Liška wrote: >> On 11/07/2017 03:49 PM, Nathan Sidwell wrote: >>> On 11/07/2017 05:53 AM, Martin Liška wrote: >>>> Hello. >>>> >>>> This is slightly updated version from the previous. Various small issues were fixed >>>> and I update documentation in order to reflect the changes. >>> >>>> +  gcov_write_unsigned (DECL_ARTIFICIAL (current_function_decl)); >>>>     gcov_write_filename (xloc.file); >>>>     gcov_write_unsigned (xloc.line); >>>> +  gcov_write_unsigned (expand_location (cfun->function_end_locus).line); >>>>     gcov_write_length (offset); >>> >>> this is presuming the end line is in the same file as the start line.  A reasonable assumption, but users can have exciting ideas!  What is the failure mode if the function straddles a file boundary? >> >> Hi. >> >> I decided to fix that with change that set line_end = line_start if line_end < line_start. >> That survives reasonably well with cases like this: > >> +  gcov_write_unsigned (DECL_ARTIFICIAL (current_function_decl)); >>    gcov_write_filename (xloc.file); >>    gcov_write_unsigned (xloc.line); >> +  gcov_write_unsigned (xloc.column); >> + >> +  /* Function can start in a single file and end in another one.  */ >> +  int fn_end_line = expand_location (cfun->function_end_locus).line; >> +  gcov_write_unsigned (fn_end_line > xloc.line ? fn_end_line : xloc.line); > > sorry to be picky, but of course the end line could be greater than the start. but in a different file.  Please check file too. That's fine, thank you for good feedback! > > >>> This isn't stable if they start on the same line.  Will output order depend on the vaguaries of the sorting algorithm? >>> >>>> +      vector &lines = (*it2)->lines; >>>> +      /* Print all lines covered by the function.  */ >>>> +      for (unsigned i = 0; i < lines.size (); i++) >> >> So fixed by introduction of line column that is used for sorting as well. > > thanks. >> May I understand the reply as ACK? > > Patch ok, with the above check for file names added. > > nathan > Just installed as r254562. I'm planning to apply some small code clean-up and I'm done :) Martin