aakash-sahai / nanopb

Automatically exported from code.google.com/p/nanopb
zlib License
0 stars 0 forks source link

packed structs with MSVC / IAR format #66

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I suggest adding support also for MSVC / IAR compiler way of marking packed 
structs:

http://msdn.microsoft.com/en-us/library/2e70t5y1.aspx

This requires a #pragma pack(1) before struct and #pragma pack() after the 
struct definition.

Original issue reported on code.google.com by jarmo.to...@gmail.com on 13 Mar 2013 at 11:50

GoogleCodeExporter commented 9 years ago
Can you check if IAR compiler supports the __pragma instead of #pragma? This 
would make it easier to #define it. For example, try this code:

__pragma(pack(push, 1))
struct foobar {
    char foo;
    int bar;
}
__pragma(pack(pop));

Original comment by Petteri.Aimonen on 13 Mar 2013 at 12:13

GoogleCodeExporter commented 9 years ago
IAR seems to support following format:

_Pragma("pack(push, 1)")
_Pragma("pack(pop)")

but not __pragma(pack(push, 1)).

Use of IAR compiler can be checked with Preprocessor define __ICCARM__

Original comment by jarmo.to...@gmail.com on 13 Mar 2013 at 12:52

GoogleCodeExporter commented 9 years ago
This issue was updated by revision 1396dce2aeea.

Original comment by Petteri.Aimonen on 13 Mar 2013 at 1:23

GoogleCodeExporter commented 9 years ago
Fix released in 0.2.1

Original comment by Petteri.Aimonen on 14 Apr 2013 at 7:19