From: Andi Kleen <ak@muc.de>

Just many more warning fixes for a gcc 3.4 snapshot.

It warns for a lot of things now, e.g.  for ?: and ({ ...  }) and casts as
lvalues.  And for functions marked inline in headers, but no body.

Actually there are more warnings, i stopped fixing at some point.  Some of
the warnings seem to be dubious (e.g.  the binfmt_elf.c one, which looks
more like a compiler bug to me) 

I also fixed the _exit() prototype to be void because gcc was complaining
about this.



---

 drivers/ieee1394/highlevel.c |    4 ++--
 fs/compat_ioctl.c            |    4 +++-
 fs/ext3/namei.c              |    2 +-
 fs/readdir.c                 |    4 ++--
 include/asm-i386/apic.h      |    2 +-
 include/asm-i386/hw_irq.h    |    2 +-
 include/asm-i386/unistd.h    |    2 +-
 include/linux/efi.h          |    4 ++--
 include/linux/reiserfs_fs.h  |   18 +++++++++---------
 include/linux/sched.h        |    2 +-
 kernel/fork.c                |    2 +-
 lib/crc32.c                  |   16 ++++++++++++----
 12 files changed, 36 insertions(+), 26 deletions(-)

diff -puN drivers/ieee1394/highlevel.c~fix-more-gcc-34-warnings drivers/ieee1394/highlevel.c
--- 25/drivers/ieee1394/highlevel.c~fix-more-gcc-34-warnings	2004-01-25 13:16:08.000000000 -0800
+++ 25-akpm/drivers/ieee1394/highlevel.c	2004-01-25 13:16:09.000000000 -0800
@@ -524,7 +524,7 @@ int highlevel_read(struct hpsb_host *hos
                                 rcode = RCODE_TYPE_ERROR;
                         }
 
-			(u8 *)data += partlength;
+			data += partlength;
                         length -= partlength;
                         addr += partlength;
 
@@ -570,7 +570,7 @@ int highlevel_write(struct hpsb_host *ho
                                 rcode = RCODE_TYPE_ERROR;
                         }
 
-			(u8 *)data += partlength;
+			data += partlength;
                         length -= partlength;
                         addr += partlength;
 
