[PATCH] Tame a few enum size tests when using -fshort-enums on ARM.

Jon Roelofs jonathan at codesourcery.com
Fri Aug 15 08:43:27 PDT 2014


> The patch you have now looks good but I think a more universal solution might be better since these tests will fail whenever -f-short-enums is used. Something like:
I'm not sure I understand... This works on ARM for both -fshort-enums and -fno-short-enums.

>     test_make_signed<const Enum, std::conditional<sizeof(Enum) == sizeof(int), const int, const signed char>::type>()

That seems better on the surface, but assumes that short enums are char sized, which might not be the case on all platforms.  I think that the version that checks __ARM_SIZEOF_MINIMAL_ENUM does a better job of calling out the fact that it's a weird case.

> Out of curiosity how are you getting the -fshort-enums flag into lit to test?
I need ABI compatibility with a bare-metal GCC toolchain and that toolchain defaults bare-metal AAPCS targets to -fshort-enums, so my driver sets it.

http://reviews.llvm.org/D4869






More information about the cfe-commits mailing list