On Mon, Apr 21, 2014 at 08:02:39PM +0200, Jakub Jelinek wrote: > Sure, we could change this to use mode_size_inline ((enum machine_mode) > (MODE)) > in the macro instead, but I'd say for GCC codebase it is better if we fix > the few users of these macros that pass an int rather than enum machine_mode > to these macros.
I fixed the powerpc (PR 60876), and while it would have been nice to have tested this against more backends, it was fairly simple to go through the GET_MODE_SIZE's and make them type correct. For the PowerPC, it tended to be in code of the form: for (m = 0; m < NUM_MACHINE_MODES; ++m) { // ... if (GET_MODE_SIZE (m)) ... } and the fix was to do something like: for (m = 0; m < NUM_MACHINE_MODES; ++m) { enum machine_mode m2 = (enum machine_mode)m; // ... if (GET_MODE_SIZE (m2)) ... } It reminds me when I was in the original ANSI C committee that made the 1989 ANSI and 1990 ISO C standards, we debated making enum's more first class citizens, so you could do ++/-- on them, but the committee tended to be divided into 3 camps, one that wanted to delete enums altogether, one that wanted them as int constants, and one that wanted more type checking. -- Michael Meissner, IBM IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA email: meiss...@linux.vnet.ibm.com, phone: +1 (978) 899-4797