lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] [PATCH 6/7] lwip: fix warning: 'packed' attribute ignored


From: address@hidden
Subject: [lwip-users] [PATCH 6/7] lwip: fix warning: 'packed' attribute ignored
Date: Fri, 21 Sep 2007 02:29:09 +0000

lwip: fix warning: 'packed' attribute ignored
packing is not required for byte and struct members. gcc 4.x warns if this
is specified.
---
 user/e7/comms/lwip/include/ipv4/lwip/ip.h |    4 ++--
 user/e7/comms/lwip/include/lwip/arch.h    |    4 ++++
 user/e7/comms/lwip/include/lwip/dhcp.h    |   24 ++++++++++++------------
 user/e7/comms/lwip/include/netif/etharp.h |   22 +++++++++++-----------
 user/e7/comms/lwip/include/netif/ppp_oe.h |    4 ++--
 5 files changed, 31 insertions(+), 27 deletions(-)

diff --git a/user/e7/comms/lwip/include/ipv4/lwip/ip.h 
b/user/e7/comms/lwip/include/ipv4/lwip/ip.h
index e61ac31..14453e8 100644
--- a/user/e7/comms/lwip/include/ipv4/lwip/ip.h
+++ b/user/e7/comms/lwip/include/ipv4/lwip/ip.h
@@ -132,8 +132,8 @@ struct ip_hdr {
   /* checksum */
   PACK_STRUCT_FIELD(u16_t _chksum);
   /* source and destination IP addresses */
-  PACK_STRUCT_FIELD(struct ip_addr src);
-  PACK_STRUCT_FIELD(struct ip_addr dest); 
+  NOPACK_STRUCT_FIELD(struct ip_addr src);
+  NOPACK_STRUCT_FIELD(struct ip_addr dest);
 } PACK_STRUCT_STRUCT;
 PACK_STRUCT_END
 #ifdef PACK_STRUCT_USE_INCLUDES
