Fix more gcc 3.4 warnings
Subsystems (6)
PATCH 1/1 Fix more gcc 3.4 warnings
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.
-Andi
fs/ext3/namei.c renamed from fs/ext3/namei.c-o +1 -1
@@ -1311,7 +1311,7 @@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 */
fs/compat_ioctl.c renamed from fs/compat_ioctl.c-o +6 -2
@@ -1897,12 +1897,14 @@struct blkpg_ioctl_arg a;struct blkpg_partition p;int err; +compat_caddr_t data;mm_segment_t old_fs =get_fs (); err =get_user (a.op, &arg->op); err |=__get_user (a.flags, &arg->flags); err |=__get_user (a.datalen, &arg->datalen); - err |=__get_user ((long )a.data, &arg->data); + err |=__get_user (data, &arg->data); + a.data =compat_ptr (data);if (err)return err;switch (a.op) {case BLKPG_ADD_PARTITION :
@@ -2081,6 +2083,7 @@case FDDEFPRM32 :case FDGETPRM32 : { +compat_uptr_t name;struct floppy_struct *f; f = karg =kmalloc (sizeof (struct floppy_struct ),GFP_KERNEL );
@@ -2097,7 +2100,8 @@ err |=__get_user (f->rate, &((struct floppy_struct32 *)arg)->rate); err |=__get_user (f->spec1, &((struct floppy_struct32 *)arg)->spec1); err |=__get_user (f->fmt_gap, &((struct floppy_struct32 *)arg)->fmt_gap); - err |=__get_user ((u64 )f->name, &((struct floppy_struct32 *)arg)->name); + err |=__get_user (name, &((struct floppy_struct32 *)arg)->name); + f->name =compat_ptr (name);if (err) { err = -EFAULT ; goto out;
fs/readdir.c renamed from fs/readdir.c-o +2 -2
@@ -159,7 +159,7 @@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 @@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 ;
lib/crc32.c renamed from lib/crc32.c-o +12 -4
@@ -99,7 +99,9 @@/* 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 @@/* 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 @@/* 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 @@/* 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);
net/netlink/af_netlink.c renamed from net/netlink/af_netlink.c-o +2 -1
@@ -230,7 +230,8 @@sock_init_data (sock,sk);sk_set_owner (sk,THIS_MODULE ); - nlk =nlk_sk (sk) =kmalloc (sizeof (*nlk),GFP_KERNEL ); + nlk =kmalloc (sizeof (*nlk),GFP_KERNEL ); + sk->sk_protinfo = nlk;if (!nlk) {sk_free (sk);return -ENOMEM ;
net/packet/af_packet.c renamed from net/packet/af_packet.c-o +2 -1
@@ -961,7 +961,8 @@sock_init_data (sock,sk);sk_set_owner (sk,THIS_MODULE ); - po =pkt_sk (sk) =kmalloc (sizeof (*po),GFP_KERNEL ); + po =kmalloc (sizeof (*po),GFP_KERNEL ); + sk->sk_protinfo = po;if (!po) goto out_free;memset (po,0 ,sizeof (*po));
diff -u linux-34/init/Kconfig-o linux-34/init/Kconfig
drivers/ieee1394/highlevel.c renamed from drivers/ieee1394/highlevel.c-o +2 -2
@@ -504,7 +504,7 @@ rcode =RCODE_TYPE_ERROR ; } - (u8 *)data += partlength; + data += partlength; length -= partlength; addr += partlength;
@@ -550,7 +550,7 @@ rcode =RCODE_TYPE_ERROR ; } - (u8 *)data += partlength; + data += partlength; length -= partlength; addr += partlength;
include/linux/efi.h renamed from include/linux/efi.h-o +2 -2
@@ -297,8 +297,8 @@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 unsigned long inline __init efi_get_time (void ); -extern int inline __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;#ifdef CONFIG_EFI
include/linux/sched.h renamed from include/linux/sched.h-o +1 -1
@@ -669,7 +669,7 @@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))
include/linux/reiserfs_fs.h renamed from include/linux/reiserfs_fs.h-o +9 -9
@@ -1781,25 +1781,25 @@/* 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
include/asm-x86_64/apic.h renamed from include/asm-x86_64/apic.h-o +1 -1
@@ -79,7 +79,7 @@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,unsigned reason); +extern void nmi_watchdog_tick (struct pt_regs * regs,unsigned reason);extern int APIC_init_uniprocessor (void );extern void disable_APIC_timer (void );extern void enable_APIC_timer (void );
include/asm-x86_64/unistd.h renamed from include/asm-x86_64/unistd.h-o +1 -1
@@ -694,7 +694,7 @@ }extern long sys_exit (int ) __attribute__((noreturn)); -extern inline long exit (int error_code) +extern inline void exit (int error_code) {sys_exit (error_code); }
include/asm-x86_64/hw_irq.h renamed from include/asm-x86_64/hw_irq.h-o +1 -1
@@ -77,7 +77,7 @@#ifndef __ASSEMBLY__extern u8 irq_vector[NR_IRQ_VECTORS ]; -#define IO_APIC_VECTOR (irq) ((int)irq_vector[irq]) +#define IO_APIC_VECTOR (irq) (irq_vector[irq])/* * Various low-level irq details needed by irq.c, process.c,
include/asm-i386/apic.h renamed from include/asm-i386/apic.h-o +1 -1
@@ -85,7 +85,7 @@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 );
include/asm-i386/unistd.h renamed from include/asm-i386/unistd.h-o +1 -1
@@ -394,7 +394,7 @@ 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
include/asm-i386/hw_irq.h renamed from include/asm-i386/hw_irq.h-o +1 -1
@@ -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 );