[PATCH] Prevent 'control reaches end of non-void function' warning for DO_WHILE

Jason Merrill jason@redhat.com
Mon Apr 16 14:23:00 GMT 2012


On 04/14/2012 05:43 PM, Tom de Vries wrote:
>>> >>  +      tree expr = NULL;
>>> >>  +      append_to_statement_list (*block,&expr);
>>> >>  +      *block = expr;
>> >
>> >  Rather than doing this dance here, I think it would be better to enhance
>> >  append_to_statement_list to handle the case of the list argument being a
>> >  non-list.
>> >
> Added return value to append_to_statement_list, so now it's:
>
> *block = append_to_statement_list (*block, NULL);

That's different from what I was suggesting; if the list argument is a 
pointer to a non-list, we can build up a list for at at that time, so we 
don't need the

> +      *block = append_to_statement_list (*block, NULL);

line at all; when we see

> +      append_to_statement_list (build1 (LABEL_EXPR, void_type_node, label),
> +				block);

if *block isn't a STATEMENT_LIST we just make the necessary adjustments.

Jason



More information about the Gcc-patches mailing list