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: 836273 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-466365-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="azoK+pku"; 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 3yXfTK23RQz9s71 for ; Thu, 9 Nov 2017 21:26:13 +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=p2P1CKAStazgXL8a97yJfjrm1Dma1m9VfBomIqmSOjTlHcWdKSG5b /nLYsB2/kMoHosIb3i1HcMHhy1WHNa9nq861B+wJKRKDpHsrfSP2WIUaXZ7aKvL9 ztlRc1NRdUNcjveoegLruK23btnqMVvxNAkAt/vIgCBrqvBvLbgPIA= 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=G ioCrMNwhihZhofEN9vDCOowv4c=; b=azoK+pkuZLGuGAc0VO3iMlEzFd/8pfRws dLqjmG4asISEunlYqFZOFOGcLRve0u2dX3rEtFiEmv//DiBgFOFKZjL5DE4MBgv7 A7dUAA+3rgpWqDbIKZBu16ibCDavnUp2MqEKd/EDld7hCL6BfzUCVwR5CVcyjKQc wACZpDplIg= Received: (qmail 55461 invoked by alias); 9 Nov 2017 10:25:18 -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 55310 invoked by uid 89); 9 Nov 2017 10:25:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No 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= 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 10:25:01 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 8652BACB1 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: <9000ede1-bfc1-acd8-2d43-eae9afd440a9@suse.cz> Resent-User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 Message-Id: <4f83c4d37f9f908ba98953842f431370096c9583.1510223055.git.mliska@suse.cz> In-Reply-To: References: From: marxin Date: Thu, 9 Nov 2017 11:24:05 +0100 Subject: [PATCH 1/7] GCOV: introduce global vector of functions To: gcc-patches@gcc.gnu.org Cc: nathan@acm.org X-IsSubscribed: yes gcc/ChangeLog: 2017-11-09 Martin Liska * gcov.c (read_graph_file): Store to global vector of functions. (read_count_file): Iterate the vector. (process_file): Likewise. (generate_results): Likewise. (release_structures): Likewise. --- gcc/gcov.c | 108 +++++++++++++++++++++++++------------------------------------ 1 file changed, 44 insertions(+), 64 deletions(-) static vector sources; @@ -532,8 +530,8 @@ static void generate_results (const char *); static void create_file_names (const char *); static char *canonicalize_name (const char *); static unsigned find_source (const char *); -static function_t *read_graph_file (void); -static int read_count_file (function_t *); +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 add_branch_counts (coverage_t *, const arc_t *); @@ -1095,42 +1093,40 @@ struct function_start_pair_hash : typed_noop_remove static void process_file (const char *file_name) { - function_t *fns; - create_file_names (file_name); - fns = read_graph_file (); - if (!fns) + read_graph_file (); + if (functions.empty ()) return; - read_count_file (fns); + read_count_file (); hash_map fn_map; /* Identify group functions. */ - for (function_t *f = fns; f; f = f->next) - if (!f->artificial) + for (vector::iterator it = functions.begin (); + it != functions.end (); it++) + if (!(*it)->artificial) { function_start needle; - needle.source_file_idx = f->src; - needle.start_line = f->start_line; + needle.source_file_idx = (*it)->src; + needle.start_line = (*it)->start_line; function_t **slot = fn_map.get (needle); if (slot) { - gcc_assert ((*slot)->end_line == f->end_line); + gcc_assert ((*slot)->end_line == (*it)->end_line); (*slot)->is_group = 1; - f->is_group = 1; + (*it)->is_group = 1; } else - fn_map.put (needle, f); + fn_map.put (needle, *it); } - while (fns) + for (vector::iterator it = functions.begin (); + it != functions.end (); it++) { - function_t *fn = fns; + function_t *fn = *it; - fns = fn->next; - fn->next = NULL; if (fn->counts || no_data_file) { unsigned src = fn->src; @@ -1177,14 +1173,12 @@ process_file (const char *file_name) if (fn->has_catch) find_exception_blocks (fn); } - - *fn_end = fn; - fn_end = &fn->next; } else - /* The function was not in the executable -- some other - instance must have been selected. */ - delete fn; + { + /* The function was not in the executable -- some other + instance must have been selected. */ + } } } @@ -1222,10 +1216,10 @@ output_gcov_file (const char *file_name, source_info *src) static void generate_results (const char *file_name) { - function_t *fn; - - for (fn = functions; fn; fn = fn->next) + for (vector::iterator it = functions.begin (); + it != functions.end (); it++) { + function_t *fn = *it; coverage_t coverage; if (fn->artificial) continue; @@ -1291,13 +1285,11 @@ generate_results (const char *file_name) static void release_structures (void) { - function_t *fn; + for (vector::iterator it = functions.begin (); + it != functions.end (); it++) + delete (*it); - while ((fn = functions)) - { - functions = fn->next; - delete fn; - } + functions.resize (0); } /* Generate the names of the graph and data files. If OBJECT_DIRECTORY @@ -1455,29 +1447,26 @@ find_source (const char *file_name) return idx; } -/* Read the notes file. Return list of functions read -- in reverse order. */ +/* Read the notes file. Save functions to FUNCTIONS global vector. */ -static function_t * +static void read_graph_file (void) { unsigned version; unsigned current_tag = 0; - function_t *fn = NULL; - function_t *fns = NULL; - function_t **fns_end = &fns; unsigned tag; if (!gcov_open (bbg_file_name, 1)) { fnotice (stderr, "%s:cannot open notes file\n", bbg_file_name); - return fns; + return; } bbg_file_time = gcov_time (); if (!gcov_magic (gcov_read_unsigned (), GCOV_NOTE_MAGIC)) { fnotice (stderr, "%s:not a gcov notes file\n", bbg_file_name); gcov_close (); - return fns; + return; } version = gcov_read_unsigned (); @@ -1493,6 +1482,7 @@ read_graph_file (void) } bbg_stamp = gcov_read_unsigned (); + function_t *fn = NULL; while ((tag = gcov_read_unsigned ())) { unsigned length = gcov_read_unsigned (); @@ -1514,7 +1504,8 @@ read_graph_file (void) unsigned start_column = gcov_read_unsigned (); unsigned end_line = gcov_read_unsigned (); - fn = new function_t; + fn = new function_t (); + functions.push_back (fn); fn->name = function_name; if (flag_demangled_names) { @@ -1531,9 +1522,6 @@ read_graph_file (void) fn->end_line = end_line; fn->artificial = artificial; - fn->next = NULL; - *fns_end = fn; - fns_end = &fn->next; current_tag = tag; } else if (fn && tag == GCOV_TAG_BLOCKS) @@ -1659,17 +1647,15 @@ read_graph_file (void) } gcov_close (); - if (!fns) + if (functions.empty ()) fnotice (stderr, "%s:no functions found\n", bbg_file_name); - - return fns; } /* Reads profiles from the count file and attach to each function. Return nonzero if fatal error. */ static int -read_count_file (function_t *fns) +read_count_file (void) { unsigned ix; unsigned version; @@ -1726,26 +1712,20 @@ read_count_file (function_t *fns) else if (tag == GCOV_TAG_FUNCTION && length == GCOV_TAG_FUNCTION_LENGTH) { unsigned ident; - struct function_info *fn_n; /* Try to find the function in the list. To speed up the search, first start from the last function found. */ ident = gcov_read_unsigned (); - fn_n = fns; - for (fn = fn ? fn->next : NULL; ; fn = fn->next) + + fn = NULL; + for (vector::reverse_iterator it = functions.rbegin (); + it != functions.rend (); it++) { - if (fn) - ; - else if ((fn = fn_n)) - fn_n = NULL; - else + if ((*it)->ident == ident) { - fnotice (stderr, "%s:unknown function '%u'\n", - da_file_name, ident); + fn = *it; break; } - if (fn->ident == ident) - break; } if (!fn) diff --git a/gcc/gcov.c b/gcc/gcov.c index 846a2326196..83239639247 100644 --- a/gcc/gcov.c +++ b/gcc/gcov.c @@ -392,10 +392,8 @@ public: unsigned src; /* Source file */ }; -/* Holds a list of function basic block graphs. */ - -static function_t *functions; -static function_t **fn_end = &functions; +/* Vector of all functions. */ +static vector functions; /* Vector of source files. */ 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: 836272 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-466364-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="FgJPgdbS"; 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 3yXfSw0KL1z9s71 for ; Thu, 9 Nov 2017 21:25:51 +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=LXTb32Rc1tvjIMr2Iibau5rAgLl0C0H3sJzkJRujA2Po45gBPwMgh Uzdb9K7XSnN0+TjRSttLWJjdOlr9WWnyGTvF3n8VRE/o1n/TbVlbUzhagcSKMIVH LmSG8vJL+xTVi4ru+m2d8MdPusVjM4R3IMdfnM4JrlG2JA0UODGvS0= 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=Q ff28rHfCOFVy19oXtS9UlVjs+c=; b=FgJPgdbS1qqmcn9xPZioE0rj+e/1RxbF2 GSRpXI+9MObfgbPvUicfD0WnrqCDyyGdZlV2hV8MI9d38/ycnCeClTHubLcT5VIe 6fmRgOVLnUQ9QJOe4kiRn1MFzO47XRc190UdW03dZzpIdAsWtnPvV2Xj42KcHtnL bWXWclclGQ= Received: (qmail 55365 invoked by alias); 9 Nov 2017 10:25:17 -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 54387 invoked by uid 89); 9 Nov 2017 10:25:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SEM_URIRED, SPF_PASS autolearn=ham version=3.3.2 spammy= 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 10:25:00 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 5EF93ABFA 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: <4b5f6842-78e5-8053-0256-7ae991c212be@suse.cz> Resent-User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 Message-Id: <28f3909ec37c4da2dbd543326ae1781004578785.1510223055.git.mliska@suse.cz> In-Reply-To: References: From: marxin Date: Thu, 9 Nov 2017 11:24:05 +0100 Subject: [PATCH 2/7] GCOV: simplify usage of function_info::artificial. To: gcc-patches@gcc.gnu.org Cc: nathan@acm.org X-IsSubscribed: yes gcc/ChangeLog: 2017-11-09 Martin Liska * gcov.c (is_artificial): New function. (process_file): Erase all artificial early. (generate_results): Skip as all artificial are already removed. --- gcc/gcov.c | 66 +++++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 40 insertions(+), 26 deletions(-) diff --git a/gcc/gcov.c b/gcc/gcov.c index 83239639247..3dc159726c7 100644 --- a/gcc/gcov.c +++ b/gcc/gcov.c @@ -1088,6 +1088,14 @@ struct function_start_pair_hash : typed_noop_remove } }; +/* Function filter based on function_info::artificial variable. */ + +static bool +is_artificial (function_info *fn) +{ + return fn->artificial; +} + /* Process a single input file. */ static void @@ -1122,33 +1130,40 @@ process_file (const char *file_name) fn_map.put (needle, *it); } + /* Remove all artificial function. */ + functions.erase (remove_if (functions.begin (), functions.end (), + is_artificial), functions.end ()); + for (vector::iterator it = functions.begin (); it != functions.end (); it++) { function_t *fn = *it; + unsigned src = fn->src; if (fn->counts || no_data_file) { - unsigned src = fn->src; - unsigned block_no; + source_info *s = &sources[src]; + s->functions.push_back (fn); - /* Process only non-artificial functions. */ - if (!fn->artificial) + /* Mark last line in files touched by function. */ + for (unsigned block_no = 0; block_no != fn->blocks.size (); + block_no++) { - source_info *s = &sources[src]; - s->functions.push_back (fn); - - /* Mark last line in files touched by function. */ - for (block_no = 0; block_no != fn->blocks.size (); block_no++) + block_t *block = &fn->blocks[block_no]; + for (unsigned i = 0; i < block->locations.size (); i++) { - block_t *block = &fn->blocks[block_no]; - for (unsigned i = 0; i < block->locations.size (); i++) + /* Sort lines of locations. */ + sort (block->locations[i].lines.begin (), + block->locations[i].lines.end ()); + + if (!block->locations[i].lines.empty ()) { - /* Sort lines of locations. */ - sort (block->locations[i].lines.begin (), - block->locations[i].lines.end ()); + s = &sources[block->locations[i].source_file_idx]; + unsigned last_line + = block->locations[i].lines.back (); - if (!block->locations[i].lines.empty ()) + /* Record new lines for the function. */ + if (last_line >= s->lines.size ()) { s = &sources[block->locations[i].source_file_idx]; unsigned last_line @@ -1162,17 +1177,18 @@ process_file (const char *file_name) } } } - - /* Allocate lines for group function, following start_line - and end_line information of the function. */ - if (fn->is_group) - fn->lines.resize (fn->end_line - fn->start_line + 1); } - - solve_flow_graph (fn); - if (fn->has_catch) - find_exception_blocks (fn); } + + /* Allocate lines for group function, following start_line + and end_line information of the function. */ + if (fn->is_group) + fn->lines.resize (fn->end_line - fn->start_line + 1); + + + solve_flow_graph (fn); + if (fn->has_catch) + find_exception_blocks (fn); } else { @@ -1221,8 +1237,6 @@ generate_results (const char *file_name) { function_t *fn = *it; coverage_t coverage; - if (fn->artificial) - continue; memset (&coverage, 0, sizeof (coverage)); coverage.name = flag_demangled_names ? fn->demangled_name : fn->name; 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: 836274 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-466366-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="MpDGo+b2"; 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 3yXfTl6j7kz9s71 for ; Thu, 9 Nov 2017 21:26:35 +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=QBIhggTPQp8hpF0qR9M8qKgAV7RKzMIiqJ95XIeJb0Gp43hzBgqV3 MYZzoM/KZRDysuJAcMbd35jC7hoUrCg2XK0+L+yGeJoIg+UtA23UsFPBzESoQp5m D9vuDiHImPDwMXs8N6kGsny1CbULcNFwYm3UzhKKEyQJZFom0r7sbU= 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=M XlLjS7Rr0CHXr7GAClIxyk58LM=; b=MpDGo+b2n+z6p9hjNpdl75XoyTpM6XNgE UHvDxeIl1mO7XnQ6bJA5NcDHh2syC/M5fOXIOJ3nPJaXLq5hvVSe+fHlTalLnmYP iN0xmKacn64qLHEpBsZGnrCdpJyXxoxDUoliSR070rG9QY9nSRXABnKrcL+mwfbC piFp/33YE8= Received: (qmail 55532 invoked by alias); 9 Nov 2017 10:25:18 -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 55309 invoked by uid 89); 9 Nov 2017 10:25:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No 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=Hx-languages-length:2662, 2577 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 10:25:00 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 65D7EAC08 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: <500621e3-cbbe-d24f-1708-5a359326d043@suse.cz> Resent-User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 Message-Id: In-Reply-To: References: From: marxin Date: Thu, 9 Nov 2017 11:24:05 +0100 Subject: [PATCH 3/7] GCOV: introduce vector for function_info::counts. To: gcc-patches@gcc.gnu.org Cc: nathan@acm.org X-IsSubscribed: yes gcc/ChangeLog: 2017-11-09 Martin Liska * gcov.c (function_info::function_info): Remove num_counts and add vector. (function_info::~function_info): Use the vector. (process_file): Likewise. (read_graph_file): Likewise. (read_count_file): Likewise. (solve_flow_graph): Likewise. --- gcc/gcov.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/gcc/gcov.c b/gcc/gcov.c index 3dc159726c7..02a01b51763 100644 --- a/gcc/gcov.c +++ b/gcc/gcov.c @@ -257,8 +257,7 @@ typedef struct function_info unsigned blocks_executed; /* Raw arc coverage counts. */ - gcov_type *counts; - unsigned num_counts; + vector counts; /* First line number. */ unsigned start_line; @@ -551,8 +550,8 @@ extern int main (int, char **); function_info::function_info (): name (NULL), demangled_name (NULL), ident (0), lineno_checksum (0), cfg_checksum (0), has_catch (0), artificial (0), is_group (0), - blocks (), blocks_executed (0), counts (NULL), num_counts (0), - start_line (0), start_column (0), end_line (0), src (0), lines (), next (NULL) + blocks (), blocks_executed (0), counts (), + start_line (0), start_column (), end_line (0), src (0), lines (), next (NULL) { } @@ -568,7 +567,6 @@ function_info::~function_info () free (arc); } } - free (counts); if (flag_demangled_names && demangled_name != name) free (demangled_name); free (name); @@ -1140,7 +1138,7 @@ process_file (const char *file_name) function_t *fn = *it; unsigned src = fn->src; - if (fn->counts || no_data_file) + if (!fn->counts.empty () || no_data_file) { source_info *s = &sources[src]; s->functions.push_back (fn); @@ -1604,7 +1602,7 @@ read_graph_file (void) } if (!arc->on_tree) - fn->num_counts++; + fn->counts.push_back (0); } if (mark_catches) @@ -1755,13 +1753,10 @@ read_count_file (void) } else if (tag == GCOV_TAG_FOR_COUNTER (GCOV_COUNTER_ARCS) && fn) { - if (length != GCOV_TAG_COUNTER_LENGTH (fn->num_counts)) + if (length != GCOV_TAG_COUNTER_LENGTH (fn->counts.size ())) goto mismatch; - if (!fn->counts) - fn->counts = XCNEWVEC (gcov_type, fn->num_counts); - - for (ix = 0; ix != fn->num_counts; ix++) + for (ix = 0; ix != fn->counts.size (); ix++) fn->counts[ix] += gcov_read_counter (); } gcov_sync (base, length); @@ -1788,7 +1783,7 @@ solve_flow_graph (function_t *fn) { unsigned ix; arc_t *arc; - gcov_type *count_ptr = fn->counts; + gcov_type *count_ptr = &fn->counts.front (); block_t *blk; block_t *valid_blocks = NULL; /* valid, but unpropagated blocks. */ block_t *invalid_blocks = NULL; /* invalid, but inferable blocks. */ 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; 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: 836276 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-466368-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="uQ1jFbo4"; 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 3yXfVC6zYvz9s71 for ; Thu, 9 Nov 2017 21:26:59 +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=AYtyZJKgXl57+zL/wXpn31vAMpNevCcvH7XOFIM8jtAKvWMSk8N/U a6Hfn9N6k99i7Xr3ysnWjdW4qEnDElR0TYgNxFZVMHgL4fkxIrX70NwhnUYTxcgv dPLUrUyzRC70PbALW0GtQiyNL0uPQMUXqTSpwdpXHtVTYOkCjLVVKE= 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=c N0XP4cZwKSD7WjF/5zy0bvA3eA=; b=uQ1jFbo4pD3MNSWPuprujL+XjbNa8fNCK 9X4O5NCZgOpEDnxrVJL0yW9/1fsOZyYpY6o3erZ4OZfRp+ZZhoy1aGxq0/3dg82x n0jr7dGrV4wo3WqKuExl2i2M1WStmeb+BQvp5DtCTHWqE1P50MVwwPR9sz7qV75b /hXkrnK20g= Received: (qmail 55730 invoked by alias); 9 Nov 2017 10:25:19 -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 55702 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=COVERAGE, Links, 5597, 1378 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 1eCk19-0004A8-Pw for gcc-patches@gcc.gnu.org; Thu, 09 Nov 2017 05:25:07 -0500 Received: from mx2.suse.de ([195.135.220.15]:46244) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eCk19-00049i-Ft for gcc-patches@gcc.gnu.org; Thu, 09 Nov 2017 05:25:03 -0500 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 9464DACCF 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: Resent-User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 Message-Id: <3076abc035d2621670efd8d1ca0ea6156f199816.1510223055.git.mliska@suse.cz> In-Reply-To: References: From: marxin Date: Thu, 9 Nov 2017 11:24:05 +0100 Subject: [PATCH 5/7] GCOV: remove typedef for arc_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 arc_info): Remove typedef for arc_t. (struct line_info): Likewise. (add_branch_counts): Likewise. (output_branch_count): Likewise. (function_info::~function_info): Likewise. (circuit): Likewise. (output_intermediate_line): Likewise. (read_graph_file): Likewise. (solve_flow_graph): Likewise. (find_exception_blocks): Likewise. (add_line_counts): Likewise. (accumulate_line_info): Likewise. (output_line_details): Likewise. (output_function_details): Likewise. --- gcc/gcov.c | 58 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/gcc/gcov.c b/gcc/gcov.c index a1c489bccdc..e33c7b6f8cd 100644 --- a/gcc/gcov.c +++ b/gcc/gcov.c @@ -79,7 +79,7 @@ struct source_info; /* Describes an arc between two basic blocks. */ -typedef struct arc_info +struct arc_info { /* source and destination blocks. */ struct block_info *src; @@ -113,7 +113,7 @@ typedef struct arc_info /* Links to next arc on src and dst lists. */ struct arc_info *succ_next; struct arc_info *pred_next; -} arc_t; +}; /* Describes which locations (lines and files) are associated with a basic block. */ @@ -137,8 +137,8 @@ typedef struct block_info block_info (); /* Chain of exit and entry arcs. */ - arc_t *succ; - arc_t *pred; + arc_info *succ; + arc_info *pred; /* Number of unprocessed exit and entry arcs. */ gcov_type num_succ; @@ -166,7 +166,7 @@ typedef struct block_info { /* Single line graph cycle workspace. Used for all-blocks mode. */ - arc_t *arc; + arc_info *arc; unsigned ident; } cycle; /* Used in all-blocks mode, after blocks are linked onto lines. */ @@ -200,7 +200,7 @@ struct line_info gcov_type count; /* Branches from blocks that end on this line. */ - vector branches; + vector branches; /* blocks which start on this line. Used in all-blocks mode. */ vector blocks; @@ -533,14 +533,14 @@ static void read_graph_file (void); static int read_count_file (void); 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_branch_counts (coverage_t *, const arc_info *); 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); static void accumulate_line_counts (source_info *); static void output_gcov_file (const char *, source_info *); -static int output_branch_count (FILE *, int, const arc_t *); +static int output_branch_count (FILE *, int, const arc_info *); static void output_lines (FILE *, const source_info *); static char *make_gcov_file_name (const char *, const char *); static char *mangle_name (const char *, char *); @@ -559,7 +559,7 @@ function_info::~function_info () { for (int i = blocks.size () - 1; i >= 0; i--) { - arc_t *arc, *arc_n; + arc_info *arc, *arc_n; for (arc = blocks[i].succ; arc; arc = arc_n) { @@ -589,7 +589,7 @@ bool function_info::group_line_p (unsigned n, unsigned src_idx) simple paths)--the node is unblocked only when it participates in a cycle. */ -typedef vector arc_vector_t; +typedef vector arc_vector_t; typedef vector block_vector_t; /* Enum with types of loop in CFG. */ @@ -671,7 +671,7 @@ circuit (block_t *v, arc_vector_t &path, block_t *start, blocked.push_back (v); block_lists.push_back (block_vector_t ()); - for (arc_t *arc = v->succ; arc; arc = arc->succ_next) + for (arc_info *arc = v->succ; arc; arc = arc->succ_next) { block_t *w = arc->dst; if (w < start || !linfo.has_block (w)) @@ -690,7 +690,7 @@ circuit (block_t *v, arc_vector_t &path, block_t *start, if (result != NO_LOOP) unblock (v, blocked, block_lists); else - for (arc_t *arc = v->succ; arc; arc = arc->succ_next) + for (arc_info *arc = v->succ; arc; arc = arc->succ_next) { block_t *w = arc->dst; if (w < start || !linfo.has_block (w)) @@ -960,7 +960,7 @@ output_intermediate_line (FILE *f, line_info *line, unsigned line_num) format_gcov (line->count, 0, -1), line->has_unexecuted_block); - vector::const_iterator it; + vector::const_iterator it; if (flag_branches) for (it = line->branches.begin (); it != line->branches.end (); it++) @@ -1563,7 +1563,7 @@ read_graph_file (void) if (dest >= fn->blocks.size ()) goto corrupt; - arc = XCNEW (arc_t); + arc = XCNEW (arc_info); arc->dst = &fn->blocks[dest]; arc->src = src_blk; @@ -1782,7 +1782,7 @@ static void solve_flow_graph (function_info *fn) { unsigned ix; - arc_t *arc; + arc_info *arc; gcov_type *count_ptr = &fn->counts.front (); block_t *blk; block_t *valid_blocks = NULL; /* valid, but unpropagated blocks. */ @@ -1791,7 +1791,7 @@ solve_flow_graph (function_info *fn) /* The arcs were built in reverse order. Fix that now. */ for (ix = fn->blocks.size (); ix--;) { - arc_t *arc_p, *arc_n; + arc_info *arc_p, *arc_n; for (arc_p = NULL, arc = fn->blocks[ix].succ; arc; arc_p = arc, arc = arc_n) @@ -1884,12 +1884,12 @@ solve_flow_graph (function_info *fn) smart sort. */ if (out_of_order) { - arc_t *start = blk->succ; + arc_info *start = blk->succ; unsigned changes = 1; while (changes) { - arc_t *arc, *arc_p, *arc_n; + arc_info *arc, *arc_p, *arc_n; changes = 0; for (arc_p = NULL, arc = start; (arc_n = arc->succ_next);) @@ -1927,7 +1927,7 @@ solve_flow_graph (function_info *fn) while ((blk = invalid_blocks)) { gcov_type total = 0; - const arc_t *arc; + const arc_info *arc; invalid_blocks = blk->chain; blk->invalid_chain = 0; @@ -1949,7 +1949,7 @@ solve_flow_graph (function_info *fn) while ((blk = valid_blocks)) { gcov_type total; - arc_t *arc, *inv_arc; + arc_info *arc, *inv_arc; valid_blocks = blk->chain; blk->valid_chain = 0; @@ -2057,7 +2057,7 @@ find_exception_blocks (function_info *fn) for (ix = 1; ix;) { block_t *block = queue[--ix]; - const arc_t *arc; + const arc_info *arc; for (arc = block->succ; arc; arc = arc->succ_next) if (!arc->fake && !arc->is_throw && arc->dst->exceptional) @@ -2072,7 +2072,7 @@ find_exception_blocks (function_info *fn) /* Increment totals in COVERAGE according to arc ARC. */ static void -add_branch_counts (coverage_t *coverage, const arc_t *arc) +add_branch_counts (coverage_t *coverage, const arc_info *arc) { if (arc->is_call_non_return) { @@ -2489,7 +2489,7 @@ add_line_counts (coverage_t *coverage, function_info *fn) if (flag_branches) { - arc_t *arc; + arc_info *arc; for (arc = block->succ; arc; arc = arc->succ_next) line->branches.push_back (arc); @@ -2527,10 +2527,10 @@ static void accumulate_line_info (line_info *line, source_info *src, for (vector::iterator it = line->blocks.begin (); it != line->blocks.end (); it++) { - for (arc_t *arc = (*it)->pred; arc; arc = arc->pred_next) + for (arc_info *arc = (*it)->pred; arc; arc = arc->pred_next) if (!line->has_block (arc->src)) count += arc->count; - for (arc_t *arc = (*it)->succ; arc; arc = arc->succ_next) + for (arc_info *arc = (*it)->succ; arc; arc = arc->succ_next) arc->cs_count = arc->count; } @@ -2615,7 +2615,7 @@ accumulate_line_counts (source_info *src) anything is output. */ static int -output_branch_count (FILE *gcov_file, int ix, const arc_t *arc) +output_branch_count (FILE *gcov_file, int ix, const arc_info *arc) { if (arc->is_call_non_return) { @@ -2783,7 +2783,7 @@ output_line_details (FILE *f, const line_info *line, unsigned line_num) { if (flag_all_blocks) { - arc_t *arc; + arc_info *arc; int ix, jx; ix = jx = 0; @@ -2811,7 +2811,7 @@ output_line_details (FILE *f, const line_info *line, unsigned line_num) int ix; ix = 0; - for (vector::const_iterator it = line->branches.begin (); + for (vector::const_iterator it = line->branches.begin (); it != line->branches.end (); it++) ix += output_branch_count (f, ix, (*it)); } @@ -2825,7 +2825,7 @@ output_function_details (FILE *f, const function_info *fn) if (!flag_branches) return; - arc_t *arc = fn->blocks[EXIT_BLOCK].pred; + arc_info *arc = fn->blocks[EXIT_BLOCK].pred; gcov_type return_count = fn->blocks[EXIT_BLOCK].count; gcov_type called_count = fn->blocks[ENTRY_BLOCK].count; 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: 836278 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-466370-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="oC0M823/"; 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 3yXfVr69BXz9s71 for ; Thu, 9 Nov 2017 21:27:32 +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=ZS8QUnHTVPyg6iQSClwWh4WD5FKQ+qJrQ6oE6XMN0YiCN0btqwXtI rySsMQIbZTn38tP3OWqAFalv8jgyStXMeqJy/4hAGodimSZDiyfg3hrDLrarYnW1 Z4zMrmITR76XAGyu09v/NP9TSlKksFwSuBpmq1VUJYjgE6ztW7M94U= 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=A +wA18JEnNX39uL1frh9O3K0mh0=; b=oC0M823/1Fi4t2pBaLu+rZa91k6RbZw+H ocpxsMMn5oJDpN1bypq3ocEGWRaH39w+dsaTaflw8MoAekT9Wh1M+rVBbYGVmPfG J7wxH5OF8emhGRppz1s7BlE4u5e0CyPQcMOHsj7Ez4VH6euMB/7LrjOKxp6IN79S iYQ1j3cZ6Q= Received: (qmail 56436 invoked by alias); 9 Nov 2017 10:25:29 -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 55966 invoked by uid 89); 9 Nov 2017 10:25:22 -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= 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:19 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eCk19-0004A1-O7 for gcc-patches@gcc.gnu.org; Thu, 09 Nov 2017 05:25:08 -0500 Received: from mx2.suse.de ([195.135.220.15]:46243) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eCk19-00049h-EN for gcc-patches@gcc.gnu.org; Thu, 09 Nov 2017 05:25:03 -0500 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 91ABCACCD 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: <7bc2f2d9-f2e5-ab98-715a-63a136c3773d@suse.cz> Resent-User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 Message-Id: In-Reply-To: References: From: marxin Date: Thu, 9 Nov 2017 11:24:05 +0100 Subject: [PATCH 6/7] GCOV: remove typedef for block_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 block_info): Remove typedef for block_t. (struct line_info): Likewise. (line_info::has_block): Likewise. (EXIT_BLOCK): Likewise. (unblock): Likewise. (circuit): Likewise. (get_cycles_count): Likewise. (process_file): Likewise. (read_graph_file): Likewise. (solve_flow_graph): Likewise. (find_exception_blocks): Likewise. (add_line_counts): Likewise. (accumulate_line_info): Likewise. (output_line_details): Likewise. --- gcc/gcov.c | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/gcc/gcov.c b/gcc/gcov.c index e33c7b6f8cd..0e5ae8110ad 100644 --- a/gcc/gcov.c +++ b/gcc/gcov.c @@ -131,7 +131,7 @@ struct block_location_info /* Describes a basic block. Contains lists of arcs to successor and predecessor blocks. */ -typedef struct block_info +struct block_info { /* Constructor. */ block_info (); @@ -175,7 +175,7 @@ typedef struct block_info line. */ struct block_info *chain; -} block_t; +}; block_info::block_info (): succ (NULL), pred (NULL), num_succ (0), num_pred (0), id (0), count (0), count_valid (0), valid_chain (0), invalid_chain (0), @@ -194,7 +194,7 @@ struct line_info line_info (); /* Return true when NEEDLE is one of basic blocks the line belongs to. */ - bool has_block (block_t *needle); + bool has_block (block_info *needle); /* Execution count. */ gcov_type count; @@ -203,7 +203,7 @@ struct line_info vector branches; /* blocks which start on this line. Used in all-blocks mode. */ - vector blocks; + vector blocks; unsigned exists : 1; unsigned unexceptional : 1; @@ -216,7 +216,7 @@ line_info::line_info (): count (0), branches (), blocks (), exists (false), } bool -line_info::has_block (block_t *needle) +line_info::has_block (block_info *needle) { return std::find (blocks.begin (), blocks.end (), needle) != blocks.end (); } @@ -253,7 +253,7 @@ struct function_info at blocks[0] and the exit block is at blocks[1]. */ #define ENTRY_BLOCK (0) #define EXIT_BLOCK (1) - vector blocks; + vector blocks; unsigned blocks_executed; /* Raw arc coverage counts. */ @@ -590,7 +590,7 @@ bool function_info::group_line_p (unsigned n, unsigned src_idx) */ typedef vector arc_vector_t; -typedef vector block_vector_t; +typedef vector block_vector_t; /* Enum with types of loop in CFG. */ @@ -635,7 +635,7 @@ handle_cycle (const arc_vector_t &edges, int64_t &count) blocked by U in BLOCK_LISTS. */ static void -unblock (const block_t *u, block_vector_t &blocked, +unblock (const block_info *u, block_vector_t &blocked, vector &block_lists) { block_vector_t::iterator it = find (blocked.begin (), blocked.end (), u); @@ -660,7 +660,7 @@ unblock (const block_t *u, block_vector_t &blocked, Returns what type of loop it contains. */ static loop_type -circuit (block_t *v, arc_vector_t &path, block_t *start, +circuit (block_info *v, arc_vector_t &path, block_info *start, block_vector_t &blocked, vector &block_lists, line_info &linfo, int64_t &count) { @@ -673,7 +673,7 @@ circuit (block_t *v, arc_vector_t &path, block_t *start, for (arc_info *arc = v->succ; arc; arc = arc->succ_next) { - block_t *w = arc->dst; + block_info *w = arc->dst; if (w < start || !linfo.has_block (w)) continue; @@ -692,7 +692,7 @@ circuit (block_t *v, arc_vector_t &path, block_t *start, else for (arc_info *arc = v->succ; arc; arc = arc->succ_next) { - block_t *w = arc->dst; + block_info *w = arc->dst; if (w < start || !linfo.has_block (w)) continue; @@ -721,7 +721,7 @@ get_cycles_count (line_info &linfo, bool handle_negative_cycles = true) loop_type result = NO_LOOP; gcov_type count = 0; - for (vector::iterator it = linfo.blocks.begin (); + for (vector::iterator it = linfo.blocks.begin (); it != linfo.blocks.end (); it++) { arc_vector_t path; @@ -1147,7 +1147,7 @@ process_file (const char *file_name) for (unsigned block_no = 0; block_no != fn->blocks.size (); block_no++) { - block_t *block = &fn->blocks[block_no]; + block_info *block = &fn->blocks[block_no]; for (unsigned i = 0; i < block->locations.size (); i++) { /* Sort lines of locations. */ @@ -1549,7 +1549,7 @@ read_graph_file (void) unsigned src = gcov_read_unsigned (); fn->blocks[src].id = src; unsigned num_dests = GCOV_TAG_ARCS_NUM (length); - block_t *src_blk = &fn->blocks[src]; + block_info *src_blk = &fn->blocks[src]; unsigned mark_catches = 0; struct arc_info *arc; @@ -1622,7 +1622,7 @@ read_graph_file (void) else if (fn && tag == GCOV_TAG_LINES) { unsigned blockno = gcov_read_unsigned (); - block_t *block = &fn->blocks[blockno]; + block_info *block = &fn->blocks[blockno]; if (blockno >= fn->blocks.size ()) goto corrupt; @@ -1784,9 +1784,9 @@ solve_flow_graph (function_info *fn) unsigned ix; arc_info *arc; gcov_type *count_ptr = &fn->counts.front (); - block_t *blk; - block_t *valid_blocks = NULL; /* valid, but unpropagated blocks. */ - block_t *invalid_blocks = NULL; /* invalid, but inferable blocks. */ + block_info *blk; + block_info *valid_blocks = NULL; /* valid, but unpropagated blocks. */ + block_info *invalid_blocks = NULL; /* invalid, but inferable blocks. */ /* The arcs were built in reverse order. Fix that now. */ for (ix = fn->blocks.size (); ix--;) @@ -1837,7 +1837,7 @@ solve_flow_graph (function_info *fn) for (unsigned i = 0; i < fn->blocks.size (); i++) { blk = &fn->blocks[i]; - block_t const *prev_dst = NULL; + block_info const *prev_dst = NULL; int out_of_order = 0; int non_fake_succ = 0; @@ -1955,7 +1955,7 @@ solve_flow_graph (function_info *fn) blk->valid_chain = 0; if (blk->num_succ == 1) { - block_t *dst; + block_info *dst; total = blk->count; inv_arc = NULL; @@ -1991,7 +1991,7 @@ solve_flow_graph (function_info *fn) } if (blk->num_pred == 1) { - block_t *src; + block_info *src; total = blk->count; inv_arc = NULL; @@ -2045,7 +2045,7 @@ static void find_exception_blocks (function_info *fn) { unsigned ix; - block_t **queue = XALLOCAVEC (block_t *, fn->blocks.size ()); + block_info **queue = XALLOCAVEC (block_info *, fn->blocks.size ()); /* First mark all blocks as exceptional. */ for (ix = fn->blocks.size (); ix--;) @@ -2056,7 +2056,7 @@ find_exception_blocks (function_info *fn) queue[0]->exceptional = 0; for (ix = 1; ix;) { - block_t *block = queue[--ix]; + block_info *block = queue[--ix]; const arc_info *arc; for (arc = block->succ; arc; arc = arc->succ_next) @@ -2428,7 +2428,7 @@ add_line_counts (coverage_t *coverage, function_info *fn) for (unsigned ix = 0; ix != fn->blocks.size (); ix++) { line_info *line = NULL; - block_t *block = &fn->blocks[ix]; + block_info *block = &fn->blocks[ix]; if (block->count && ix && ix + 1 != fn->blocks.size ()) fn->blocks_executed++; for (unsigned i = 0; i < block->locations.size (); i++) @@ -2524,7 +2524,7 @@ static void accumulate_line_info (line_info *line, source_info *src, gcov_type count = 0; /* Cycle detection. */ - for (vector::iterator it = line->blocks.begin (); + for (vector::iterator it = line->blocks.begin (); it != line->blocks.end (); it++) { for (arc_info *arc = (*it)->pred; arc; arc = arc->pred_next) @@ -2787,7 +2787,7 @@ output_line_details (FILE *f, const line_info *line, unsigned line_num) int ix, jx; ix = jx = 0; - for (vector::const_iterator it = line->blocks.begin (); + for (vector::const_iterator it = line->blocks.begin (); it != line->blocks.end (); it++) { if (!(*it)->is_call_return) 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: 836275 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-466367-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="jwkY7S30"; 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 3yXfV02C8Bz9s71 for ; Thu, 9 Nov 2017 21:26:48 +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=N84Hzd7VNP+53iFOoVscwTYe9YwXGIpOVeOJz1dEv5fO1QRWAAudM eZGS+uaDudB+RQC6jZdc37oO92oW5xQGv6YxINg3xY9zXOyXOhLBv9vjW3s4WoAR anOvRIrHp21KQNi5Iq3b4RrPjurqWCeDQRNu71eV9kkKRvfKFHm73Y= 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=V oKS+Zk6O4AXraw9MziOsez/8rE=; b=jwkY7S30GlWC1ipe1CQd5CIv1eFX0eymt GdVsg7t/iFWQk6WYP7BoZNw3GrzLHXvrkeM6Ku2B9ZXF/YYT/xtNI6ZpuQVS5+5S V3nAZg0BVUo6vzy7Vs+WhB0GNiN+9WdY9yN97WYLq9LklymyW2NndO7xmgA+KQ35 Q9g72FKrQg= Received: (qmail 55626 invoked by alias); 9 Nov 2017 10:25:19 -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 55609 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=-25.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SEM_URIRED, SPF_SOFTFAIL autolearn=ham version=3.3.2 spammy=COVERAGE 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 1eCk1A-0004AZ-V8 for gcc-patches@gcc.gnu.org; Thu, 09 Nov 2017 05:25:07 -0500 Received: from mx2.suse.de ([195.135.220.15]:46248) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eCk1A-00049x-Cm for gcc-patches@gcc.gnu.org; Thu, 09 Nov 2017 05:25:04 -0500 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 997C4ACD3 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: <2ba111df-26cd-8dbf-8e0f-0ee9a4230b5c@suse.cz> Resent-User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 Message-Id: In-Reply-To: References: From: marxin Date: Thu, 9 Nov 2017 11:24:05 +0100 Subject: [PATCH 7/7] GCOV: remove typedef of coverage_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 coverage_info): Remove typedef of coverage_t. (struct source_info): Likewise. (add_branch_counts): Likewise. (add_line_counts): Likewise. (function_summary): Likewise. (output_intermediate_line): Likewise. (generate_results): Likewise. --- gcc/gcov.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/gcc/gcov.c b/gcc/gcov.c index 0e5ae8110ad..0669fd9deab 100644 --- a/gcc/gcov.c +++ b/gcc/gcov.c @@ -294,7 +294,7 @@ struct function_line_start_cmp /* Describes coverage of a file or function. */ -typedef struct coverage_info +struct coverage_info { int lines; int lines_executed; @@ -307,7 +307,7 @@ typedef struct coverage_info int calls_executed; char *name; -} coverage_t; +}; /* Describes a file mentioned in the block graph. Contains an array of line info. */ @@ -329,7 +329,7 @@ struct source_info /* Vector of line information. */ vector lines; - coverage_t coverage; + coverage_info coverage; /* Functions in this source file. These are in ascending line number order. */ @@ -533,10 +533,10 @@ static void read_graph_file (void); static int read_count_file (void); static void solve_flow_graph (function_info *); static void find_exception_blocks (function_info *); -static void add_branch_counts (coverage_t *, const arc_info *); -static void add_line_counts (coverage_t *, 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_t *, const char *); +static void function_summary (const coverage_info *, const char *); 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 *); @@ -968,8 +968,8 @@ output_intermediate_line (FILE *f, line_info *line, unsigned line_num) if (!(*it)->is_unconditional && !(*it)->is_call_non_return) { const char *branch_type; - /* branch:, - branch_coverage_type + /* branch:, + branch_coverage_infoype : notexec (Branch not executed) : taken (Branch executed and taken) : nottaken (Branch executed, but not taken) @@ -1234,7 +1234,7 @@ generate_results (const char *file_name) it != functions.end (); it++) { function_info *fn = *it; - coverage_t coverage; + coverage_info coverage; memset (&coverage, 0, sizeof (coverage)); coverage.name = flag_demangled_names ? fn->demangled_name : fn->name; @@ -2072,7 +2072,7 @@ find_exception_blocks (function_info *fn) /* Increment totals in COVERAGE according to arc ARC. */ static void -add_branch_counts (coverage_t *coverage, const arc_info *arc) +add_branch_counts (coverage_info *coverage, const arc_info *arc) { if (arc->is_call_non_return) { @@ -2184,7 +2184,7 @@ executed_summary (unsigned lines, unsigned executed) /* Output summary info for a function or file. */ static void -function_summary (const coverage_t *coverage, const char *title) +function_summary (const coverage_info *coverage, const char *title) { fnotice (stdout, "%s '%s'\n", title, coverage->name); executed_summary (coverage->lines, coverage->lines_executed); @@ -2421,7 +2421,7 @@ mangle_name (char const *base, char *ptr) the appropriate basic block. */ static void -add_line_counts (coverage_t *coverage, function_info *fn) +add_line_counts (coverage_info *coverage, function_info *fn) { bool has_any_line = false; /* Scan each basic block. */