From patchwork Mon Feb 4 15:00:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 1035991 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-495259-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="DjIK06Il"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43tW9x6KXKz9s4Z for ; Tue, 5 Feb 2019 02:01:09 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :subject:to:message-id:date:mime-version:content-type; q=dns; s= default; b=EN5FH1fIZB/nEyCEe6nn56DSvKEDZXwa0kRdI6hilWaNXNIUpmRK2 MMhxolZjri3M4BK9ttp9sP1zQdK8kcYGLOfIjCKUyflZRzOOMDK1Bs//9K6K7Jlc tR8bEXtAYJLKIYxxQif8hLusqsgnjjDG/xPiUj7YvU3hPl7/TJswf4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :subject:to:message-id:date:mime-version:content-type; s= default; bh=c6g6CpvruJPa9E4aWPqrxF52LG0=; b=DjIK06Il1osCy1WwuYfz HHQ5CKKbTul7HwHbK/isFK0ic9Y25LtE1HYgdQcyJf/I+VALpoH5YAlq+aqNC3HP 3dlzbWd7nTqqOVSy7R3JtFk8K5l0fUwNvti1onT+kettPOWv8TyMOD+JqoA2QA0r koLHmN42kvu8XUbEqbo6Cf4= Received: (qmail 41033 invoked by alias); 4 Feb 2019 15:01:02 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 40948 invoked by uid 89); 4 Feb 2019 15:01:00 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.2 spammy=human, bases X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 04 Feb 2019 15:00:59 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 31809AC38 for ; Mon, 4 Feb 2019 15:00:54 +0000 (UTC) From: =?utf-8?q?Martin_Li=C5=A1ka?= Subject: [PATCH] GCOV: remove misleading branches and calls info for -f option (PR gcov-profile/89000). To: gcc-patches@gcc.gnu.org Message-ID: Date: Mon, 4 Feb 2019 16:00:53 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.3 MIME-Version: 1.0 X-IsSubscribed: yes Hi. The patch removes branches and calls information when using -f option. I re-implemented how we calculate branches and calls summaries and right now we can't print them on function bases. Thus I'm removing that. One can take the information from *.gcov file or calculate that easily from an intermediate format. Patch can bootstrap on x86_64-linux-gnu and survives regression tests. I'll install it in couple of days. Thanks, Martin gcc/ChangeLog: 2019-02-04 Martin Liska PR gcov-profile/89000 * gcov.c (function_summary): Remove argument. (file_summary): New function. (print_usage): Replace tabs with spaces. (generate_results): Use new function file_summary. --- gcc/gcov.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/gcc/gcov.c b/gcc/gcov.c index cb6bc7ef85f..9e27a826ea4 100644 --- a/gcc/gcov.c +++ b/gcc/gcov.c @@ -615,7 +615,8 @@ static void find_exception_blocks (function_info *); static void add_branch_counts (coverage_info *, const arc_info *); static void add_line_counts (coverage_info *, function_info *); static void executed_summary (unsigned, unsigned); -static void function_summary (const coverage_info *, const char *); +static void function_summary (const coverage_info *); +static void file_summary (const coverage_info *); static const char *format_gcov (gcov_type, gcov_type, int); static void accumulate_line_counts (source_info *); static void output_gcov_file (const char *, source_info *); @@ -886,7 +887,7 @@ print_usage (int error_p) fnotice (file, " -d, --display-progress Display progress information\n"); fnotice (file, " -f, --function-summaries Output summaries for each function\n"); fnotice (file, " -h, --help Print this help, then exit\n"); - fnotice (file, " -i, --json-format Output JSON intermediate format into .gcov.json.gz file\n"); + fnotice (file, " -i, --json-format Output JSON intermediate format into .gcov.json.gz file\n"); fnotice (file, " -j, --human-readable Output human readable numbers\n"); fnotice (file, " -k, --use-colors Emit colored output\n"); fnotice (file, " -l, --long-file-names Use long output file names for included\n\ @@ -1376,7 +1377,7 @@ generate_results (const char *file_name) add_line_counts (flag_function_summary ? &coverage : NULL, fn); if (flag_function_summary) { - function_summary (&coverage, "Function"); + function_summary (&coverage); fnotice (stdout, "\n"); } } @@ -1427,7 +1428,7 @@ generate_results (const char *file_name) accumulate_line_counts (src); if (!flag_use_stdout) - function_summary (&src->coverage, "File"); + file_summary (&src->coverage); total_lines += src->coverage.lines; total_executed += src->coverage.lines_executed; if (flag_gcov_file) @@ -2339,12 +2340,21 @@ executed_summary (unsigned lines, unsigned executed) fnotice (stdout, "No executable lines\n"); } -/* Output summary info for a function or file. */ +/* Output summary info for a function. */ static void -function_summary (const coverage_info *coverage, const char *title) +function_summary (const coverage_info *coverage) { - fnotice (stdout, "%s '%s'\n", title, coverage->name); + fnotice (stdout, "%s '%s'\n", "Function", coverage->name); + executed_summary (coverage->lines, coverage->lines_executed); +} + +/* Output summary info for a file. */ + +static void +file_summary (const coverage_info *coverage) +{ + fnotice (stdout, "%s '%s'\n", "File", coverage->name); executed_summary (coverage->lines, coverage->lines_executed); if (flag_branches)