diff -puN fs/compat_ioctl.c~fix-more-gcc-34-warnings fs/compat_ioctl.c
--- 25/fs/compat_ioctl.c~fix-more-gcc-34-warnings	2004-01-25 13:16:08.000000000 -0800
+++ 25-akpm/fs/compat_ioctl.c	2004-01-25 13:16:09.000000000 -0800
@@ -2112,6 +2112,7 @@ static int fd_ioctl_trans(unsigned int f
 		case FDDEFPRM32:
 		case FDGETPRM32:
 		{
+			compat_uptr_t name;
 			struct floppy_struct32 *uf;
 			struct floppy_struct *f;
 
@@ -2130,7 +2131,8 @@ static int fd_ioctl_trans(unsigned int f
 			err |= __get_user(f->rate, &uf->rate);
 			err |= __get_user(f->spec1, &uf->spec1);
 			err |= __get_user(f->fmt_gap, &uf->fmt_gap);
-			err |= __get_user((u64)f->name, &uf->name);
+			err |= __get_user(name, &uf->name);
+			f->name = compat_ptr(name);
 			if (err) {
 				err = -EFAULT;
 				goto out;
diff -puN fs/ext3/namei.c~fix-more-gcc-34-warnings fs/ext3/namei.c
--- 25/fs/ext3/namei.c~fix-more-gcc-34-warnings	2004-01-25 13:16:08.000000000 -0800
+++ 25-akpm/fs/ext3/namei.c	2004-01-25 13:16:09.000000000 -0800
@@ -1311,7 +1311,7 @@ static int make_indexed_dir(handle_t *ha
 	memcpy (data1, de, len);
 	de = (struct ext3_dir_entry_2 *) data1;
 	top = data1 + len;
-	while (((char *) de2=(char*)de+le16_to_cpu(de->rec_len)) < top)
+	while ((char *)(de2=(void*)de+le16_to_cpu(de->rec_len)) < top)
 		de = de2;
 	de->rec_len = cpu_to_le16(data1 + blocksize - (char *) de);
 	/* Initialize the root; the dot dirents already exist */
diff -puN fs/readdir.c~fix-more-gcc-34-warnings fs/readdir.c
--- 25/fs/readdir.c~fix-more-gcc-34-warnings	2004-01-25 13:16:09.000000000 -0800
+++ 25-akpm/fs/readdir.c	2004-01-25 13:16:09.000000000 -0800
@@ -159,7 +159,7 @@ static int filldir(void * __buf, const c
 	if (__put_user(0, dirent->d_name + namlen))
 		goto efault;
 	buf->previous = dirent;
-	((char *) dirent) += reclen;
+	dirent = (void *)dirent + reclen;
 	buf->current_dir = dirent;
 	buf->count -= reclen;
 	return 0;
@@ -245,7 +245,7 @@ static int filldir64(void * __buf, const
 	if (__put_user(0, dirent->d_name + namlen))
 		goto efault;
 	buf->previous = dirent;
-	((char *) dirent) += reclen;
+	dirent = (void *)dirent + reclen;
 	buf->current_dir = dirent;
 	buf->count -= reclen;
 	return 0;
diff -puN include/asm-i386/apic.h~fix-more-gcc-34-warnings include/asm-i386/apic.h
--- 25/include/asm-i386/apic.h~fix-more-gcc-34-warnings	2004-01-25 13:16:09.000000000 -0800
+++ 25-akpm/include/asm-i386/apic.h	2004-01-25 13:16:09.000000000 -0800
@@ -85,7 +85,7 @@ extern void disable_lapic_nmi_watchdog(v
 extern void enable_lapic_nmi_watchdog(void);
 extern void disable_timer_nmi_watchdog(void);
 extern void enable_timer_nmi_watchdog(void);
-extern inline void nmi_watchdog_tick (struct pt_regs * regs);
+extern void nmi_watchdog_tick (struct pt_regs * regs);
 extern int APIC_init_uniprocessor (void);
 extern void disable_APIC_timer(void);
 extern void enable_APIC_timer(void);
diff -puN include/asm-i386/hw_irq.h~fix-more-gcc-34-warnings include/asm-i386/hw_irq.h
--- 25/include/asm-i386/hw_irq.h~fix-more-gcc-34-warnings	2004-01-25 13:16:09.000000000 -0800
+++ 25-akpm/include/asm-i386/hw_irq.h	2004-01-25 13:16:09.000000000 -0800
@@ -26,7 +26,7 @@
  */
 
 extern u8 irq_vector[NR_IRQ_VECTORS];
-#define IO_APIC_VECTOR(irq)	((int)irq_vector[irq])
+#define IO_APIC_VECTOR(irq)	(irq_vector[irq])
 
 extern void (*interrupt[NR_IRQS])(void);
 
diff -puN include/asm-i386/unistd.h~fix-more-gcc-34-warnings include/asm-i386/unistd.h
--- 25/include/asm-i386/unistd.h~fix-more-gcc-34-warnings	2004-01-25 13:16:09.000000000 -0800
+++ 25-akpm/include/asm-i386/unistd.h	2004-01-25 13:16:09.000000000 -0800
@@ -394,7 +394,7 @@ static inline _syscall1(int,dup,int,fd)
 static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp)
 static inline _syscall3(int,open,const char *,file,int,flag,int,mode)
 static inline _syscall1(int,close,int,fd)
-static inline _syscall1(int,_exit,int,exitcode)
+static inline _syscall1(void,_exit,int,exitcode)
 static inline _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options)
 
 #endif
diff -puN include/linux/efi.h~fix-more-gcc-34-warnings include/linux/efi.h
--- 25/include/linux/efi.h~fix-more-gcc-34-warnings	2004-01-25 13:16:09.000000000 -0800
+++ 25-akpm/include/linux/efi.h	2004-01-25 13:16:09.000000000 -0800
@@ -297,8 +297,8 @@ extern u64 efi_mem_attributes (unsigned 
 extern void efi_initialize_iomem_resources(struct resource *code_resource,
 					struct resource *data_resource);
 extern efi_status_t phys_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc);
-extern inline unsigned long __init efi_get_time(void);
-extern inline int __init efi_set_rtc_mmss(unsigned long nowtime);
+extern unsigned long __init efi_get_time(void);
+extern int __init efi_set_rtc_mmss(unsigned long nowtime);
 extern struct efi_memory_map memmap;
 
 /*
diff -puN include/linux/reiserfs_fs.h~fix-more-gcc-34-warnings include/linux/reiserfs_fs.h
--- 25/include/linux/reiserfs_fs.h~fix-more-gcc-34-warnings	2004-01-25 13:16:09.000000000 -0800
+++ 25-akpm/include/linux/reiserfs_fs.h	2004-01-25 13:16:09.000000000 -0800
@@ -1781,25 +1781,25 @@ int reiserfs_convert_objectid_map_v1(str
 /* stree.c */
 int B_IS_IN_TREE(const struct buffer_head *);
 extern inline void copy_short_key (void * to, const void * from);
-extern inline void copy_item_head(struct item_head * p_v_to, 
+extern void copy_item_head(struct item_head * p_v_to,
 								  const struct item_head * p_v_from);
 
 // first key is in cpu form, second - le
-extern inline int comp_keys (const struct key * le_key, 
+extern int comp_keys (const struct key * le_key,
 			     const struct cpu_key * cpu_key);
-extern inline int  comp_short_keys (const struct key * le_key, 
+extern int  comp_short_keys (const struct key * le_key,
 				    const struct cpu_key * cpu_key);
-extern inline void le_key2cpu_key (struct cpu_key * to, const struct key * from);
+extern void le_key2cpu_key (struct cpu_key * to, const struct key * from);
 
 // both are cpu keys
-extern inline int comp_cpu_keys (const struct cpu_key *, const struct cpu_key *);
-extern inline int comp_short_cpu_keys (const struct cpu_key *, 
+extern  int comp_cpu_keys (const struct cpu_key *, const struct cpu_key *);
+extern int comp_short_cpu_keys (const struct cpu_key *,
 				       const struct cpu_key *);
-extern inline void cpu_key2cpu_key (struct cpu_key *, const struct cpu_key *);
+extern void cpu_key2cpu_key (struct cpu_key *, const struct cpu_key *);
 
 // both are in le form
-extern inline int comp_le_keys (const struct key *, const struct key *);
-extern inline int comp_short_le_keys (const struct key *, const struct key *);
+extern int comp_le_keys (const struct key *, const struct key *);
+extern int comp_short_le_keys (const struct key *, const struct key *);
 
 //
 // get key version from on disk key - kludge
diff -puN include/linux/sched.h~fix-more-gcc-34-warnings include/linux/sched.h
--- 25/include/linux/sched.h~fix-more-gcc-34-warnings	2004-01-25 13:16:09.000000000 -0800
+++ 25-akpm/include/linux/sched.h	2004-01-25 13:16:09.000000000 -0800
@@ -757,7 +757,7 @@ static inline int capable(int cap)
 extern struct mm_struct * mm_alloc(void);
 
 /* mmdrop drops the mm and the page tables */
-extern inline void FASTCALL(__mmdrop(struct mm_struct *));
+extern void FASTCALL(__mmdrop(struct mm_struct *));
 static inline void mmdrop(struct mm_struct * mm)
 {
 	if (atomic_dec_and_test(&mm->mm_count))
diff -puN kernel/fork.c~fix-more-gcc-34-warnings kernel/fork.c
--- 25/kernel/fork.c~fix-more-gcc-34-warnings	2004-01-25 13:16:09.000000000 -0800
+++ 25-akpm/kernel/fork.c	2004-01-25 13:16:09.000000000 -0800
@@ -416,7 +416,7 @@ struct mm_struct * mm_alloc(void)
  * is dropped: either by a lazy thread or by
  * mmput. Free the page directory and the mm.
  */
-inline void __mmdrop(struct mm_struct *mm)
+void __mmdrop(struct mm_struct *mm)
 {
 	BUG_ON(mm == &init_mm);
 	mm_free_pgd(mm);
diff -puN lib/crc32.c~fix-more-gcc-34-warnings lib/crc32.c
--- 25/lib/crc32.c~fix-more-gcc-34-warnings	2004-01-25 13:16:09.000000000 -0800
+++ 25-akpm/lib/crc32.c	2004-01-25 13:16:09.000000000 -0800
@@ -99,7 +99,9 @@ u32 attribute((pure)) crc32_le(u32 crc, 
 	/* Align it */
 	if(unlikely(((long)b)&3 && len)){
 		do {
-			DO_CRC(*((u8 *)b)++);
+			u8 *p = (u8 *)b;
+			DO_CRC(*p++);
+			b = (void *)p;
 		} while ((--len) && ((long)b)&3 );
 	}
 	if(likely(len >= 4)){
@@ -120,7 +122,9 @@ u32 attribute((pure)) crc32_le(u32 crc, 
 	/* And the last few bytes */
 	if(len){
 		do {
-			DO_CRC(*((u8 *)b)++);
+			u8 *p = (u8 *)b;
+			DO_CRC(*p++);
+			b = (void *)p;
 		} while (--len);
 	}
 
@@ -200,7 +204,9 @@ u32 attribute((pure)) crc32_be(u32 crc, 
 	/* Align it */
 	if(unlikely(((long)b)&3 && len)){
 		do {
-			DO_CRC(*((u8 *)b)++);
+			u8 *p = (u8 *)b;
+			DO_CRC(*p++);
+			b = (u32 *)p;
 		} while ((--len) && ((long)b)&3 );
 	}
 	if(likely(len >= 4)){
@@ -221,7 +227,9 @@ u32 attribute((pure)) crc32_be(u32 crc, 
 	/* And the last few bytes */
 	if(len){
 		do {
-			DO_CRC(*((u8 *)b)++);
+			u8 *p = (u8 *)b;
+			DO_CRC(*p++);
+			b = (void *)p;
 		} while (--len);
 	}
 	return __be32_to_cpu(crc);

_