This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gcc-in-cxx] Avoid goto in gcov.c
- From: Ian Lance Taylor <iant at google dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 03 Feb 2009 07:55:53 -0800
- Subject: [gcc-in-cxx] Avoid goto in gcov.c
C++ does not permit a goto into a block which defines initialized
local variables. This patch fixes a case where this happens in gcov.c
by duplicating an error message. This could probably be fixed more
cleanly on mainline by using a helper function.
Ian
2009-02-03 Ian Lance Taylor <iant@google.com>
* gcov.c (read_count_file): Avoid goto.
Index: gcov.c
===================================================================
--- gcov.c (revision 143890)
+++ gcov.c (working copy)
@@ -1091,7 +1091,6 @@ read_count_file (void)
;
else if (gcov_read_unsigned () != fn->checksum)
{
- mismatch:;
fnotice (stderr, "%s:profile mismatch for '%s'\n",
da_file_name, fn->name);
goto cleanup;
@@ -1100,7 +1099,11 @@ read_count_file (void)
else if (tag == GCOV_TAG_FOR_COUNTER (GCOV_COUNTER_ARCS) && fn)
{
if (length != GCOV_TAG_COUNTER_LENGTH (fn->num_counts))
- goto mismatch;
+ {
+ fnotice (stderr, "%s:profile mismatch for '%s'\n",
+ da_file_name, fn->name);
+ goto cleanup;
+ }
if (!fn->counts)
fn->counts = XCNEWVEC (gcov_type, fn->num_counts);