Hi!

The attached `hurd_v.s._gcc-4.0.patch' makes the Hurd buildable with
gcc-4.0.

The ChangeLog in a condensed form:
#v+
2005-09-01  Thomas Schwinge  <[EMAIL PROTECTED]>

        * boot/boot.c (boot_script_exec_cmd): Fix invalid lvalues.
        * libdiskfs/priv.h: Include <argp.h>.
        * nfsd/loop.c (server_loop): Fix invalid lvalues.
        * pfinet/glue-include/asm/system.h (xchg): Fix invalid lvalue.
        * pfinet/linux-src/net/ipv4/tcp_ipv4.c (tcp_v4_rst_req): Don't use ?:
        as a lvalue.
        * ufs/dir.h (DIRECT_NAMELEN): Don't use ?: as a lvalue.
        * ufs-utils/mkfs.c (parse_opt): Move UP's functionality into UP_INT in
        order to fix invalid lvalues.
        * utils/ps.c (current_tty_name): Don't declare as `static'.
        * utils/rpctrace.c (print_contents): Don't use ?: as a lvalue.
        (msgids_file_p) Don't declare as `static'.
#v-


I also attached a fixed version of Alfred's `kalloc.c.diff'.

serverboot/ChangeLog
#v+
2005-08-13  Alfred M. Szmidt  <[EMAIL PROTECTED]>

        * kalloc.c: #include <malloc.h>
        (init_hook, malloc_hook, free_hook): New functions.
        (__malloc_initialize_hook): New variable.
        (malloc, free): Functions removed.
#v-


Regards,
 Thomas
boot/ChangeLog
2005-09-01  Thomas Schwinge  <[EMAIL PROTECTED]>

        * boot.c (boot_script_exec_cmd): Fix invalid lvalues.


libdiskfs/ChangeLog
2005-09-01  Thomas Schwinge  <[EMAIL PROTECTED]>

        * priv.h: Include <argp.h>.


nfsd/ChangeLog
2005-09-01  Thomas Schwinge  <[EMAIL PROTECTED]>

        * loop.c (server_loop): Fix invalid lvalues.


pfinet/ChangeLog
2005-09-01  Thomas Schwinge  <[EMAIL PROTECTED]>

        * glue-include/asm/system.h (xchg): Fix invalid lvalue.
        * linux-src/net/ipv4/tcp_ipv4.c (tcp_v4_rst_req): Don't use ?: as a
        lvalue.


ufs/ChangeLog
2005-09-01  Thomas Schwinge  <[EMAIL PROTECTED]>

        * dir.h (DIRECT_NAMELEN): Don't use ?: as a lvalue.


ufs-utils/ChangeLog
2005-09-01  Thomas Schwinge  <[EMAIL PROTECTED]>

        * mkfs.c (parse_opt): Move UP's functionality into UP_INT in order to
        fix invalid lvalues.


utils/ChangeLog
2005-09-01  Thomas Schwinge  <[EMAIL PROTECTED]>

        * ps.c (current_tty_name): Don't declare as `static'.
        * rpctrace.c (print_contents): Don't use ?: as a lvalue.
        (msgids_file_p) Don't declare as `static'.


Thu Sep  1 18:49:27 CEST 2005  Thomas Schwinge <[EMAIL PROTECTED]>
  * Make it build with gcc-4.0.
diff -rN -u old-hurd-0-branch.1.tmp-1/boot/boot.c 
new-hurd-0-branch.1.tmp-1/boot/boot.c
--- old-hurd-0-branch.1.tmp-1/boot/boot.c       2005-09-01 19:18:01.293715312 
+0200
+++ new-hurd-0-branch.1.tmp-1/boot/boot.c       2005-09-01 19:18:01.307713184 
+0200
@@ -367,11 +367,17 @@
   str_start = ((vm_address_t) arg_pos
               + (argc + 2) * sizeof (char *) + sizeof (integer_t));
   p = args + ((vm_address_t) arg_pos & (vm_page_size - 1));
-  *((int *) p)++ = argc;
+  *(int *) p = argc;
+  p += sizeof (int *);
   for (i = 0; i < argc; i++)