diff --git a/user/e7/comms/lwip/include/lwip/arch.h 
b/user/e7/comms/lwip/include/lwip/arch.h
index 7d1400b..62ee09e 100644
--- a/user/e7/comms/lwip/include/lwip/arch.h
+++ b/user/e7/comms/lwip/include/lwip/arch.h
@@ -58,6 +58,10 @@ extern "C" {
 #define PACK_STRUCT_FIELD(x) x
 #endif /* PACK_STRUCT_FIELD */
 
+/* byte and struct members of structs don't need packing, specifying
+   packing results in warnings with gcc 4.x. Use this macro so all
+   struct members are qualified */
+#define NOPACK_STRUCT_FIELD(x) x
 
 #ifndef LWIP_UNUSED_ARG
 #define LWIP_UNUSED_ARG(x) (void)x
diff --git a/user/e7/comms/lwip/include/lwip/dhcp.h 
b/user/e7/comms/lwip/include/lwip/dhcp.h
index 6f9f208..eb802bb 100644
--- a/user/e7/comms/lwip/include/lwip/dhcp.h
+++ b/user/e7/comms/lwip/include/lwip/dhcp.h
@@ -77,23 +77,23 @@ PACK_STRUCT_BEGIN
 /** minimum set of fields of any DHCP message */
 struct dhcp_msg
 {
-  PACK_STRUCT_FIELD(u8_t op);
-  PACK_STRUCT_FIELD(u8_t htype);
-  PACK_STRUCT_FIELD(u8_t hlen);
-  PACK_STRUCT_FIELD(u8_t hops);
+  NOPACK_STRUCT_FIELD(u8_t op);
+  NOPACK_STRUCT_FIELD(u8_t htype);
+  NOPACK_STRUCT_FIELD(u8_t hlen);
+  NOPACK_STRUCT_FIELD(u8_t hops);
   PACK_STRUCT_FIELD(u32_t xid);
   PACK_STRUCT_FIELD(u16_t secs);
   PACK_STRUCT_FIELD(u16_t flags);
-  PACK_STRUCT_FIELD(struct ip_addr ciaddr);
-  PACK_STRUCT_FIELD(struct ip_addr yiaddr);
-  PACK_STRUCT_FIELD(struct ip_addr siaddr);
-  PACK_STRUCT_FIELD(struct ip_addr giaddr);
+  NOPACK_STRUCT_FIELD(struct ip_addr ciaddr);
+  NOPACK_STRUCT_FIELD(struct ip_addr yiaddr);
+  NOPACK_STRUCT_FIELD(struct ip_addr siaddr);
+  NOPACK_STRUCT_FIELD(struct ip_addr giaddr);
 #define DHCP_CHADDR_LEN 16U
-  PACK_STRUCT_FIELD(u8_t chaddr[DHCP_CHADDR_LEN]);
+  NOPACK_STRUCT_FIELD(u8_t chaddr[DHCP_CHADDR_LEN]);
 #define DHCP_SNAME_LEN 64U
-  PACK_STRUCT_FIELD(u8_t sname[DHCP_SNAME_LEN]);
+  NOPACK_STRUCT_FIELD(u8_t sname[DHCP_SNAME_LEN]);
 #define DHCP_FILE_LEN 128U
-  PACK_STRUCT_FIELD(u8_t file[DHCP_FILE_LEN]);
+  NOPACK_STRUCT_FIELD(u8_t file[DHCP_FILE_LEN]);
   PACK_STRUCT_FIELD(u32_t cookie);
 #define DHCP_MIN_OPTIONS_LEN 68U
 /** make sure user does not configure this too small */
@@ -105,7 +105,7 @@ struct dhcp_msg
 /** set this to be sufficient for your options in outgoing DHCP msgs */
 #  define DHCP_OPTIONS_LEN DHCP_MIN_OPTIONS_LEN
 #endif
-  PACK_STRUCT_FIELD(u8_t options[DHCP_OPTIONS_LEN]);
+  NOPACK_STRUCT_FIELD(u8_t options[DHCP_OPTIONS_LEN]);
 } PACK_STRUCT_STRUCT;
 PACK_STRUCT_END
 #ifdef PACK_STRUCT_USE_INCLUDES
diff --git a/user/e7/comms/lwip/include/netif/etharp.h 
b/user/e7/comms/lwip/include/netif/etharp.h
index dfe4401..a1e3f3b 100644
--- a/user/e7/comms/lwip/include/netif/etharp.h
+++ b/user/e7/comms/lwip/include/netif/etharp.h
@@ -61,7 +61,7 @@ extern "C" {
 #endif
 PACK_STRUCT_BEGIN
 struct eth_addr {
-  PACK_STRUCT_FIELD(u8_t addr[ETHARP_HWADDR_LEN]);
+  NOPACK_STRUCT_FIELD(u8_t addr[ETHARP_HWADDR_LEN]);
 } PACK_STRUCT_STRUCT;
 PACK_STRUCT_END
 #ifdef PACK_STRUCT_USE_INCLUDES
@@ -74,10 +74,10 @@ PACK_STRUCT_END
 PACK_STRUCT_BEGIN
 struct eth_hdr {
 #if ETH_PAD_SIZE
-  PACK_STRUCT_FIELD(u8_t padding[ETH_PAD_SIZE]);
+  NOPACK_STRUCT_FIELD(u8_t padding[ETH_PAD_SIZE]);
 #endif
-  PACK_STRUCT_FIELD(struct eth_addr dest);
-  PACK_STRUCT_FIELD(struct eth_addr src);
+  NOPACK_STRUCT_FIELD(struct eth_addr dest);
+  NOPACK_STRUCT_FIELD(struct eth_addr src);
   PACK_STRUCT_FIELD(u16_t type);
 } PACK_STRUCT_STRUCT;
 PACK_STRUCT_END
@@ -91,15 +91,15 @@ PACK_STRUCT_END
 PACK_STRUCT_BEGIN
 /** the ARP message */
 struct etharp_hdr {
-  PACK_STRUCT_FIELD(struct eth_hdr ethhdr);
+  NOPACK_STRUCT_FIELD(struct eth_hdr ethhdr);
   PACK_STRUCT_FIELD(u16_t hwtype);
   PACK_STRUCT_FIELD(u16_t proto);
   PACK_STRUCT_FIELD(u16_t _hwlen_protolen);
   PACK_STRUCT_FIELD(u16_t opcode);
-  PACK_STRUCT_FIELD(struct eth_addr shwaddr);
-  PACK_STRUCT_FIELD(struct ip_addr2 sipaddr);
-  PACK_STRUCT_FIELD(struct eth_addr dhwaddr);
-  PACK_STRUCT_FIELD(struct ip_addr2 dipaddr);
+  NOPACK_STRUCT_FIELD(struct eth_addr shwaddr);
+  NOPACK_STRUCT_FIELD(struct ip_addr2 sipaddr);
+  NOPACK_STRUCT_FIELD(struct eth_addr dhwaddr);
+  NOPACK_STRUCT_FIELD(struct ip_addr2 dipaddr);
 } PACK_STRUCT_STRUCT;
 PACK_STRUCT_END
 #ifdef PACK_STRUCT_USE_INCLUDES
@@ -111,8 +111,8 @@ PACK_STRUCT_END
 #endif
 PACK_STRUCT_BEGIN
 struct ethip_hdr {
-  PACK_STRUCT_FIELD(struct eth_hdr eth);
-  PACK_STRUCT_FIELD(struct ip_hdr ip);
+  NOPACK_STRUCT_FIELD(struct eth_hdr eth);
+  NOPACK_STRUCT_FIELD(struct ip_hdr ip);
 } PACK_STRUCT_STRUCT;
 PACK_STRUCT_END
 #ifdef PACK_STRUCT_USE_INCLUDES
diff --git a/user/e7/comms/lwip/include/netif/ppp_oe.h 
b/user/e7/comms/lwip/include/netif/ppp_oe.h
index 3aa55ae..2ecf267 100644
--- a/user/e7/comms/lwip/include/netif/ppp_oe.h
+++ b/user/e7/comms/lwip/include/netif/ppp_oe.h
@@ -79,8 +79,8 @@
 #endif
 PACK_STRUCT_BEGIN
 struct pppoehdr {
-       PACK_STRUCT_FIELD(u8_t vertype);
-       PACK_STRUCT_FIELD(u8_t code);
+       NOPACK_STRUCT_FIELD(u8_t vertype);
+       NOPACK_STRUCT_FIELD(u8_t code);
        PACK_STRUCT_FIELD(u16_t session);
        PACK_STRUCT_FIELD(u16_t plen);
 } PACK_STRUCT_STRUCT;
-- 
1.5.2.1







reply via email to

[Prev in Thread] Current Thread [Next in Thread]