[PATCH] Fix excess warnings from -Wtype-limits with location wrappers (PR c++/88680)

Jakub Jelinek jakub@redhat.com
Thu Feb 14 16:32:00 GMT 2019


On Thu, Feb 14, 2019 at 11:26:15AM -0500, David Malcolm wrote:
> There's an asymmetry in the warning; it's looking for a comparison of a
> LHS expression against an RHS constant 0, spelled as "0".
> 
> If we fold_for_warn on the RHS, then that folding introduces a warning
> for expressions that aren't spelled as "0" but can be folded to 0,
> e.g., with:
> 
> enum { FOO, BAR };

So, shouldn't it be made symmetric?  Check if one argument is literal 0
before folding, and only if it is, fold_for_warn the other argument?

	Jakub



More information about the Gcc-patches mailing list