-    *((char **) p)++ = argv[i] - strings + (char *) str_start;
-  *((char **) p)++ = 0;
-  *((char **) p)++ = 0;
+    {
+      *(char **) p = argv[i] - strings + (char *) str_start;
+      p += sizeof (char **);
+    }
+  *(char **) p = 0;
+  p += sizeof (char **);
+  *(char **) p = 0;
+  p += sizeof (char **);
   memcpy (p, strings, stringlen);
   bzero (args, (vm_offset_t) arg_pos & (vm_page_size - 1));
   vm_write (task, trunc_page ((vm_offset_t) arg_pos), (vm_address_t) args,
diff -rN -u old-hurd-0-branch.1.tmp-1/libdiskfs/priv.h 
new-hurd-0-branch.1.tmp-1/libdiskfs/priv.h
--- old-hurd-0-branch.1.tmp-1/libdiskfs/priv.h  2005-09-01 19:18:01.291715616 
+0200
+++ new-hurd-0-branch.1.tmp-1/libdiskfs/priv.h  2005-09-01 19:18:01.737647824 
+0200
@@ -26,6 +26,7 @@
 #include <hurd/iohelp.h>
 #include <hurd/port.h>
 #include <assert.h>
+#include <argp.h>
 
 #include "diskfs.h"
 
diff -rN -u old-hurd-0-branch.1.tmp-1/nfsd/loop.c 
new-hurd-0-branch.1.tmp-1/nfsd/loop.c
--- old-hurd-0-branch.1.tmp-1/nfsd/loop.c       2005-09-01 19:18:01.291715616 
+0200
+++ new-hurd-0-branch.1.tmp-1/nfsd/loop.c       2005-09-01 19:18:01.318711512 
+0200
@@ -77,7 +77,7 @@
        /* This transacation has already completed.  */
        goto repost_reply;
 
-      r = (int *) rbuf = malloc (MAXIOSIZE);
+      r = (int *) (rbuf = malloc (MAXIOSIZE));
 
       if (ntohl (*p) != RPC_MSG_VERSION)
        {
@@ -173,7 +173,7 @@
          if (amt > MAXIOSIZE)
            {
              free (rbuf);
-             r = (int *) rbuf = malloc (amt);
+             r = (int *) (rbuf = malloc (amt));
            }
        }
 
diff -rN -u old-hurd-0-branch.1.tmp-1/pfinet/glue-include/asm/system.h 
new-hurd-0-branch.1.tmp-1/pfinet/glue-include/asm/system.h
--- old-hurd-0-branch.1.tmp-1/pfinet/glue-include/asm/system.h  2005-09-01 
19:18:01.291715616 +0200
+++ new-hurd-0-branch.1.tmp-1/pfinet/glue-include/asm/system.h  2005-09-01 
19:18:01.495684608 +0200
@@ -9,7 +9,7 @@
 #define xchg(ptr, x)                                                         \
   ({                                                                         \
     __typeof__ (*(ptr)) *_ptr = (ptr), _x = *_ptr;                           \
-    (uintptr_t) *_ptr = (x); _x;                                             \
+    *_ptr = (x); _x;                                         \
   })
 
 #define mb()   ((void) 0)      /* memory barrier */
diff -rN -u old-hurd-0-branch.1.tmp-1/pfinet/linux-src/net/ipv4/tcp_ipv4.c 
new-hurd-0-branch.1.tmp-1/pfinet/linux-src/net/ipv4/tcp_ipv4.c
--- old-hurd-0-branch.1.tmp-1/pfinet/linux-src/net/ipv4/tcp_ipv4.c      
2005-09-01 19:18:01.290715768 +0200
+++ new-hurd-0-branch.1.tmp-1/pfinet/linux-src/net/ipv4/tcp_ipv4.c      
2005-09-01 19:18:01.512682024 +0200
@@ -1584,7 +1584,10 @@
            after(TCP_SKB_CB(skb)->seq, req->rcv_isn+1))
                return;
        tcp_synq_unlink(tp, req, prev);
-       (req->sk ? sk->ack_backlog : tp->syn_backlog)--;
+       if (req->sk)
+               sk->ack_backlog--;
+       else
+               tp->syn_backlog--;
        req->class->destructor(req);
        tcp_openreq_free(req); 
 
diff -rN -u old-hurd-0-branch.1.tmp-1/ufs/dir.h 
new-hurd-0-branch.1.tmp-1/ufs/dir.h
--- old-hurd-0-branch.1.tmp-1/ufs/dir.h 2005-09-01 19:18:01.288716072 +0200
+++ new-hurd-0-branch.1.tmp-1/ufs/dir.h 2005-09-01 19:18:01.301714096 +0200
@@ -91,13 +91,13 @@
 /* Return the namlen from a struct direct, paying attention to whether
    this filesystem supports the type extension */
 #if (BYTE_ORDER == LITTLE_ENDIAN)
-#define DIRECT_NAMLEN(dp) (direct_symlink_extension || swab_disk           \
-                          ? (dp)->d_namlen                                 \
-                          : (dp)->d_type)
+#define DIRECT_NAMLEN(dp) (*(direct_symlink_extension || swab_disk         \
+                            ? &(dp)->d_namlen                              \
+                            : &(dp)->d_type))
 #else
