Re: [google 4_7] Fix bad merge into coverage_init (issue7322063)

2013-02-12 Thread Teresa Johnson
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  wrote:
> ok. The same problem exists in google/main too.
>
> David
>
> On Tue, Feb 12, 2013 at 1:38 PM, Teresa Johnson  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  
>>
>> * 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 | Software Engineer | tejohn...@google.com | 408-460-2413


Re: [google 4_7] Fix bad merge into coverage_init (issue7322063)

2013-02-12 Thread Xinliang David Li
ok. The same problem exists in google/main too.

David

On Tue, Feb 12, 2013 at 1:38 PM, Teresa Johnson  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  
>
> * 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