Silence gcc warnings with -O3
authorFelipe Contreras <felipe.contreras@gmail.com>
Sun, 11 May 2014 04:07:55 +0000 (23:07 -0500)
committerFelipe Contreras <felipe.contreras@gmail.com>
Wed, 18 May 2016 20:23:02 +0000 (15:23 -0500)
commit7d062ab1a20372f2c880ba771ca68470d8f16b92
tree2bd1d377e06a5449c12bc29d13f5b4ecc563649c
parent15b9f1ea4c393b23fc3aa7639b61691e3d78137d
Silence gcc warnings with -O3

Commit a469a10 (silence some -Wuninitialized false positives) tried to
silence some uninitialized false-positives with a hack. This hack
triggered many more warnings on clang, and eventually gcc 4.9.0 as well.

While more hacks can be used to silence the new warnings, it's much
better to decouple ourselves from such hacks and help the compilers
directly.

We can do that by either initializing the variables, or manually
returning the error value (-1) without depending on error() to do it.

This fixes warnings while compiling with gcc -O3.

  parse-options.c: In function ‘get_value’:
  parse-options.c:183:24: warning: ‘arg’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     *(int *)opt->value = strtol(arg, (char **)&s, 10);
  ^
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
parse-options.c
remote.c
vcs-svn/svndiff.c