cancel
Showing results for 
Search instead for 
Did you mean: 

warning: ''__packed'' redefined [enabled by default]

jdcowpland
Associate II
Posted on June 09, 2015 at 10:00

I'm getting the following message from my compiler:

 warning: ''__packed'' redefined [enabled by default]

which is defined in the usb_conf.h file from the USB_OTG library, and in the cdefs.h file from the gcc. Any ideas how to get rid of the message?
1 REPLY 1
Posted on June 09, 2015 at 10:40

The root cause is that ST blatantly violates C99 7.1.3#1 (both ''All identifiers that begin with an underscore [...] are always reserved'' clauses) in all their libraries (and for that matter, ARM does the same in the CMSIS files it supplies). Here, they are partially innocent - the library had been apparently developed for the ARM compiler, and the redifinitions stem from attempt for a cheap porting.

The real solution is to manually rewrite all __packed in the whole library for a name allowed in user namespace, e.g. PACKED (making sure it's an unique name of course). This is something ST ought to do really, so if you are in position they listen to you (i.e. you represent the >1M buying power), please push them to do so for others' benefit.

The quick and dirty solution is to attempt to suppress the warning in command line, but as it's ''enabled by default'' it may be not a trivial undertaking - try to browse the warnings part of gcc documentation.

JW