From d75cb1840b2c95fcfa740a9e6b350ae44c9fbb46 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Tue, 3 Feb 2004 18:32:27 -0800 Subject: [PATCH] [PATCH] Fix more gcc 3.4 warnings From: Andi Kleen 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 --git a/drivers/ieee1394/highlevel.c b/drivers/ieee1394/highlevel.c index 77c3623c00ce8..f28c339d62671 100644 --- a/drivers/ieee1394/highlevel.c +++ b/drivers/ieee1394/highlevel.c @@ -521,7 +521,7 @@ int highlevel_read(struct hpsb_host *host, int nodeid, void *data, rcode = RCODE_TYPE_ERROR; } - (u8 *)data += partlength; + data += partlength; length -= partlength; addr += partlength; @@ -567,7 +567,7 @@ int highlevel_write(struct hpsb_host *host, int nodeid, int destid, rcode = RCODE_TYPE_ERROR; } - (u8 *)data += partlength; + data += partlength; length -= partlength; addr += partlength; diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index b2048a804995d..a6c74193ba609 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -2112,6 +2112,7 @@ static int fd_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg) 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 fd, unsigned int cmd, unsigned long arg) 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 --git a/fs/ext3/namei.c b/fs/ext3/namei.c index 5e48b9099cdb7..6785c378d1be5 100644 --- a/fs/ext3/namei.c +++ b/fs/ext3/namei.c @@ -1311,7 +1311,7 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry, 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 --git a/fs/readdir.c b/fs/readdir.c index f9cd0419bf5e8..3aff6efbf3571 100644 --- a/fs/readdir.c +++ b/fs/readdir.c @@ -159,7 +159,7 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset, 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 char * name, int namlen, loff_t offset, 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 --git a/include/asm-i386/apic.h b/include/asm-i386/apic.h index 42a1dcaf172bc..d3054e6fa4bb0 100644 --- a/include/asm-i386/apic.h +++ b/include/asm-i386/apic.h @@ -85,7 +85,7 @@ extern void disable_lapic_nmi_watchdog(void); 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 --git a/include/asm-i386/hw_irq.h b/include/asm-i386/hw_irq.h index 9b3b8bf9e266a..b8166a30fbe10 100644 --- a/include/asm-i386/hw_irq.h +++ b/include/asm-i386/hw_irq.h @@ -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 --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h index 3adc789060f03..df3c08986b2d3 100644 --- a/include/asm-i386/unistd.h +++ b/include/asm-i386/unistd.h @@ -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 --git a/include/linux/efi.h b/include/linux/efi.h index a1764b1fb1063..b29c8d42178f1 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h @@ -297,8 +297,8 @@ extern u64 efi_mem_attributes (unsigned long phys_addr); 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 --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h index 32fe6c84b3b6b..3e6c91301407b 100644 --- a/include/linux/reiserfs_fs.h +++ b/include/linux/reiserfs_fs.h @@ -1781,25 +1781,25 @@ int reiserfs_convert_objectid_map_v1(struct super_block *) ; /* 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 --git a/include/linux/sched.h b/include/linux/sched.h index f5f84aedbaec7..e77f1330d90bd 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -670,7 +670,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 --git a/kernel/fork.c b/kernel/fork.c index b703d95dadc77..8d84f4e857668 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -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 --git a/lib/crc32.c b/lib/crc32.c index 86d8670569a75..2783fa38af65c 100644 --- a/lib/crc32.c +++ b/lib/crc32.c @@ -99,7 +99,9 @@ u32 attribute((pure)) crc32_le(u32 crc, unsigned char const *p, size_t len) /* 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, unsigned char const *p, size_t len) /* 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, unsigned char const *p, size_t len) /* 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, unsigned char const *p, size_t len) /* 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); -- 2.53.0