From patchwork Thu Nov 9 10:24:05 2017 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: 836277 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-466369-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="yiDS3OP6"; 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 3yXfVY5Snnz9t6K for ; Thu, 9 Nov 2017 21:27:17 +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 :resent-from:resent-to:resent-date:resent-message-id:message-id :in-reply-to:references:from:date:subject:to:cc; q=dns; s= default; b=Y6yAxfgPdktt/mO0bcurU85SW5T3hB1IzG8IHeIXYiBgkI5Nz3OVj Hl9A57FD8amsSpDyyuNsynMO3JJnppUYqEaXfBXyBixIXdVwdvAgAZjK1acoIo0q gRppjMJv4WUtznDby0NJbxCxhMp8FB2J5ajd/dFn04yyGUtNvIim4c= 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 :resent-from:resent-to:resent-date:resent-message-id:message-id :in-reply-to:references:from:date:subject:to:cc; s=default; bh=L 7L7PqVa+GwYvKGHEX8V7JWdsM4=; b=yiDS3OP6I+GsEvE7pf+4CZHllpwb9he9M /cnOHpJrmDtBEfpJeOKUwYz+PrwGqf7MUaxb08IeeUbbyDDpzC0HPwjFiLsfIpL2 hFE+qt++G1LRKpcIBQZVbrpBQLSow7cysi9hcUARhytwC/GCufpCcPsw/qH6U/Z9 fZcr9o6zlw= Received: (qmail 55803 invoked by alias); 9 Nov 2017 10:25:20 -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 55728 invoked by uid 89); 9 Nov 2017 10:25:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_SOFTFAIL autolearn=ham version=3.3.2 spammy=10017, 2767 X-HELO: eggs.gnu.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (208.118.235.92) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 09 Nov 2017 10:25:15 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eCk18-00049T-8o for gcc-patches@gcc.gnu.org; Thu, 09 Nov 2017 05:25:07 -0500 Received: from mx2.suse.de ([195.135.220.15]:46229) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eCk17-00048Y-Ua for gcc-patches@gcc.gnu.org; Thu, 09 Nov 2017 05:25:02 -0500 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 8A20CACB6 for ; Thu, 9 Nov 2017 10:24:58 +0000 (UTC) Resent-From: =?utf-8?q?Martin_Li=C5=A1ka?= Resent-To: GCC Patches Resent-Date: Thu, 9 Nov 2017 11:24:58 +0100 Resent-Message-ID: <4a45c3f1-c0db-e61a-baf3-9c60cb446fcf@suse.cz> Resent-User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 Message-Id: <636833104c111ff91445f7a610f6fe95128f71a1.1510223055.git.mliska@suse.cz> In-Reply-To: References: From: marxin Date: Thu, 9 Nov 2017 11:24:05 +0100 Subject: [PATCH 4/7] GCOV: remove typedef for function_t To: gcc-patches@gcc.gnu.org Cc: nathan@acm.org X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 195.135.220.15 X-IsSubscribed: yes gcc/ChangeLog: 2017-11-09 Martin Liska * gcov.c (struct function_info): Remove typedef for function_t. (struct source_info): Likewise. (source_info::get_functions_at_location): Likewise. (solve_flow_graph): Likewise. (find_exception_blocks): Likewise. (add_line_counts): Likewise. (output_intermediate_file): Likewise. (process_file): Likewise. (generate_results): Likewise. (release_structures): Likewise. (read_graph_file): Likewise. (read_count_file): Likewise. (accumulate_line_counts): Likewise. (output_lines): Likewise. --- gcc/gcov.c | 70 +++++++++++++++++++++++++++++++------------------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/gcc/gcov.c b/gcc/gcov.c index 02a01b51763..a1c489bccdc 100644 --- a/gcc/gcov.c +++ b/gcc/gcov.c @@ -223,7 +223,7 @@ line_info::has_block (block_t *needle) /* Describes a single function. Contains an array of basic blocks. */ -typedef struct function_info +struct function_info { function_info (); ~function_info (); @@ -276,7 +276,7 @@ typedef struct function_info /* Next function. */ struct function_info *next; -} function_t; +}; /* Function info comparer that will sort functions according to starting line. */ @@ -317,7 +317,7 @@ struct source_info /* Default constructor. */ source_info (); - vector get_functions_at_location (unsigned line_num) const; + vector get_functions_at_location (unsigned line_num) const; /* Index of the source_info in sources vector. */ unsigned index; @@ -333,7 +333,7 @@ struct source_info /* Functions in this source file. These are in ascending line number order. */ - vector functions; + vector functions; }; source_info::source_info (): index (0), name (NULL), file_time (), @@ -341,12 +341,12 @@ source_info::source_info (): index (0), name (NULL), file_time (), { } -vector +vector source_info::get_functions_at_location (unsigned line_num) const { - vector r; + vector r; - for (vector::const_iterator it = functions.begin (); + for (vector::const_iterator it = functions.begin (); it != functions.end (); it++) { if ((*it)->start_line == line_num && (*it)->src == index) @@ -392,7 +392,7 @@ public: }; /* Vector of all functions. */ -static vector functions; +static vector functions; /* Vector of source files. */ static vector sources; @@ -531,10 +531,10 @@ static char *canonicalize_name (const char *); static unsigned find_source (const char *); static void read_graph_file (void); static int read_count_file (void); -static void solve_flow_graph (function_t *); -static void find_exception_blocks (function_t *); +static void solve_flow_graph (function_info *); +static void find_exception_blocks (function_info *); static void add_branch_counts (coverage_t *, const arc_t *); -static void add_line_counts (coverage_t *, function_t *); +static void add_line_counts (coverage_t *, function_info *); static void executed_summary (unsigned, unsigned); static void function_summary (const coverage_t *, const char *); static const char *format_gcov (gcov_type, gcov_type, int); @@ -1001,7 +1001,7 @@ output_intermediate_file (FILE *gcov_file, source_info *src) std::sort (src->functions.begin (), src->functions.end (), function_line_start_cmp ()); - for (vector::iterator it = src->functions.begin (); + for (vector::iterator it = src->functions.begin (); it != src->functions.end (); it++) { /* function:,, */ @@ -1012,10 +1012,10 @@ output_intermediate_file (FILE *gcov_file, source_info *src) for (unsigned line_num = 0; line_num <= src->lines.size (); line_num++) { - vector fns = src->get_functions_at_location (line_num); + vector fns = src->get_functions_at_location (line_num); /* Print first group functions that begin on the line. */ - for (vector::iterator it2 = fns.begin (); + for (vector::iterator it2 = fns.begin (); it2 != fns.end (); it2++) { vector &lines = (*it2)->lines; @@ -1106,10 +1106,10 @@ process_file (const char *file_name) read_count_file (); - hash_map fn_map; + hash_map fn_map; /* Identify group functions. */ - for (vector::iterator it = functions.begin (); + for (vector::iterator it = functions.begin (); it != functions.end (); it++) if (!(*it)->artificial) { @@ -1117,7 +1117,7 @@ process_file (const char *file_name) needle.source_file_idx = (*it)->src; needle.start_line = (*it)->start_line; - function_t **slot = fn_map.get (needle); + function_info **slot = fn_map.get (needle); if (slot) { gcc_assert ((*slot)->end_line == (*it)->end_line); @@ -1132,10 +1132,10 @@ process_file (const char *file_name) functions.erase (remove_if (functions.begin (), functions.end (), is_artificial), functions.end ()); - for (vector::iterator it = functions.begin (); + for (vector::iterator it = functions.begin (); it != functions.end (); it++) { - function_t *fn = *it; + function_info *fn = *it; unsigned src = fn->src; if (!fn->counts.empty () || no_data_file) @@ -1230,10 +1230,10 @@ output_gcov_file (const char *file_name, source_info *src) static void generate_results (const char *file_name) { - for (vector::iterator it = functions.begin (); + for (vector::iterator it = functions.begin (); it != functions.end (); it++) { - function_t *fn = *it; + function_info *fn = *it; coverage_t coverage; memset (&coverage, 0, sizeof (coverage)); @@ -1297,7 +1297,7 @@ generate_results (const char *file_name) static void release_structures (void) { - for (vector::iterator it = functions.begin (); + for (vector::iterator it = functions.begin (); it != functions.end (); it++) delete (*it); @@ -1494,7 +1494,7 @@ read_graph_file (void) } bbg_stamp = gcov_read_unsigned (); - function_t *fn = NULL; + function_info *fn = NULL; while ((tag = gcov_read_unsigned ())) { unsigned length = gcov_read_unsigned (); @@ -1516,7 +1516,7 @@ read_graph_file (void) unsigned start_column = gcov_read_unsigned (); unsigned end_line = gcov_read_unsigned (); - fn = new function_t (); + fn = new function_info (); functions.push_back (fn); fn->name = function_name; if (flag_demangled_names) @@ -1672,7 +1672,7 @@ read_count_file (void) unsigned ix; unsigned version; unsigned tag; - function_t *fn = NULL; + function_info *fn = NULL; int error = 0; if (!gcov_open (da_file_name, 1)) @@ -1730,8 +1730,8 @@ read_count_file (void) ident = gcov_read_unsigned (); fn = NULL; - for (vector::reverse_iterator it = functions.rbegin (); - it != functions.rend (); it++) + for (vector::reverse_iterator it + = functions.rbegin (); it != functions.rend (); it++) { if ((*it)->ident == ident) { @@ -1779,7 +1779,7 @@ read_count_file (void) to the blocks and the uninstrumented arcs. */ static void -solve_flow_graph (function_t *fn) +solve_flow_graph (function_info *fn) { unsigned ix; arc_t *arc; @@ -2042,7 +2042,7 @@ solve_flow_graph (function_t *fn) /* Mark all the blocks only reachable via an incoming catch. */ static void -find_exception_blocks (function_t *fn) +find_exception_blocks (function_info *fn) { unsigned ix; block_t **queue = XALLOCAVEC (block_t *, fn->blocks.size ()); @@ -2421,7 +2421,7 @@ mangle_name (char const *base, char *ptr) the appropriate basic block. */ static void -add_line_counts (coverage_t *coverage, function_t *fn) +add_line_counts (coverage_t *coverage, function_info *fn) { bool has_any_line = false; /* Scan each basic block. */ @@ -2553,7 +2553,7 @@ static void accumulate_line_counts (source_info *src) { /* First work on group functions. */ - for (vector::iterator it = src->functions.begin (); + for (vector::iterator it = src->functions.begin (); it != src->functions.end (); it++) { function_info *fn = *it; @@ -2577,7 +2577,7 @@ accumulate_line_counts (source_info *src) /* If not using intermediate mode, sum lines of group functions and add them to lines that live in a source file. */ if (!flag_intermediate_format) - for (vector::iterator it = src->functions.begin (); + for (vector::iterator it = src->functions.begin (); it != src->functions.end (); it++) { function_info *fn = *it; @@ -2880,7 +2880,7 @@ output_lines (FILE *gcov_file, const source_info *src) source_lines.push_back (xstrdup (retval)); unsigned line_start_group = 0; - vector fns; + vector fns; for (unsigned line_num = 1; line_num <= source_lines.size (); line_num++) { @@ -2900,7 +2900,7 @@ output_lines (FILE *gcov_file, const source_info *src) line_start_group = fns[0]->end_line; else if (fns.size () == 1) { - function_t *fn = fns[0]; + function_info *fn = fns[0]; output_function_details (gcov_file, fn); } } @@ -2920,7 +2920,7 @@ output_lines (FILE *gcov_file, const source_info *src) if (line_start_group == line_num) { - for (vector::iterator it = fns.begin (); + for (vector::iterator it = fns.begin (); it != fns.end (); it++) { function_info *fn = *it;