This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fix compiler warnings
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Aditya K <hiraditya at msn dot com>
- Cc: Richard Sandiford <rdsandiford at googlemail dot com>, Marek Polacek <polacek at redhat dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 6 May 2015 18:26:10 +0200
- Subject: Re: Fix compiler warnings
- Authentication-results: sourceware.org; auth=none
- References: <BLU179-W78C3F88CD6DA1340CE7255B6D00 at phx dot gbl> <20150506145803 dot GY1751 at tucnak dot redhat dot com> <87ioc5zoy4 dot fsf at googlemail dot com> <BLU179-W73548E60DA439522BBB7BB6D00 at phx dot gbl>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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