From patchwork Mon Aug 22 19:25:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 657 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:ecc5:0:0:0:0:0 with SMTP id s5csp639236wro; Mon, 22 Aug 2022 12:26:56 -0700 (PDT) X-Google-Smtp-Source: AA6agR4EfLvtb1DfyRmiKaSCSOyhGzaXXDMV2jIw7Pr5kOhjXvbhL+vxDRWIJJ93Vdk+7mwJzIHj X-Received: by 2002:aa7:cb06:0:b0:446:7668:2969 with SMTP id s6-20020aa7cb06000000b0044676682969mr568688edt.206.1661196415990; Mon, 22 Aug 2022 12:26:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661196415; cv=none; d=google.com; s=arc-20160816; b=kskfk2jcWiusWw375kCP4SUDb5RcEkenhsu5WnZhTH5U2J2al/iOyY/yHhwHc8P13g OpntLw2ggBTKYeRX3u99meJg3zpwIsFTZCOMsmfuHwslCU/vZ297qKs5i/ph0azBazWO FhdV4du2hqAcIPVebQF0Mihqh7gL+SYUmAvEA8/w0rVSKVLM5SP1z/KRRlyyv8D7lQ0X DMBccKGAye/RfiZX/GaqCycDwgs0I/MWt+/lES0UhRx5V+W/lY6FSXYc3pr8oo/IF78b Wp/Fls0MX323/rB5KHGGmZm1weA6hg584JR5FQppryGJq6siFfa7gRWNEkIODlznF81h 3HOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :in-reply-to:content-language:references:to:subject:from:user-agent :mime-version:date:message-id:dkim-signature:dkim-signature :dmarc-filter:delivered-to; bh=BYJ03DRFM8obm+nDifmEiBzAADdM+weTS3klis5PLCU=; b=zPUEjgd+aFku4ICddM7+N+9Sr6Ecws1HCwJCI6gzNiENsH2tmc7pDd0EFAGfQAiUcw 0PpvEW9va7dZt+NlbDvQqv/uh08QmG6QD8jbfZxYvQKIpQ61s8Bgp3aAkTl+0mEDRcu2 5XFaYSs+Yy+djpl1aVP3R1gl3hc2mhPjTYyNkFSNn17sRs5p1UbnrIz4BZ+j4mTRV6Mp fk9Fmaa026PF/aB609ixtOb/UuNh7WhPCPJwIhYtd9KRUakrN6QZs/RDgv/3nEueTJzn 7XUzLWdZXgPPqdC14GTWXV1HVf5ir7bmv/HTYdowg/zq5PDrrVSV3uST31zVv7qJnNsx dr/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@suse.cz header.s=susede2_rsa header.b=z6quQ+bC; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=zwHTqajH; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id y12-20020a50e60c000000b0043e8539199bsi218005edm.489.2022.08.22.12.26.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 12:26:55 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=fail header.i=@suse.cz header.s=susede2_rsa header.b=z6quQ+bC; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=zwHTqajH; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EBF913857C65 for ; Mon, 22 Aug 2022 19:26:26 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id DB97E3858D32; Mon, 22 Aug 2022 19:26:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DB97E3858D32 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.cz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 9222637213; Mon, 22 Aug 2022 19:25:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1661196359; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BYJ03DRFM8obm+nDifmEiBzAADdM+weTS3klis5PLCU=; b=z6quQ+bCIvYy9c4xsRCVQjCQUhvvFa6uU73+d1pgbpAEQyjLomXglvM0w66U0DDeHd70uX 59vesQhuuJSu3iChwLYBKbE+o6yk2Hr8K4z/KG0RLUm1KTjE35/S7OsID0iB8o+Xla5p11 Ew2VHEayb6X2I5QksHMrt2/KIVyBGpM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1661196359; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BYJ03DRFM8obm+nDifmEiBzAADdM+weTS3klis5PLCU=; b=zwHTqajH789v2DLkfkDDcfdm3HWZLqS+E8mOWrV7S+eusuuBm9SFWnUsKaSC8uqtOeZptS UdLCkLhrUzfd+iBA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 6C5E713523; Mon, 22 Aug 2022 19:25:59 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id TpZvGUfYA2PBawAAMHmgww (envelope-from ); Mon, 22 Aug 2022 19:25:59 +0000 Message-ID: <643928f9-d0e0-e099-6846-d3548f14b455@suse.cz> Date: Mon, 22 Aug 2022 21:25:58 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.1.2 From: =?utf-8?q?Martin_Li=C5=A1ka?= Subject: [PATCH] gcov: fix file and function summary information To: gcc-patches@gcc.gnu.org References: <3c93e70d-293e-2190-125b-f840c31d2087@lambda.is> Content-Language: en-US In-Reply-To: <3c93e70d-293e-2190-125b-f840c31d2087@lambda.is> X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: GCC Development , =?utf-8?q?J=C3=B8rgen_Kvalsvik?= Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1741890693047885692?= X-GMAIL-MSGID: =?utf-8?q?1741890693047885692?= Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Jorgen: Can you please test it before I'll install it? Thanks, Martin gcc/ChangeLog: * gcov.cc (add_line_counts): Add group functions to coverage summary. (accumulate_line_counts): Similarly for files. Co-Authored-By: Jørgen Kvalsvik --- gcc/gcov.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gcc/gcov.cc b/gcc/gcov.cc index 27be5ff0911..9cf1071166f 100644 --- a/gcc/gcov.cc +++ b/gcc/gcov.cc @@ -2694,6 +2694,13 @@ add_line_counts (coverage_info *coverage, function_info *fn) { gcc_assert (lines[j] - fn->start_line < fn->lines.size ()); line = &(fn->lines[lines[j] - fn->start_line]); + if (coverage) + { + if (!line->exists) + coverage->lines++; + if (!line->count && block->count) + coverage->lines_executed++; + } line->exists = 1; if (!block->exceptional) { @@ -2815,7 +2822,7 @@ accumulate_line_counts (source_info *src) it2 != fn->lines.end (); it2++) { line_info *line = &(*it2); - accumulate_line_info (line, src, false); + accumulate_line_info (line, src, true); } }