This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: ARM-only [Patch] Allow 4 byte enum size (-fno-short-enums) | Remove hard coded short enum flag from the build scripts?
- From: Joel Sherrill <joel dot sherrill at oarcorp dot com>
- To: "newlib at sourceware dot org" <newlib at sourceware dot org>,Corinna Vinschen <vinschen at redhat dot com>,Dennis Pahl <dennis at pahl dot de>
- Cc: "d dot pahl at pilz dot de" <d dot pahl at pilz dot de>,Matthew Wahab <matthew dot wahab at foss dot arm dot com>
- Date: Tue, 30 Aug 2016 07:45:07 -0500
- Subject: Re: ARM-only [Patch] Allow 4 byte enum size (-fno-short-enums) | Remove hard coded short enum flag from the build scripts?
- Authentication-results: sourceware.org; auth=none
- References: <86388ac2-70e3-2a15-a021-cab3b0dea9fe@pahl.de> <20160830094718.GB23664@calimero.vinschen.de>
On August 30, 2016 4:47:18 AM CDT, Corinna Vinschen <vinschen@redhat.com> wrote:
>On Aug 28 16:31, Dennis Pahl wrote:
>> Hi,
>>
>> in my project I need the enum size to be 4 bytes. Therefore in order
>to get
>> no linker compatibility warnings, I also require newlib to use 4
>bytes for
>> its enums.
>>
>> 4 byte enums can be achieved by specifying the following compiler
>flag
>> "-fno-short-enums". This flag works fine for the source code of my
>project.
>> Newlib, however, has a problem with this flag due to some hard coded
>> compiler invocations which include the opposite flag "-fshort-enums".
>>
>> A look in the mailing list archive revealed, that there already has
>been a
>> discussion about this problem
>> (https://sourceware.org/ml/newlib/2013/msg00183.html). The final
>advice from
>> Michael Bruck, who started the discussion, was to remove these hard
>coded
>> flags entirely from the build script files. Is there a reason why
>this did
>> not happen?
>>
>> With the removed hard coded flags the enum size can be configured by
>> specifying
>> CFLAGS_FOR_TARGET= '-fno-short-enums' or '-fshort-enums'
>> CXXFLAGS_FOR_TARGET='-fno-short-enums' or '-fshort-enums'
>>
>> By following Michael Bruck's advice I was able to build newlib with
>the
>> wanted enum size.
>
>The patch is ok with me, what do other user's of ARM think?
I assume the default is 32 bit.
Does configuring newlib for small size automatically trigger the small enum size?
Someone who works more intimately with the arm and especially the smaller ones needs to comment
--joel
>
>Corinna
--joel