[C++ Patch] Fixes for duplicate warnings regressions [1/2]

Jason Merrill jason@redhat.com
Tue Nov 26 01:50:00 GMT 2013


On 11/25/2013 05:02 AM, Paolo Carlini wrote:
> because then we don't warn *at all*. The reason being that with the
> *first* cp_convert we end up calling c_common_truthvalue_conversion with
> c_inhibit_evaluation_warnings bumped. The bumping happens in
> cp_truthvalue_conversion. A mess, yes.

Perhaps cp_truthvalue_conversion should do something more specific to 
the actual warning it's trying to avoid.

> At this Stage, if we don't feel
> like going with something like my last try or something even less
> straightforward reworking the way we bump c_inhibit_evaluation_warnings
> in the various circumstances, I'm tempted to go back to my first try:
>
> -      tree folded_result = cp_convert (type, folded, complain);
> +      tree folded_result
> +    = folded != expr ? cp_convert (type, folded, complain) : result;
>
> Would it be safe? I mean, is it at all possible that folded == expr and
> in fact we should call again cp_convert? Because otherwise it's also a
> (minor) optimization and radically avoids the problem.

That's fine with me.

Jason




More information about the Gcc-patches mailing list