Fixed windows build after lpp merge.
authorMichael Beck <mm.beck@gmx.net>
Sat, 25 Jun 2011 15:52:30 +0000 (17:52 +0200)
committerMichael Beck <mm.beck@gmx.net>
Sat, 25 Jun 2011 16:16:53 +0000 (18:16 +0200)
ir/adt/compiler.h
ir/lpp/lpp_comm.c
ir/lpp/lpp_comm.h

index 115b710..846d5d7 100644 (file)
 #ifndef FIRM_COMPILER_H
 #define FIRM_COMPILER_H
 
-/**
- * Asserts that the constant expression x is not zero at compiletime. name has
- * to be a unique identifier.
- *
- * @note This uses the fact, that double case labels are not allowed.
- */
-#define COMPILETIME_ASSERT(x, name) \
-    static __attribute__((unused)) void compiletime_assert_##name (int h) { \
-        switch(h) { case 0: case (x): {} } \
-    }
-
 #ifdef __GNUC__
 /**
  * Indicates to the compiler that the value of x is very likely 1
  */
 #define PURE        __attribute__((const))
 
+/**
+ * Tell the compiler, that a function is unused, no warning needed.
+ */
+#define UNUSED      __attribute__((unused))
+
 #else
 #define LIKELY(x)   x
 #define UNLIKELY(x) x
 #define PURE
+#define UNUSED
 #endif
 
+/**
+ * Asserts that the constant expression x is not zero at compiletime. name has
+ * to be a unique identifier.
+ *
+ * @note This uses the fact, that double case labels are not allowed.
+ */
+#define COMPILETIME_ASSERT(x, name) \
+    static UNUSED void compiletime_assert_##name (int h) { \
+        switch(h) { case 0: case (x): {} } \
+    }
+
 #endif
index 21ce281..63d344c 100644 (file)
@@ -8,7 +8,6 @@
  * Copyright (C) 2005 Universitaet Karlsruhe
  * Released under the GPL
  */
-
 #include <stdlib.h>
 #include <string.h>
 #include <assert.h>
@@ -18,9 +17,6 @@
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #include <winsock2.h>
-
-#define vsnprintf _vsnprintf
-
 #else
 #include <unistd.h>
 #include <sys/types.h>
@@ -28,6 +24,8 @@
 #include <arpa/inet.h>
 #endif
 
+#include "config.h"
+
 #include "irtools.h"
 #include "debug.h"
 
@@ -62,18 +60,18 @@ static inline firm_dbg_module_t *get_dbg_module(void)
  * Try to read some bytes but block until a certain amount is read.
  * @param fd The file descriptor.
  * @param buf The buffer to read into.
- * @param try The amount of bytes to try to read.
+ * @param try_amount The amount of bytes to try to read.
  * @param at_least block until this many bytes are read.
  * @return The number of bytes read or -1 on error.
  */
-static ssize_t secure_recv(int fd, void *buf, size_t try, size_t at_least)
+static ssize_t secure_recv(int fd, void *buf, size_t try_amount, size_t at_least)
 {
        ssize_t res;
        size_t bytes_read = 0;
        char *data = buf;
 
        do {
-               res = recv(fd, &data[bytes_read], try - bytes_read, 0);
+               res = recv(fd, &data[bytes_read], try_amount - bytes_read, 0);
                if(res <= 0) {
                        if(res == 0 || errno != EAGAIN)
                                return -1;
index 4c425d7..642cd0c 100644 (file)
 #include <stdarg.h>
 #include <stdint.h>
 
+#ifdef _WIN32
+#include <BaseTsd.h>
+typedef SSIZE_T ssize_t;
+#endif
+
 #define LPP_PORT    2175
 #define LPP_BUFSIZE (1 << 20)