-fno-short-enums

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

-fno-short-enums

4,193 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by david35 on Tue Feb 26 07:35:51 MST 2013
Hello,

I am working on LPC1777 with LPCXpresso 4.3. Currently, my code is compiled in mode "short-enum-size". I would like to compile with "-fno-short-enums" option but with this setting, I have a lot of warnings like "uses 32-bit enums yet the output is to use variable-size enums; use of enum values accross objects may fail". (data transfer between my electronic board and a PC). I want to fix and suppress theses warnings, but how?

Thanks for your answer.
David
0 项奖励
回复
5 回复数

3,473 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Thu Feb 28 02:28:38 MST 2013
You can download and build Newlib sources....

However, you could workaround this issue by changing your enum definitions so that (at least one of) the definitions uses an int value. For example
enum my_enum {
   first = (int) 0, // forces size of enum to be an int
   second,
   third,
   etc
}
0 项奖励
回复

3,474 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by david35 on Wed Feb 27 09:40:47 MST 2013
ok, I understand that REDLIB source code is not available. Is there another solution?
To sum our need, we use an API (from a previous developement) that contains enums defined on 32bits. if it is not possible to modify the REDLIB, is there any risk to work with a project built with no-short-enums option while REDLIB is in short-enum-size option?
If no solution, is it possible to desactivate these warnings at the end of the built in order to be sure to not forget real warnings dissimulated in the warning list?

Thanks,
David.
0 项奖励
回复

3,474 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Wed Feb 27 02:43:31 MST 2013
No it is not.

Why do you think you need this option?
0 项奖励
回复

3,474 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by david35 on Wed Feb 27 02:31:57 MST 2013
Thank you for your answer. this is what I imagine. Are Redlib source code available? Where can I find it?
0 项奖励
回复

3,474 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Tue Feb 26 09:39:30 MST 2013
If you want to use that option EVERY object and library that you link with must also have been built with that option. This includes any 'system' libraries that you may be using, such as redlib/newlib etc.

I don't know if there is a way to suppress the warning - it really is not one that should be suppressed anyway.
0 项奖励
回复