Patchwork [google,4_7] Fix bad merge into coverage_init (issue7322063)

login
register
mail settings
Submitter Teresa Johnson
Date Feb. 12, 2013, 9:38 p.m.
Message ID <20130212213835.B3CE361568@tjsboxrox.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/219992/
State New
Headers show

Comments

Teresa Johnson - Feb. 12, 2013, 9:38 p.m.
This patch fixes a bad merge from google/integration to google/4_7.

Passes regression tests. Ok for google/4_7?

Thanks,
Teresa

2013-02-12  Teresa Johnson  <tejohnson@google.com>

	* coverage.c (coverage_init): Move test coverage handling
        to the correct location within coverage_init (as in trunk)
        to avoid overlapping gcov_open calls.


--
This patch is available for review at http://codereview.appspot.com/7322063
Xinliang David Li - Feb. 12, 2013, 9:54 p.m.
ok. The same problem exists in google/main too.

David

On Tue, Feb 12, 2013 at 1:38 PM, Teresa Johnson <tejohnson@google.com> wrote:
> This patch fixes a bad merge from google/integration to google/4_7.
>
> Passes regression tests. Ok for google/4_7?
>
> Thanks,
> Teresa
>
> 2013-02-12  Teresa Johnson  <tejohnson@google.com>
>
>         * coverage.c (coverage_init): Move test coverage handling
>         to the correct location within coverage_init (as in trunk)
>         to avoid overlapping gcov_open calls.
>
> Index: coverage.c
> ===================================================================
> --- coverage.c  (revision 195984)
> +++ coverage.c  (working copy)
> @@ -2635,25 +2635,6 @@ coverage_init (const char *filename, const char* s
>    da_base_file_name = XNEWVEC (char, strlen (filename) + 1);
>    strcpy (da_base_file_name, filename);
>
> -  /* Name of bbg file.  */
> -  if (flag_test_coverage && !flag_compare_debug)
> -    {
> -      bbg_file_name = XNEWVEC (char, len + strlen (GCOV_NOTE_SUFFIX) + 1);
> -      memcpy (bbg_file_name, filename, len);
> -      strcpy (bbg_file_name + len, GCOV_NOTE_SUFFIX);
> -      if (!gcov_open (bbg_file_name, -1))
> -       {
> -         error ("cannot open %s", bbg_file_name);
> -         bbg_file_name = NULL;
> -       }
> -      else
> -       {
> -         gcov_write_unsigned (GCOV_NOTE_MAGIC);
> -         gcov_write_unsigned (GCOV_VERSION);
> -         gcov_write_unsigned (local_tick);
> -       }
> -    }
> -
>    if (profile_data_prefix == 0 && !IS_ABSOLUTE_PATH (source_name))
>      {
>        src_name_prefix = getpwd ();
> @@ -2698,6 +2679,25 @@ coverage_init (const char *filename, const char* s
>      }
>    if (flag_auto_profile)
>      init_auto_profile ();
> +
> +  /* Name of bbg file.  */
> +  if (flag_test_coverage && !flag_compare_debug)
> +    {
> +      bbg_file_name = XNEWVEC (char, len + strlen (GCOV_NOTE_SUFFIX) + 1);
> +      memcpy (bbg_file_name, filename, len);
> +      strcpy (bbg_file_name + len, GCOV_NOTE_SUFFIX);
> +      if (!gcov_open (bbg_file_name, -1))
> +       {
> +         error ("cannot open %s", bbg_file_name);
> +         bbg_file_name = NULL;
> +       }
> +      else
> +       {
> +         gcov_write_unsigned (GCOV_NOTE_MAGIC);
> +         gcov_write_unsigned (GCOV_VERSION);
> +         gcov_write_unsigned (local_tick);
> +       }
> +    }
>  }
>
>  /* Return True if any type of profiling is enabled which requires linking
>
> --
> This patch is available for review at http://codereview.appspot.com/7322063
Teresa Johnson - Feb. 12, 2013, 10:06 p.m.
Ok, I will apply the same fix to google/main after appropriate testing.

Teresa

On Tue, Feb 12, 2013 at 1:54 PM, Xinliang David Li <davidxl@google.com> wrote:
> ok. The same problem exists in google/main too.
>
> David
>
> On Tue, Feb 12, 2013 at 1:38 PM, Teresa Johnson <tejohnson@google.com> wrote:
>> This patch fixes a bad merge from google/integration to google/4_7.
>>
>> Passes regression tests. Ok for google/4_7?
>>
>> Thanks,
>> Teresa
>>
>> 2013-02-12  Teresa Johnson  <tejohnson@google.com>
>>
>>         * coverage.c (coverage_init): Move test coverage handling
>>         to the correct location within coverage_init (as in trunk)
>>         to avoid overlapping gcov_open calls.
>>
>> Index: coverage.c
>> ===================================================================
>> --- coverage.c  (revision 195984)
>> +++ coverage.c  (working copy)
>> @@ -2635,25 +2635,6 @@ coverage_init (const char *filename, const char* s
>>    da_base_file_name = XNEWVEC (char, strlen (filename) + 1);
>>    strcpy (da_base_file_name, filename);
>>
>> -  /* Name of bbg file.  */
>> -  if (flag_test_coverage && !flag_compare_debug)
>> -    {
>> -      bbg_file_name = XNEWVEC (char, len + strlen (GCOV_NOTE_SUFFIX) + 1);
>> -      memcpy (bbg_file_name, filename, len);
>> -      strcpy (bbg_file_name + len, GCOV_NOTE_SUFFIX);
>> -      if (!gcov_open (bbg_file_name, -1))
>> -       {
>> -         error ("cannot open %s", bbg_file_name);
>> -         bbg_file_name = NULL;
>> -       }
>> -      else
>> -       {
>> -         gcov_write_unsigned (GCOV_NOTE_MAGIC);
>> -         gcov_write_unsigned (GCOV_VERSION);
>> -         gcov_write_unsigned (local_tick);
>> -       }
>> -    }
>> -
>>    if (profile_data_prefix == 0 && !IS_ABSOLUTE_PATH (source_name))
>>      {
>>        src_name_prefix = getpwd ();
>> @@ -2698,6 +2679,25 @@ coverage_init (const char *filename, const char* s
>>      }
>>    if (flag_auto_profile)
>>      init_auto_profile ();
>> +
>> +  /* Name of bbg file.  */
>> +  if (flag_test_coverage && !flag_compare_debug)
>> +    {
>> +      bbg_file_name = XNEWVEC (char, len + strlen (GCOV_NOTE_SUFFIX) + 1);
>> +      memcpy (bbg_file_name, filename, len);
>> +      strcpy (bbg_file_name + len, GCOV_NOTE_SUFFIX);
>> +      if (!gcov_open (bbg_file_name, -1))
>> +       {
>> +         error ("cannot open %s", bbg_file_name);
>> +         bbg_file_name = NULL;
>> +       }
>> +      else
>> +       {
>> +         gcov_write_unsigned (GCOV_NOTE_MAGIC);
>> +         gcov_write_unsigned (GCOV_VERSION);
>> +         gcov_write_unsigned (local_tick);
>> +       }
>> +    }
>>  }
>>
>>  /* Return True if any type of profiling is enabled which requires linking
>>
>> --
>> This patch is available for review at http://codereview.appspot.com/7322063

Patch

Index: coverage.c
===================================================================
--- coverage.c	(revision 195984)
+++ coverage.c	(working copy)
@@ -2635,25 +2635,6 @@  coverage_init (const char *filename, const char* s
   da_base_file_name = XNEWVEC (char, strlen (filename) + 1);
   strcpy (da_base_file_name, filename);
 
-  /* Name of bbg file.  */
-  if (flag_test_coverage && !flag_compare_debug)
-    {
-      bbg_file_name = XNEWVEC (char, len + strlen (GCOV_NOTE_SUFFIX) + 1);
-      memcpy (bbg_file_name, filename, len);
-      strcpy (bbg_file_name + len, GCOV_NOTE_SUFFIX);
-      if (!gcov_open (bbg_file_name, -1))
-	{
-	  error ("cannot open %s", bbg_file_name);
-	  bbg_file_name = NULL;
-	}
-      else
-	{
-	  gcov_write_unsigned (GCOV_NOTE_MAGIC);
-	  gcov_write_unsigned (GCOV_VERSION);
-	  gcov_write_unsigned (local_tick);
-	}
-    }
-
   if (profile_data_prefix == 0 && !IS_ABSOLUTE_PATH (source_name))
     {
       src_name_prefix = getpwd ();
@@ -2698,6 +2679,25 @@  coverage_init (const char *filename, const char* s
     }
   if (flag_auto_profile)
     init_auto_profile ();
+
+  /* Name of bbg file.  */
+  if (flag_test_coverage && !flag_compare_debug)
+    {
+      bbg_file_name = XNEWVEC (char, len + strlen (GCOV_NOTE_SUFFIX) + 1);
+      memcpy (bbg_file_name, filename, len);
+      strcpy (bbg_file_name + len, GCOV_NOTE_SUFFIX);
+      if (!gcov_open (bbg_file_name, -1))
+	{
+	  error ("cannot open %s", bbg_file_name);
+	  bbg_file_name = NULL;
+	}
+      else
+	{
+	  gcov_write_unsigned (GCOV_NOTE_MAGIC);
+	  gcov_write_unsigned (GCOV_VERSION);
+	  gcov_write_unsigned (local_tick);
+	}
+    }
 }
 
 /* Return True if any type of profiling is enabled which requires linking