This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix compiler warnings


On Wed, May 06, 2015 at 04:22:13PM +0000, Aditya K wrote:
> Thanks Richard, Jakub and Trevor for the feedback. I have reformatted the changelog, and modified the patch addressing your comments.
> 
> -Aditya
> 
> 
> 2015-05-06  Aditya Kumar  <hiraditya@msn.com>
> 
>         * gcov-tool.c (do_merge):
>         * ipa-icf.c (sem_item::hash_referenced_symbol_properties):
>         * reload.h (struct target_reload):

After the : you need to say what has changed.

> --- a/gcc/gcov-tool.c
> +++ b/gcc/gcov-tool.c
> @@ -193,7 +193,7 @@ static int
>  do_merge (int argc, char **argv)
>  {
>    int opt;
> -  int ret;
> +  int ret = 0;

Initializing ret makes no sense then.

>    const char *output_dir = 0;
>    int w1 = 1, w2 = 1;
>  
> @@ -222,11 +222,11 @@ do_merge (int argc, char **argv)
>    if (output_dir == NULL)
>      output_dir = "merged_profile";
>  
> -  if (argc - optind == 2)
> -    ret = profile_merge (argv[optind], argv[optind+1], output_dir, w1, w2);
> -  else
> +  if (argc - optind != 2)
>      merge_usage ();
>  
> +  ret = profile_merge (argv[optind], argv[optind+1], output_dir, w1, w2);
> +
>    return ret;

Perhaps better would be just
  return profile_merge (argv[optind], argv[optind+1], output_dir, w1, w2);
and remove ret.

> --- a/gcc/reload.h
> +++ b/gcc/reload.h
> @@ -168,7 +168,7 @@ struct target_reload {
>       value indicates the level of indirect addressing supported, e.g., two
>       means that (MEM (MEM (REG n))) is also valid if (REG n) does not get
>       a hard register.  */
> -  bool x_spill_indirect_levels;
> +  signed char x_spill_indirect_levels;

As negative values make no sense, this is better unsigned char than signed.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]