-#define DIRECT_NAMLEN(dp) (!direct_symlink_extension && swab_disk          \
-                          ? (dp)->d_type                                   \
-                          : (dp)->d_namlen)
+#define DIRECT_NAMLEN(dp) (*(!direct_symlink_extension && swab_disk        \
+                            ? &(dp)->d_type                                \
+                            : &(dp)->d_namlen))
 #endif
 
 /*
diff -rN -u old-hurd-0-branch.1.tmp-1/ufs-utils/mkfs.c 
new-hurd-0-branch.1.tmp-1/ufs-utils/mkfs.c
--- old-hurd-0-branch.1.tmp-1/ufs-utils/mkfs.c  2005-09-01 19:18:01.287716224 
+0200
+++ new-hurd-0-branch.1.tmp-1/ufs-utils/mkfs.c  2005-09-01 19:18:01.461689776 
+0200
@@ -279,10 +279,8 @@
        case 'N': Nflag = 1; break;
        case 'O': Oflag = 1; break;
 
-         /* Mark &VAR as being a uparam, and return a lvalue for VAR.  */
-#define UP(var) (amarks_add (&uparams, &var), var)
-         /* Record an integer uparam into VAR.  */
-#define UP_INT(var) { int _i = atoi (arg); UP (var) = _i; }
+/* Mark &VAR as being a uparam, and set VAR.  */
+#define UP_INT(var) { amarks_add (&uparams, &var); var = atoi (arg); }
 
        case 'a': UP_INT (maxcontig); break;
        case 'b': UP_INT (bsize); break;
diff -rN -u old-hurd-0-branch.1.tmp-1/utils/ps.c 
new-hurd-0-branch.1.tmp-1/utils/ps.c
--- old-hurd-0-branch.1.tmp-1/utils/ps.c        2005-09-01 19:18:01.286716376 
+0200
+++ new-hurd-0-branch.1.tmp-1/utils/ps.c        2005-09-01 19:18:01.452691144 
+0200
@@ -249,7 +249,7 @@
     }
 
   /* Returns the name of the current controlling terminal.  */
-  static const char *current_tty_name()
+  const char *current_tty_name()
     {
       error_t err;
       struct ps_tty *tty;
diff -rN -u old-hurd-0-branch.1.tmp-1/utils/rpctrace.c 
new-hurd-0-branch.1.tmp-1/utils/rpctrace.c
--- old-hurd-0-branch.1.tmp-1/utils/rpctrace.c  2005-09-01 19:18:01.285716528 
+0200
+++ new-hurd-0-branch.1.tmp-1/utils/rpctrace.c  2005-09-01 19:18:01.454690840 
+0200
@@ -616,11 +616,16 @@
 
                  name = MACH_MSG_TYPE_MOVE_SEND;
                }
-             (type->msgt_longform ? lt->msgtl_name : type->msgt_name) = name;
+             if (type->msgt_longform)
+               lt->msgtl_name = name;
+             else
+               type->msgt_name = name;
            }
          else if (newtypes[0] != name)
-           (type->msgt_longform ? lt->msgtl_name : type->msgt_name)
-             = newtypes[0];
+           if (type->msgt_longform)
+             lt->msgtl_name = newtypes[0];
+           else
+             type->msgt_name = newtypes[0];
        }
       else
        print_data (name, data, nelt, eltsize);
@@ -1083,7 +1088,7 @@
            struct dirent **eps;
            int n;
            
-           static int
+           int
              msgids_file_p (const struct dirent *eps)
              {
                if (fnmatch ("*.msgids", eps->d_name, 0) != FNM_NOMATCH)

Index: serverboot/ChangeLog
2005-08-13  Alfred M. Szmidt  <[EMAIL PROTECTED]>

        * kalloc.c: #include <malloc.h>
        (init_hook, malloc_hook, free_hook): New functions.
        (__malloc_initialize_hook): New variable.
        (malloc, free): Functions removed.

--- serverboot/kalloc.c 04 Apr 1997 01:27:41 +0200      1.1
+++ serverboot/kalloc.c 13 Aug 2005 20:07:09 +0200      
@@ -34,6 +34,14 @@
 
 #include <mach.h>
 #include <cthreads.h>          /* for spin locks */
+#include <malloc.h>            /* for malloc_hook/free_hook */
+
+static void init_hook (void);
+static void *malloc_hook (size_t size, const void *caller);
+static void free_hook (void *ptr, const void *caller);
+
+void (*__malloc_initialize_hook) (void) = init_hook;
+
 
 #define        DEBUG
 
@@ -250,12 +258,21 @@ kfree(    void *data,
        }
 }
 
-void *malloc(vm_size_t size)
+static void
+init_hook (void)
 {
-       return (void *)kalloc(size);
+  __malloc_hook = malloc_hook;
+  __free_hook = free_hook;
 }
 
-void free(void *addr)
+static void *
+malloc_hook (size_t size, const void *caller)
+{
+  return (void *) kalloc ((vm_size_t) size);
+}
+
+static void
+free_hook (void *ptr, const void *caller)
 {
   /* Just ignore harmless attempts at cleanliness.  */
   /*   panic("free not implemented"); */
_______________________________________________
Bug-hurd mailing list
Bug-hurd@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-hurd

Reply via email to