setup_once.h cleanup and sync
authorYang Tse <yangsita@gmail.com>
Sun, 4 Sep 2011 15:09:36 +0000 (17:09 +0200)
committerYang Tse <yangsita@gmail.com>
Sun, 4 Sep 2011 15:09:36 +0000 (17:09 +0200)
config-win32.h
setup_once.h

index 48ce512..1245ba2 100644 (file)
 #define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1
 #endif
 
+/* ---------------------------------------------------------------- */
+/*                              Win CE                              */
+/* ---------------------------------------------------------------- */
+
+/* FIXME: A proper config-win32ce.h should be created to hold these */
+
+/*
+ *  System error codes for Windows CE
+ */
+
+#if defined(_WIN32_WCE) && !defined(HAVE_ERRNO_H)
+#  define ENOENT    ERROR_FILE_NOT_FOUND
+#  define ESRCH     ERROR_PATH_NOT_FOUND
+#  define ENOMEM    ERROR_NOT_ENOUGH_MEMORY
+#  define ENOSPC    ERROR_INVALID_PARAMETER
+#endif
 
 #endif /* HEADER_CARES_CONFIG_WIN32_H */
index a333f54..48cb9b2 100644 (file)
@@ -300,6 +300,27 @@ struct timeval {
 
 
 /*
+ * Macro WHILE_FALSE may be used to build single-iteration do-while loops,
+ * avoiding compiler warnings. Mostly intended for other macro definitions.
+ */
+
+#define WHILE_FALSE  while(0)
+
+#if defined(_MSC_VER) && !defined(__POCC__)
+#  undef WHILE_FALSE
+#  if (_MSC_VER < 1500)
+#    define WHILE_FALSE  while(1, 0)
+#  else
+#    define WHILE_FALSE \
+__pragma(warning(push)) \
+__pragma(warning(disable:4127)) \
+while(0) \
+__pragma(warning(pop))
+#  endif
+#endif
+
+
+/*
  * Typedef to 'int' if sig_atomic_t is not an available 'typedefed' type.
  */
 
@@ -336,7 +357,7 @@ typedef int sig_atomic_t;
 #ifdef DEBUGBUILD
 #define DEBUGF(x) x
 #else
-#define DEBUGF(x) do { } while (0)
+#define DEBUGF(x) do { } WHILE_FALSE
 #endif
 
 
@@ -347,7 +368,7 @@ typedef int sig_atomic_t;
 #if defined(DEBUGBUILD) && defined(HAVE_ASSERT_H)
 #define DEBUGASSERT(x) assert(x)
 #else
-#define DEBUGASSERT(x) do { } while (0)
+#define DEBUGASSERT(x) do { } WHILE_FALSE
 #endif
 
 
@@ -460,18 +481,6 @@ typedef int sig_atomic_t;
 
 
 /*
- *  System error codes for Windows CE
- */
-
-#if defined(WIN32) && !defined(HAVE_ERRNO_H)
-#define ENOENT       ERROR_FILE_NOT_FOUND
-#define ESRCH        ERROR_PATH_NOT_FOUND
-#define ENOMEM       ERROR_NOT_ENOUGH_MEMORY
-#define ENOSPC       ERROR_INVALID_PARAMETER
-#endif
-
-
-/*
  *  Actually use __32_getpwuid() on 64-bit VMS builds for getpwuid()
  */