Provide struct packing macros on GCC/clang out of the box

This commit is contained in:
Dirk Ziegelmeier 2016-12-29 09:28:28 +01:00
parent c1258e5c72
commit 3a8368ef04

View File

@ -209,54 +209,58 @@ extern "C" {
#endif
/** Packed structs support.
* Placed BEFORE declaration of a packed struct. \n
* For examples of packed struct declarations, see include/lwip/prot/ subfolder. \n
* Porting to GCC/clang: Nothing to do.
* Placed BEFORE declaration of a packed struct.\n
* For examples of packed struct declarations, see include/lwip/prot/ subfolder.\n
* A port to GCC/clang is included in lwIP, if you use these compilers there is nothing to do here.
*/
#ifndef PACK_STRUCT_BEGIN
#define PACK_STRUCT_BEGIN
#endif /* PACK_STRUCT_BEGIN */
/** Packed structs support.
* Placed AFTER declaration of a packed struct. \n
* For examples of packed struct declarations, see include/lwip/prot/ subfolder. \n
* Porting to GCC/clang: Nothing to do.
* Placed AFTER declaration of a packed struct.\n
* For examples of packed struct declarations, see include/lwip/prot/ subfolder.\n
* A port to GCC/clang is included in lwIP, if you use these compilers there is nothing to do here.
*/
#ifndef PACK_STRUCT_END
#define PACK_STRUCT_END
#endif /* PACK_STRUCT_END */
/** Packed structs support.
* Placed between end of declaration of a packed struct and trailing semicolon. \n
* For examples of packed struct declarations, see include/lwip/prot/ subfolder. \n
* Porting to GCC/clang: \#define PACK_STRUCT_STRUCT \_\_attribute\_\_((packed))
* Placed between end of declaration of a packed struct and trailing semicolon.\n
* For examples of packed struct declarations, see include/lwip/prot/ subfolder.\n
* A port to GCC/clang is included in lwIP, if you use these compilers there is nothing to do here.
*/
#ifndef PACK_STRUCT_STRUCT
#if defined(__GNUC__) || defined(__clang__)
#define PACK_STRUCT_STRUCT __attribute__((packed))
#else
#define PACK_STRUCT_STRUCT
#endif
#endif /* PACK_STRUCT_STRUCT */
/** Packed structs support.
* Wraps u32_t and u16_t members. \n
* For examples of packed struct declarations, see include/lwip/prot/ subfolder. \n
* Porting to GCC/clang: Nothing to do.
* Wraps u32_t and u16_t members.\n
* For examples of packed struct declarations, see include/lwip/prot/ subfolder.\n
* A port to GCC/clang is included in lwIP, if you use these compilers there is nothing to do here.
*/
#ifndef PACK_STRUCT_FIELD
#define PACK_STRUCT_FIELD(x) x
#endif /* PACK_STRUCT_FIELD */
/** Packed structs support.
* Wraps u8_t members, where some compilers warn that packing is not necessary. \n
* For examples of packed struct declarations, see include/lwip/prot/ subfolder. \n
* Porting to GCC/clang: Nothing to do.
* Wraps u8_t members, where some compilers warn that packing is not necessary.\n
* For examples of packed struct declarations, see include/lwip/prot/ subfolder.\n
* A port to GCC/clang is included in lwIP, if you use these compilers there is nothing to do here.
*/
#ifndef PACK_STRUCT_FLD_8
#define PACK_STRUCT_FLD_8(x) PACK_STRUCT_FIELD(x)
#endif /* PACK_STRUCT_FLD_8 */
/** Packed structs support.
* Wraps members that are packed structs themselves, where some compilers warn that packing is not necessary. \n
* For examples of packed struct declarations, see include/lwip/prot/ subfolder. \n
* Porting to GCC/clang: Nothing to do.
* Wraps members that are packed structs themselves, where some compilers warn that packing is not necessary.\n
* For examples of packed struct declarations, see include/lwip/prot/ subfolder.\n
* A port to GCC/clang is included in lwIP, if you use these compilers there is nothing to do here.
*/
#ifndef PACK_STRUCT_FLD_S
#define PACK_STRUCT_FLD_S(x) PACK_STRUCT_FIELD(x)