diff -Naur lwip_patch_cpp_headers/src/api/api_lib.c lwip_patch_warnings/src/api/api_lib.c
--- lwip_patch_cpp_headers/src/api/api_lib.c	2006-10-10 08:16:17.493102000 +0200
+++ lwip_patch_warnings/src/api/api_lib.c	2006-10-10 08:59:28.208790000 +0200
@@ -489,7 +489,7 @@
     return NULL;
   }
   
-  sys_mbox_fetch(conn->acceptmbox, (void **)&newconn);
+  sys_mbox_fetch(conn->acceptmbox, (void *)&newconn);
   /* Register event with callback */
   if (conn->callback)
       (*conn->callback)(conn, NETCONN_EVT_RCVMINUS, 0);
@@ -532,7 +532,7 @@
       return NULL;
     }
     
-    sys_mbox_fetch(conn->recvmbox, (void **)&p);
+    sys_mbox_fetch(conn->recvmbox, (void *)&p);
 
     if (p != NULL)
     {
@@ -577,7 +577,7 @@
     sys_mbox_fetch(conn->mbox, NULL);
     memp_free(MEMP_API_MSG, msg);
   } else {
-    sys_mbox_fetch(conn->recvmbox, (void **)&buf);
+    sys_mbox_fetch(conn->recvmbox, (void *)&buf);
   conn->recv_avail -= buf->p->tot_len;
     /* Register event with callback */
     if (conn->callback)
diff -Naur lwip_patch_cpp_headers/src/api/sockets.c lwip_patch_warnings/src/api/sockets.c
--- lwip_patch_cpp_headers/src/api/sockets.c	2006-10-10 08:16:17.538057000 +0200
+++ lwip_patch_warnings/src/api/sockets.c	2006-10-10 08:59:28.221777000 +0200
@@ -91,7 +91,7 @@
   (sizeof(err_to_errno_table)/sizeof(err_to_errno_table[0]))
 
 #define err_to_errno(err) \
-  (-(err) >= 0 && -(err) < ERR_TO_ERRNO_TABLE_SIZE ? \
+  (-((signed)err) >= 0 && -((signed)err) < (signed)ERR_TO_ERRNO_TABLE_SIZE ? \
     err_to_errno_table[-(err)] : EIO)
 
 #ifdef ERRNO
diff -Naur lwip_patch_cpp_headers/src/core/ipv4/ip.c lwip_patch_warnings/src/core/ipv4/ip.c
--- lwip_patch_cpp_headers/src/core/ipv4/ip.c	2006-10-10 08:16:17.674920000 +0200
+++ lwip_patch_warnings/src/core/ipv4/ip.c	2006-10-10 09:23:28.466822000 +0200
@@ -304,7 +304,7 @@
     IP_STATS_INC(ip.opterr);
     IP_STATS_INC(ip.drop);
     /* unsupported protocol feature */
-    snmp_inc_ipunknownprotos();
+    snmp_inc_ipinunknownprotos();
     return ERR_OK;
 #endif /* IP_REASSEMBLY */
   }
@@ -316,7 +316,7 @@
     IP_STATS_INC(ip.opterr);
     IP_STATS_INC(ip.drop);
     /* unsupported protocol feature */
-    snmp_inc_ipunknownprotos();
+    snmp_inc_ipinunknownprotos();
     return ERR_OK;
   }
 #endif /* IP_OPTIONS == 0 */
