[ovs-dev] [PATCH] sparse: eliminate "duplicate initialization" warning

Greg Rose gvrose8192 at gmail.com
Tue Aug 29 17:06:54 UTC 2017


On 08/28/2017 08:23 AM, Lance Richardson wrote:
> Sparse version 0.5.1 will be released in the near future. Prepare
> for it by eliminating the only new warning (as of 0.5.1-rc5):
>
> ofproto/fail-open.c:134:22: error: Initializer entry defined twice
> ofproto/fail-open.c:135:22:   also defined here
>
> MATCH_CATCHALL_INITIALIZER effectively sets all fields of .flow to
> zero, which is redundant because according to the C99 semantics for
> structure initialization, initializing any single member of a
> structure results in all other members being initialized to zero,
> and the next line initializes a member of the same structure.
>
> Signed-off-by: Lance Richardson <lrichard at redhat.com>
> ---
>   ofproto/fail-open.c | 1 -
>   1 file changed, 1 deletion(-)
>
> diff --git a/ofproto/fail-open.c b/ofproto/fail-open.c
> index 914a51b4b..819bdadc3 100644
> --- a/ofproto/fail-open.c
> +++ b/ofproto/fail-open.c
> @@ -131,7 +131,6 @@ send_bogus_packet_ins(struct fail_open *fo)
>                   .base = {
>                       .packet = dp_packet_data(&b),
>                       .packet_len = dp_packet_size(&b),
> -                    .flow_metadata = MATCH_CATCHALL_INITIALIZER,
>                       .flow_metadata.flow.in_port.ofp_port = OFPP_LOCAL,
>                       .flow_metadata.wc.masks.in_port.ofp_port
>                       = u16_to_ofp(UINT16_MAX),
>
Reviewed-by: Greg Rose <gvrose8192 at gmail.com>



More information about the dev mailing list