On Thu, Dec 11, 2014 at 04:33:46PM +0100, Michal Židek wrote:
On 12/08/2014 10:53 PM, Lukas Slebodnik wrote:
>On (08/12/14 22:07), Jakub Hrozek wrote:
>>On Mon, Dec 08, 2014 at 10:35:15AM +0100, Lukas Slebodnik wrote:
>>>ehlo,
>>>
>>>Michal tried to fix gcc warning im commit
>>>cff89439b21f8573c6896b09cb1a8d5f9de3144c
>>>
>>>The previous fix was not sufficient and similar warning appears after
different
>>>change in function load_configuration.
>>>
>>>src/monitor/monitor.c: In function ‘main’:
>>>src/monitor/monitor.c:2962:24: error: ‘monitor’ may be used uninitialized
>>> in this function
[-Werror=maybe-uninitialized]
>>> monitor->is_daemon = !opt_interactive;
>>> ^
>>>cc1: all warnings being treated as errors
>>>
>>>It's better to disable optimisation of function load_configuration after
fail
>>>in chown(unlink) instead of checking errno for 0 and overriding it with
EINVAL.
>>>
>>>LS
>>
>>I'm fine with the change and it gets rid of the ugly workaround. What OS
>>and what CFLAGS shall I use to test the fix?
>It is possible to reproduce warning with "-g -O2".
>I can see it on fedora 21, rawhide.
>
>fedora 20 and rhel7 has similar warning (I didn't tested with my patch)
>src/monitor/monitor.c: In function 'main':
>src/monitor/monitor.c:2263:9: warning: 'monitor' may be used uninitialized in
this function [-Wmaybe-uninitialized]
> tes = tevent_add_signal(ctx->ev, ctx, SIGHUP, 0,
> ^
>src/monitor/monitor.c:2772:20: note: 'monitor' was declared here
> struct mt_ctx *monitor;
> ^
>
>LS
In Centos 7 I had to use -O1 to see the warning.
The patch looks good to me. The warning disappears with this patch.
Ack from me.
Michal
d72958f09ce3718019992b7a117f112e38855b55