diff -Naur lwip_patch_cpp_headers/src/core/ipv4/ip_frag.c lwip_patch_warnings/src/core/ipv4/ip_frag.c
--- lwip_patch_cpp_headers/src/core/ipv4/ip_frag.c	2006-10-10 08:16:17.699892000 +0200
+++ lwip_patch_warnings/src/core/ipv4/ip_frag.c	2006-10-10 09:23:28.477810000 +0200
@@ -229,7 +229,7 @@
       /* Check all bytes up to and including all but the last byte in
          the bitmap. */
       LWIP_ASSERT("ip_reasslen / (8 * 8) - 1 < sizeof(ip_reassbitmap)",
-                   ip_reasslen / (8 * 8) - 1 < sizeof(ip_reassbitmap));
+                   ip_reasslen / (8 * 8) - 1 < (signed)sizeof(ip_reassbitmap));
       for (i = 0; i < ip_reasslen / (8 * 8) - 1; ++i) {
         if (ip_reassbitmap[i] != 0xff) {
           LWIP_DEBUGF(IP_REASS_DEBUG,
diff -Naur lwip_patch_cpp_headers/src/core/mem.c lwip_patch_warnings/src/core/mem.c
--- lwip_patch_cpp_headers/src/core/mem.c	2006-10-10 08:16:17.937657000 +0200
+++ lwip_patch_warnings/src/core/mem.c	2006-10-10 09:23:28.503785000 +0200
@@ -91,23 +91,23 @@
   /* plug hole forward */
   LWIP_ASSERT("plug_holes: mem->next <= MEM_SIZE", mem->next <= MEM_SIZE);
   
-  nmem = (struct mem *)&ram[mem->next];
+  nmem = (struct mem *)MEM_ALIGN(&ram[mem->next]);
   if (mem != nmem && nmem->used == 0 && (u8_t *)nmem != (u8_t *)ram_end) {
     if (lfree == nmem) {
       lfree = mem;
     }
     mem->next = nmem->next;
-    ((struct mem *)&ram[nmem->next])->prev = (u8_t *)mem - ram;
+    ((struct mem *)MEM_ALIGN(&ram[nmem->next]))->prev = (u8_t *)mem - ram;
   }
 
   /* plug hole backward */
-  pmem = (struct mem *)&ram[mem->prev];
+  pmem = (struct mem *)MEM_ALIGN(&ram[mem->prev]);
   if (pmem != mem && pmem->used == 0) {
     if (lfree == mem) {
       lfree = pmem;
     }
     pmem->next = mem->next;
-    ((struct mem *)&ram[mem->next])->prev = (u8_t *)pmem - ram;
+    ((struct mem *)MEM_ALIGN(&ram[mem->next]))->prev = (u8_t *)pmem - ram;
   }
 }
 
@@ -117,18 +117,18 @@
   struct mem *mem;
 
   memset(ram, 0, MEM_SIZE);
-  mem = (struct mem *)ram;
+  mem = (struct mem *)MEM_ALIGN(ram);
   mem->next = MEM_SIZE;
   mem->prev = 0;
   mem->used = 0;
-  ram_end = (struct mem *)&ram[MEM_SIZE];
+  ram_end = (struct mem *)MEM_ALIGN(&ram[MEM_SIZE]);
   ram_end->used = 1;
   ram_end->next = MEM_SIZE;
   ram_end->prev = MEM_SIZE;
 
   mem_sem = sys_sem_new(1);
 
-  lfree = (struct mem *)ram;
+  lfree = (struct mem *)MEM_ALIGN(ram);
 
 #if MEM_STATS
   lwip_stats.mem.avail = MEM_SIZE;
@@ -158,7 +158,7 @@
     sys_sem_signal(mem_sem);
     return;
   }
-  mem = (struct mem *)((u8_t *)rmem - SIZEOF_STRUCT_MEM);
+  mem = (struct mem *)MEM_ALIGN((u8_t *)rmem - SIZEOF_STRUCT_MEM);
 
   LWIP_ASSERT("mem_free: mem->used", mem->used);
   
@@ -202,7 +202,7 @@
     LWIP_DEBUGF(MEM_DEBUG | 3, ("mem_realloc: illegal memory\n"));
     return rmem;
   }
-  mem = (struct mem *)((u8_t *)rmem - SIZEOF_STRUCT_MEM);
+  mem = (struct mem *)MEM_ALIGN((u8_t *)rmem - SIZEOF_STRUCT_MEM);
 
   ptr = (u8_t *)mem - ram;
 
@@ -211,15 +211,15 @@
   lwip_stats.mem.used -= (size - newsize);
 #endif /* MEM_STATS */
   
-  if (newsize + SIZEOF_STRUCT_MEM + MIN_SIZE < size) {
+  if ((mem_size_t)(newsize + SIZEOF_STRUCT_MEM + MIN_SIZE) < size) {
     ptr2 = ptr + SIZEOF_STRUCT_MEM + newsize;
-    mem2 = (struct mem *)&ram[ptr2];
+    mem2 = (struct mem *)MEM_ALIGN(&ram[ptr2]);
     mem2->used = 0;
     mem2->next = mem->next;
     mem2->prev = ptr;
     mem->next = ptr2;
     if (mem2->next != MEM_SIZE) {
-      ((struct mem *)&ram[mem2->next])->prev = ptr2;
+      ((struct mem *)MEM_ALIGN(&ram[mem2->next]))->prev = ptr2;
     }
 
     plug_holes(mem2);
@@ -250,18 +250,18 @@
   
   sys_sem_wait(mem_sem);
 
-  for (ptr = (u8_t *)lfree - ram; ptr < MEM_SIZE; ptr = ((struct mem *)&ram[ptr])->next) {
-    mem = (struct mem *)&ram[ptr];
+  for (ptr = (u8_t *)lfree - ram; ptr < MEM_SIZE; ptr = ((struct mem *)MEM_ALIGN(&ram[ptr]))->next) {
+    mem = (struct mem *)MEM_ALIGN(&ram[ptr]);
     if (!mem->used &&
        mem->next - (ptr + SIZEOF_STRUCT_MEM) >= size + SIZEOF_STRUCT_MEM) {
       ptr2 = ptr + SIZEOF_STRUCT_MEM + size;
-      mem2 = (struct mem *)&ram[ptr2];
+      mem2 = (struct mem *)MEM_ALIGN(&ram[ptr2]);
 
       mem2->prev = ptr;      
       mem2->next = mem->next;
       mem->next = ptr2;      
       if (mem2->next != MEM_SIZE) {
-        ((struct mem *)&ram[mem2->next])->prev = ptr2;
+        ((struct mem *)MEM_ALIGN(&ram[mem2->next]))->prev = ptr2;
       }
       
       mem2->used = 0;      
@@ -279,7 +279,7 @@
       if (mem == lfree) {
         /* Find next free block after mem */
         while (lfree->used && lfree != ram_end) {
-          lfree = (struct mem *)&ram[lfree->next];
+          lfree = (struct mem *)MEM_ALIGN(&ram[lfree->next]);
         }
         LWIP_ASSERT("mem_malloc: !lfree->used", !lfree->used);
       }
diff -Naur lwip_patch_cpp_headers/src/core/memp.c lwip_patch_warnings/src/core/memp.c
--- lwip_patch_cpp_headers/src/core/memp.c	2006-10-10 08:16:17.956635000 +0200
+++ lwip_patch_warnings/src/core/memp.c	2006-10-10 09:23:28.527763000 +0200
@@ -64,7 +64,7 @@
   MEM_ALIGN_SIZE(sizeof(struct netconn)),
   MEM_ALIGN_SIZE(sizeof(struct api_msg)),
   MEM_ALIGN_SIZE(sizeof(struct tcpip_msg)),
-  MEM_ALIGN_SIZE(sizeof(struct sys_timeout))
+  MEM_ALIGN_SIZE(sizeof(struct _sys_timeout))
 };
 
 static const u16_t memp_num[MEMP_MAX] = {
@@ -95,7 +95,7 @@
   MEMP_TYPE_SIZE(MEMP_NUM_NETCONN, struct netconn) +
   MEMP_TYPE_SIZE(MEMP_NUM_API_MSG, struct api_msg) +
   MEMP_TYPE_SIZE(MEMP_NUM_TCPIP_MSG, struct tcpip_msg) +
-  MEMP_TYPE_SIZE(MEMP_NUM_SYS_TIMEOUT, struct sys_timeout)];
+  MEMP_TYPE_SIZE(MEMP_NUM_SYS_TIMEOUT, struct _sys_timeout)];
 
 #if !SYS_LIGHTWEIGHT_PROT
 static sys_sem_t mutex;
@@ -142,7 +142,7 @@
     for (j = 0; j < memp_num[i]; ++j) {
       memp->next = memp_tab[i];
       memp_tab[i] = memp;
-      memp = (struct memp *)((u8_t *)memp + MEMP_SIZE + memp_sizes[i]);
+      memp = (struct memp *)MEM_ALIGN((u8_t *)memp + MEMP_SIZE + memp_sizes[i]);
     }
   }
 
@@ -211,7 +211,7 @@
     return;
   }
 
-  memp = (struct memp *)((u8_t *)mem - MEMP_SIZE);
+  memp = (struct memp *)MEM_ALIGN((u8_t *)mem - MEMP_SIZE);
 
 #if SYS_LIGHTWEIGHT_PROT
   SYS_ARCH_PROTECT(old_level);
diff -Naur lwip_patch_cpp_headers/src/core/pbuf.c lwip_patch_warnings/src/core/pbuf.c
--- lwip_patch_cpp_headers/src/core/pbuf.c	2006-10-10 08:16:17.995597000 +0200
+++ lwip_patch_warnings/src/core/pbuf.c	2006-10-10 09:52:28.887659000 +0200
@@ -108,9 +108,9 @@
 
   /* Set up ->next pointers to link the pbufs of the pool together */
   p = pbuf_pool;
-
+  
   for(i = 0; i < PBUF_POOL_SIZE; ++i) {
-    p->next = (struct pbuf *)((u8_t *)p + PBUF_POOL_BUFSIZE + sizeof(struct pbuf));
+    p->next = (struct pbuf *)MEM_ALIGN((u8_t *)p + MEM_ALIGN_SIZE(PBUF_POOL_BUFSIZE + sizeof(struct pbuf)));
     p->len = p->tot_len = PBUF_POOL_BUFSIZE;
     p->payload = MEM_ALIGN((void *)((u8_t *)p + sizeof(struct pbuf)));
     p->flags = PBUF_FLAG_POOL;
diff -Naur lwip_patch_cpp_headers/src/core/stats.c lwip_patch_warnings/src/core/stats.c
--- lwip_patch_cpp_headers/src/core/stats.c	2006-10-10 08:16:18.009585000 +0200
+++ lwip_patch_warnings/src/core/stats.c	2006-10-10 09:23:28.580708000 +0200
@@ -84,10 +84,10 @@
 stats_display_mem(struct stats_mem *mem, char *name)
 {
   LWIP_PLATFORM_DIAG(("\n MEM %s\n\t", name));
-  LWIP_PLATFORM_DIAG(("avail: %"S16_F"\n\t", mem->avail)); 
-  LWIP_PLATFORM_DIAG(("used: %"S16_F"\n\t", mem->used)); 
-  LWIP_PLATFORM_DIAG(("max: %"S16_F"\n\t", mem->max)); 
-  LWIP_PLATFORM_DIAG(("err: %"S16_F"\n", mem->err));
+  LWIP_PLATFORM_DIAG(("avail: %"MEM_SIZE_F"\n\t", mem->avail)); 
+  LWIP_PLATFORM_DIAG(("used: %"MEM_SIZE_F"\n\t", mem->used)); 
+  LWIP_PLATFORM_DIAG(("max: %"MEM_SIZE_F"\n\t", mem->max)); 
+  LWIP_PLATFORM_DIAG(("err: %"MEM_SIZE_F"\n", mem->err));
   
 }
 
diff -Naur lwip_patch_cpp_headers/src/core/sys.c lwip_patch_warnings/src/core/sys.c
--- lwip_patch_cpp_headers/src/core/sys.c	2006-10-10 08:16:18.026567000 +0200
+++ lwip_patch_warnings/src/core/sys.c	2006-10-10 09:23:28.606682000 +0200
@@ -50,7 +50,7 @@
 {
   u32_t time;
   struct sys_timeouts *timeouts;
-  struct sys_timeout *tmptimeout;
+  struct _sys_timeout *tmptimeout;
   sys_timeout_handler h;
   void *arg;
 
@@ -102,7 +102,7 @@
 {
   u32_t time;
   struct sys_timeouts *timeouts;
-  struct sys_timeout *tmptimeout;
+  struct _sys_timeout *tmptimeout;
   sys_timeout_handler h;
   void *arg;
 
@@ -157,7 +157,7 @@
 sys_timeout(u32_t msecs, sys_timeout_handler h, void *arg)
 {
   struct sys_timeouts *timeouts;
-  struct sys_timeout *timeout, *t;
+  struct _sys_timeout *timeout, *t;
 
   timeout = memp_malloc(MEMP_SYS_TIMEOUT);
   if (timeout == NULL) {
@@ -208,7 +208,7 @@
 sys_untimeout(sys_timeout_handler h, void *arg)
 {
     struct sys_timeouts *timeouts;
-    struct sys_timeout *prev_t, *t;
+    struct _sys_timeout *prev_t, *t;
 
     timeouts = sys_arch_timeouts();
 
diff -Naur lwip_patch_cpp_headers/src/core/tcp.c lwip_patch_warnings/src/core/tcp.c
--- lwip_patch_cpp_headers/src/core/tcp.c	2006-10-10 08:16:18.047547000 +0200
+++ lwip_patch_warnings/src/core/tcp.c	2006-10-10 09:23:28.639649000 +0200
@@ -168,6 +168,11 @@
       pcb->state = LAST_ACK;
     }
     break;
+  case FIN_WAIT_1: // fall through
+  case FIN_WAIT_2: // fall through
+  case CLOSING: // fall through
+  case LAST_ACK: // fall through
+  case TIME_WAIT: // fall through
   default:
     /* Has already been closed, do nothing. */
     err = ERR_OK;
diff -Naur lwip_patch_cpp_headers/src/core/tcp_in.c lwip_patch_warnings/src/core/tcp_in.c
--- lwip_patch_cpp_headers/src/core/tcp_in.c	2006-10-10 08:16:18.075516000 +0200
+++ lwip_patch_warnings/src/core/tcp_in.c	2006-10-10 09:23:28.674613000 +0200
@@ -603,6 +603,9 @@
       recv_flags = TF_CLOSED;
     }
     break;
+  case CLOSED: // fall through
+  case LISTEN: // fall through
+  case TIME_WAIT: // fall through
   default:
     break;
   }
diff -Naur lwip_patch_cpp_headers/src/include/lwip/sys.h lwip_patch_warnings/src/include/lwip/sys.h
--- lwip_patch_cpp_headers/src/include/lwip/sys.h	2006-10-10 08:22:28.406815000 +0200
+++ lwip_patch_warnings/src/include/lwip/sys.h	2006-10-10 09:24:34.642580000 +0200
@@ -47,7 +47,7 @@
    definitions of the sys_ functions. */
 typedef u8_t sys_sem_t;
 typedef u8_t sys_mbox_t;
-struct sys_timeout {u8_t dummy;};
+struct _sys_timeout {u8_t dummy;};
 
 #define sys_init()
 #define sys_timeout(m,h,a)
@@ -72,15 +72,15 @@
 
 typedef void (* sys_timeout_handler)(void *arg);
 
-struct sys_timeout {
-  struct sys_timeout *next;
+struct _sys_timeout {
+  struct _sys_timeout *next;
   u32_t time;
   sys_timeout_handler h;
   void *arg;
 };
 
 struct sys_timeouts {
-  struct sys_timeout *next;
+  struct _sys_timeout *next;
 };
 
 /* sys_init() must be called before anthing else. */
diff -Naur lwip_patch_cpp_headers/src/include/lwip/tcp.h lwip_patch_warnings/src/include/lwip/tcp.h
--- lwip_patch_cpp_headers/src/include/lwip/tcp.h	2006-10-10 09:31:11.577249000 +0200
+++ lwip_patch_warnings/src/include/lwip/tcp.h	2006-10-10 08:29:23.615191000 +0200
@@ -154,7 +154,7 @@
 #define TCP_FIN_WAIT_TIMEOUT 20000 /* milliseconds */
 #define TCP_SYN_RCVD_TIMEOUT 20000 /* milliseconds */
 
-#define TCP_OOSEQ_TIMEOUT        6 /* x RTO */
+#define TCP_OOSEQ_TIMEOUT        6U /* x RTO */
 
 #define TCP_MSL 60000  /* The maximum segment lifetime in microseconds */
 
diff -Naur lwip_patch_cpp_headers/src/netif/etharp.c lwip_patch_warnings/src/netif/etharp.c
--- lwip_patch_cpp_headers/src/netif/etharp.c	2006-10-10 08:16:19.288304000 +0200
+++ lwip_patch_warnings/src/netif/etharp.c	2006-10-10 09:01:22.987631000 +0200
@@ -44,6 +44,8 @@
  *
  */
 
+#include <string.h>
+
 #include "lwip/opt.h"
 #include "lwip/inet.h"
 #include "netif/etharp.h"
@@ -366,7 +368,8 @@
 static err_t
 update_arp_entry(struct netif *netif, struct ip_addr *ipaddr, struct eth_addr *ethaddr, u8_t flags)
 {
-  s8_t i, k;
+  int i; /* ARP entry index */
+  u8_t k; /* Ethernet address octet index */
   LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE | 3, ("update_arp_entry()\n"));
   LWIP_ASSERT("netif->hwaddr_len != 0", netif->hwaddr_len != 0);
   LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("update_arp_entry: %"U16_F".%"U16_F".%"U16_F".%"U16_F" - %02"X16_F":%02"X16_F":%02"X16_F":%02"X16_F":%02"X16_F":%02"X16_F"\n",
@@ -445,7 +448,7 @@
 etharp_find_addr(struct netif *netif, struct ip_addr *ipaddr,
          struct eth_addr **eth_ret, struct ip_addr **ip_ret)
 {
-  s8_t i;
+  int i;
 
   i = 0;
   while (i < ARP_TABLE_SIZE)
@@ -747,7 +750,7 @@
 {
   struct eth_addr * srcaddr = (struct eth_addr *)netif->hwaddr;
   err_t result = ERR_MEM;
-  s8_t i; /* ARP entry index */
+  int i; /* ARP entry index */
   u8_t k; /* Ethernet address octet index */
 
   /* non-unicast address? */
