[patch] gcc.dg/compare1.c: Add -fno-short-enums.

Paul Brook paul@codesourcery.com
Sun Jul 3 16:58:00 GMT 2005


> | 		 Do not warn if the comparison is being done in a signed type,
> | 		 since the signed type will only be chosen if it can represent
> | 		 all the values of the unsigned type.  */
> | 	      if (!TYPE_UNSIGNED (result_type))
> | 		/* OK */;
> |
> | The patch solves the problem as suggested by Paul Brook.  (Thanks
> | Paul!)  Specifically, if we add -fno-short-enums, we can force targets
> | like arm*-*-eabi* and arm*-*-symbianelf* as well as other targets to
> | use enum of the same size as int.  This way, even if somebody adds a
> | port with short enum, we won't have to touch this testcase.
> |
> | Tested on x86_64-pc-linux-gnu and arm-none-eabi.  OK to apply?
>
> I do not understand.  Why don't you add a new separate testcase for
> the kind of thing you would like to test?  If this specific testcase
> is expected to fail on arm*-*-eabi* and arm*-*-symbianelf* then you
> should mark it as XFAIL for those targets.

The test is testing a generic compiler feature. The exact conditions under 
which the warning occurs depends on the defaults used by the target ABI. 
Given we have a commandline switch to control this behavior it seems better 
to use it than to try and enumerate all the inconvenient targets.

The fully correct solution (IMHO overkill in this case) is to create two 
copies of the test. Compile one with -fshort-enums, and the other with 
-fno-short-enums. This gives us full coverage on all targets.

Paul



More information about the Gcc-patches mailing list