From 57b6a519027f2fe175dc067c2b9ab29457b8af9b Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Sat, 25 Jun 2011 17:52:30 +0200 Subject: [PATCH] Fixed windows build after lpp merge. --- ir/adt/compiler.h | 28 +++++++++++++++++----------- ir/lpp/lpp_comm.c | 12 +++++------- ir/lpp/lpp_comm.h | 5 +++++ 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/ir/adt/compiler.h b/ir/adt/compiler.h index 115b710c8..846d5d797 100644 --- a/ir/adt/compiler.h +++ b/ir/adt/compiler.h @@ -27,17 +27,6 @@ #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 @@ -58,10 +47,27 @@ */ #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 diff --git a/ir/lpp/lpp_comm.c b/ir/lpp/lpp_comm.c index 21ce2815b..63d344c32 100644 --- a/ir/lpp/lpp_comm.c +++ b/ir/lpp/lpp_comm.c @@ -8,7 +8,6 @@ * Copyright (C) 2005 Universitaet Karlsruhe * Released under the GPL */ - #include #include #include @@ -18,9 +17,6 @@ #define WIN32_LEAN_AND_MEAN #include #include - -#define vsnprintf _vsnprintf - #else #include #include @@ -28,6 +24,8 @@ #include #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; diff --git a/ir/lpp/lpp_comm.h b/ir/lpp/lpp_comm.h index 4c425d7ad..642cd0c56 100644 --- a/ir/lpp/lpp_comm.h +++ b/ir/lpp/lpp_comm.h @@ -14,6 +14,11 @@ #include #include +#ifdef _WIN32 +#include +typedef SSIZE_T ssize_t; +#endif + #define LPP_PORT 2175 #define LPP_BUFSIZE (1 << 20) -- 2.20.1