ARM-only [Patch] Allow 4 byte enum size (-fno-short-enums) | Remove hard coded short enum flag from the build scripts?
Wed Aug 31 12:44:00 GMT 2016
> -----Original Message-----
> From: Richard Earnshaw (lists) [mailto:Richard.Earnshaw@arm.com]
> Sent: Wednesday, August 31, 2016 2:38 PM
> To: Schwarz, Konrad (CT RDA ITP SES-DE); email@example.com
> Subject: Re: ARM-only [Patch] Allow 4 byte enum size (-fno-short-enums)
> | Remove hard coded short enum flag from the build scripts?
> > But wouldn't it suffice to allow the user to select (or override) the
> > build attribute to set on the file, e.g., via a compiler command line
> Yes, but 1) we have no builds of GCC available *today* that can do that
> and 2) experience has shown that such 'power user' options generally
> confuse most users and lead to more problems than they really solve
> unless they can validate the user's assertions.
> > Obviously, this requires the compiler to trust the user.
> > Conversely, as there is no way in (standard) C to distinguish an ABI
> > from interfaces internal to the implementation, any scheme to
> > determine this build attribute automatically cannot be fully
> > satisfactory, no?
> No, this is nothing to do with standard C. The C standard just thinks
> about enums at the conceptual level. It doesn't grubby its hands with
> nasty details like ABIs or layout in general... The idea that this
> might be changed in different translation units is completely off-
The corollary being that the only way to do this properly is via a compiler
switch, even it is confusing to non-power users. (Since when has
GCC limited itself to the needs of non-power users?)
More information about the Newlib