This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 4/7] GCOV: remove typedef for function_t
- From: marxin <mliska at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Cc: nathan at acm dot org
- Date: Thu, 9 Nov 2017 11:24:05 +0100
- Subject: [PATCH 4/7] GCOV: remove typedef for function_t
- Authentication-results: sourceware.org; auth=none
- References: <cover.1510223055.git.mliska@suse.cz>
- Resent-user-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0
gcc/ChangeLog:
2017-11-09 Martin Liska <mliska@suse.cz>
* 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<function_t *> get_functions_at_location (unsigned line_num) const;
+ vector<function_info *> 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 <function_t *> functions;
+ vector <function_info *> 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<function_t *>
+vector<function_info *>
source_info::get_functions_at_location (unsigned line_num) const
{
- vector<function_t *> r;
+ vector<function_info *> r;
- for (vector<function_t *>::const_iterator it = functions.begin ();
+ for (vector<function_info *>::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<function_t *> functions;
+static vector<function_info *> functions;
/* Vector of source files. */
static vector<source_info> 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<function_t *>::iterator it = src->functions.begin ();
+ for (vector<function_info *>::iterator it = src->functions.begin ();
it != src->functions.end (); it++)
{
/* function:<name>,<line_number>,<execution_count> */
@@ -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<function_t *> fns = src->get_functions_at_location (line_num);
+ vector<function_info *> fns = src->get_functions_at_location (line_num);
/* Print first group functions that begin on the line. */
- for (vector<function_t *>::iterator it2 = fns.begin ();
+ for (vector<function_info *>::iterator it2 = fns.begin ();
it2 != fns.end (); it2++)
{
vector<line_info> &lines = (*it2)->lines;
@@ -1106,10 +1106,10 @@ process_file (const char *file_name)
read_count_file ();
- hash_map<function_start_pair_hash, function_t *> fn_map;
+ hash_map<function_start_pair_hash, function_info *> fn_map;
/* Identify group functions. */
- for (vector<function_t *>::iterator it = functions.begin ();
+ for (vector<function_info *>::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<function_t *>::iterator it = functions.begin ();
+ for (vector<function_info *>::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<function_t *>::iterator it = functions.begin ();
+ for (vector<function_info *>::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<function_t *>::iterator it = functions.begin ();
+ for (vector<function_info *>::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<function_t *>::reverse_iterator it = functions.rbegin ();
- it != functions.rend (); it++)
+ for (vector<function_info *>::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<function_t *>::iterator it = src->functions.begin ();
+ for (vector<function_info *>::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<function_t *>::iterator it = src->functions.begin ();
+ for (vector<function_info *>::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<function_t *> fns;
+ vector<function_info *> 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<function_t *>::iterator it = fns.begin ();
+ for (vector<function_info *>::iterator it = fns.begin ();
it != fns.end (); it++)
{
function_info *fn = *it;
--
2.14.3