adapt to -std=c99
authorMatthias Braun <matthias.braun@kit.edu>
Fri, 13 Jul 2012 20:02:50 +0000 (22:02 +0200)
committerMatthias Braun <matthias.braun@kit.edu>
Fri, 13 Jul 2012 20:04:14 +0000 (22:04 +0200)
include/libfirm/adt/xmalloc.h
ir/be/beprefalloc.c
ir/be/bespillbelady.c
ir/lpp/lpp_comm.c
ir/lpp/lpp_comm.h
ir/lpp/lpp_net.c

index b07d0b7..a4cfaa7 100644 (file)
@@ -35,6 +35,9 @@
 #ifdef _WIN32
 #include <malloc.h>
 #endif
+#if defined(__linux__) || defined(__APPLE__)
+#include <alloca.h>
+#endif
 
 #include "../begin.h"
 
index 93a771c..3740ff7 100644 (file)
@@ -119,7 +119,7 @@ struct allocation_info_t {
        unsigned  last_uses[2];   /**< bitset indicating last uses (input pos) */
        ir_node  *current_value;  /**< copy of the value that should be used */
        ir_node  *original_value; /**< for copies point to original value */
-       float     prefs[0];       /**< register preferences */
+       float     prefs[];        /**< register preferences */
 };
 typedef struct allocation_info_t allocation_info_t;
 
@@ -133,7 +133,7 @@ typedef struct reg_pref_t reg_pref_t;
 /** per basic-block information */
 struct block_info_t {
        bool     processed;       /**< indicate whether block is processed */
-       ir_node *assignments[0];  /**< register assignments at end of block */
+       ir_node *assignments[];   /**< register assignments at end of block */
 };
 typedef struct block_info_t block_info_t;
 
index 360aa58..e14db56 100644 (file)
@@ -78,7 +78,7 @@ typedef struct loc_t {
 
 typedef struct workset_t {
        unsigned len;     /**< current length */
-       loc_t    vals[0]; /**< array of the values/distances in this working set */
+       loc_t    vals[];  /**< array of the values/distances in this working set */
 } workset_t;
 
 static struct obstack               obst;
index bcfa974..8d307e8 100644 (file)
@@ -33,6 +33,8 @@
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #include <winsock2.h>
+#include <BaseTsd.h>
+typedef SSIZE_T ssize_t;
 #else
 #include <unistd.h>
 #include <sys/types.h>
@@ -119,7 +121,7 @@ static ssize_t secure_send(int fd, const void *buf, size_t n)
        return n;
 }
 
-ssize_t lpp_flush(lpp_comm_t *comm)
+static ssize_t lpp_flush_(lpp_comm_t *comm)
 {
        ssize_t res = 0;
        if(comm->w_pos - comm->w_buf > 0) {
@@ -133,6 +135,11 @@ ssize_t lpp_flush(lpp_comm_t *comm)
        return res;
 }
 
+void lpp_flush(lpp_comm_t *comm)
+{
+       lpp_flush_(comm);
+}
+
 static ssize_t lpp_write(lpp_comm_t *comm, const void *buf, size_t len)
 {
        assert(comm->w_pos - comm->w_buf >= 0);
@@ -160,7 +167,7 @@ static ssize_t lpp_write(lpp_comm_t *comm, const void *buf, size_t len)
                        size_t n_direct = rest / comm->buf_size;
                        size_t last_rest;
 
-                       if(lpp_flush(comm) < 0)
+                       if(lpp_flush_(comm) < 0)
                                return -1;
 
                        for(i = 0; i < n_direct; ++i) {
index e087e8e..193d004 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)
 
@@ -95,7 +90,7 @@ lpp_comm_t *lpp_comm_new(int fd, size_t buf_size);
 
 int lpp_comm_fileno(const lpp_comm_t *comm);
 
-ssize_t lpp_flush(lpp_comm_t *comm);
+void lpp_flush(lpp_comm_t *comm);
 
 void lpp_comm_free(lpp_comm_t *comm);
 
index c8799a6..7ef7285 100644 (file)
@@ -110,7 +110,7 @@ static int connect_tcp(const char *host, uint16_t port)
        sin.sin_port   = htons(port);
 
        if ((phe = gethostbyname(host)))
-               memcpy(&sin.sin_addr, phe->h_addr, phe->h_length);
+               memcpy(&sin.sin_addr, phe->h_addr_list[0], phe->h_length);
        else if((sin.sin_addr.s_addr = inet_addr(host)) == INADDR_NONE) {
                lpp_print_err("cannot get host entry for %s", host);
                return -1;