On 10/08/2016 04:50 PM, Trevor Saunders wrote:
On Fri, Oct 07, 2016 at 03:18:07PM +0000, Bernd Edlinger wrote:
This extends -Wint-in-bool-context to uses of enum values in boolean
context, and fixes one place where accidentally an enum value was
passed to a bool parameter.
I excluded enum values 0 and 1 because that is used in
gimple-ssa-strength-reduction.c, where we have enums
which are passed in bool function arguments:
UNKNOWN_STRIDE = 0,
KNOWN_STRIDE = 1
NOT_PHI_ADJUST = 0,
PHI_ADJUST = 1
DONT_COUNT_PHIS = 0,
COUNT_PHIS = 1
I would'nt use an enum in that way, but I think it is
at least not completely wrong to do it like that...
Using enums here seems reasonable see the discussion here
http://gcc.gnu.org/ml/gcc/2016-10/msg00006.html however I don't
understand why that code makes the argument type bool instead of the
enum type. Here's an untested patch to change those functions to take
the enum type. It might make sense to change naming some, but I think
this is somewhat of an improvement as it is.
diff --git a/gcc/gimple-ssa-strength-reduction.c
index 7b14b91..f61805c 100644
[ ... ]
Seems reasonable. Feel free to commit after the usual testing.