Hi,
On Mon, 2014-09-15 at 16:19 +0200, Peter Meerwald wrote:
> From: Peter Meerwald <[email protected]>
>
> CC src/src_connmand-service.o
> src/service.c: In function ‘__connman_service_ipconfig_indicate_state’:
> src/service.c:5771:13: warning: ‘old_state’ may be used uninitialized in this
> function [-Wuninitialized]
>
> __connman_service_ipconfig_indicate_state() checks connman_ipconfig_type for
> IPv4, IPv6 and
> UNDEFINED -- it is better to add a default case instead of checking for value
> UNDEFINED so the
> compiler knows all possible valid types and can infer that old_state is
> always initialized
Adding all variables in a switch is the preferred way. That way one
catches those instances that miss a (newly added) value.
Currently CONNMAN_IPCONFIG_TYPE_UNKNOWN and CONNMAN_IPCONFIG_TYPE_ALL
are both defined as 0, which means the compiler complains about the same
value being used twice. I'd rather get rid of CONNMAN_IPCONFIG_TYPE_ALL,
or, if not possible, initialize old_state as a temporary solution.
Cheers,
Patrik
_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman