lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] MingW patches


From: Gisle Vanem
Subject: [lwip-devel] MingW patches
Date: Thu, 29 Sep 2011 15:51:36 +0200

I did some small changes to make lwIP build with MingW.
Here they are:

First, I cleaned up cc.h a bit more than needed:

--- Git-latest\src\contrib\ports\win32\include\arch\cc.h Fri Sep 23 22:48:47 
2011
+++ src\contrib\ports\win32\include\arch\cc.h Thu Sep 29 15:43:50 2011
@@ -32,25 +32,11 @@
#ifndef __ARCH_CC_H__
#define __ARCH_CC_H__

-#if 1
-/* Include some files for defining library routines */
#include <stdio.h> /* printf, fflush, FILE */
#include <stdlib.h> /* abort */
-#else
-/* Declare fuction prototypes for assert/diag/error - leads to some warnings,
- * but good to test if no includes are missing. */
-int printf(const char *format, ...);
-void abort(void);
-struct _iobuf;
-typedef struct _iobuf FILE;
-int fflush(FILE *stream);
-#endif
-
-
-
-/** @todo fix some warnings: don't use #pragma if compiling with cygwin gcc */
-#ifndef __GNUC__
#include <limits.h>
+
+#ifdef _MSC_VER
#pragma warning (disable: 4244) /* disable conversion warning (implicit integer 
promotion!) */
#pragma warning (disable: 4127) /* conditional expression is constant */
#pragma warning (disable: 4996) /* 'strncpy' was declared deprecated */
@@ -78,12 +64,19 @@
/* Define (sn)printf formatters for these lwIP types */
#define X8_F  "02x"
#define U16_F "hu"
-#define S16_F "hd"
-#define X16_F "hx"
#define U32_F "lu"
#define S32_F "ld"
#define X32_F "lx"
-#define SZT_F U32_F
+
+#ifdef __GNUC__
+  #define S16_F "d"
+  #define X16_F "uX"
+  #define SZT_F "u"
+#else
+  #define S16_F "hd"
+  #define X16_F "hx"
+  #define SZT_F "lu"
+#endif

/* Compiler hints for packing structures */
#define PACK_STRUCT_STRUCT
@@ -99,8 +92,10 @@
  printf("Assertion \"%s\" failed at line %d in %s\n", message, __LINE__, 
__FILE__); \
  fflush(NULL);handler;} } while(0)

-/* C runtime functions redefined */
-#define snprintf _snprintf
+#ifdef _MSC_VER
+  /* C runtime functions redefined */
+  #define snprintf _snprintf
+#endif

u32_t dns_lookup_external_hosts_file(const char *name);

---------------------------------

And check\config.h:

--- Git-latest\src\contrib\ports\win32\check\config.h      Fri Sep 23 22:48:47 
2011
+++ src\contrib\ports\win32\check\config.h   Fri Sep 23 22:55:59 2011
@@ -1,5 +1,6 @@
-/* config.h for check-0.9.8 on win32 under MSVC */
+/* config.h for check-0.9.8 on win32 under MSVC/MingW */

+#if defined(_MSC_VER)
typedef unsigned int pid_t;
typedef unsigned int uint32_t;

@@ -15,6 +16,8 @@
/* disable some warnings */
#pragma warning (disable: 4090) /* const assigned to non-const */
#pragma warning (disable: 4996) /* fileno is deprecated */
+
+#endif  /* _MSC_VER */

#define LWIP_UNITTESTS_NOFORK

---------------------


--gv



reply via email to

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