This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: gcov: new option to merge results
Tristan Gingold wrote:
Hi,
this is the updated version of the patch. No new option, results are
merged as soon as there are multiple input files.
You've used two different approaches to scanning a files function list. Here
you clear the list and then reattach it at the end:
+ function_t *fn_p;
+ function_t *old_functions;
+
+ /* Save and clear the list of current functions. They will be appended
+ later. */
+ old_functions = functions;
+ functions = NULL;
create_file_names (file_name);
if (read_graph_file ())
@@ -515,8 +529,19 @@
if (read_count_file ())
return;
- for (fn = functions; fn; fn = fn->next)
+ for (fn_p = NULL, fn = functions; fn; fn_p = fn, fn = fn->next)
solve_flow_graph (fn);
+
+ if (fn_p)
+ fn_p->next = old_functions;
+}
but later on you have a case where you just remember the original list head and
stop scanning when you reach that point. IMHO the latter approach is more
readable. Is there a reason the above loop cannot simply be:
function_t *orig_functions = functions;
...
for (fn = functions; fn != orig_functions; fn->next)
solve_flow_graph (fn)
?
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk