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>
Thu, 19 May 2016 00:01:51 +0000 (19:01 -0500)
commit02418490c69132313d6b612878cdfaaf8b5ef35b
tree3456db6b4a14e94f370c53d702cf902321d6bc7a
parent72fe7f562b942c900e2ef138c473d8f1e177e283
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