From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Cc: =?UTF-8?Q?J=c3=b8rgen_Kvalsvik?= , GCC Development In-Reply-To: <3c93e70d-293e-2190-125b-f840c31d2087@lambda.is> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Aug 2022 19:26:03 -0000 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); } } -- 2.37.2