Commit d75cb184 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Fix more gcc 3.4 warnings

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.
parent 60677978
...@@ -521,7 +521,7 @@ int highlevel_read(struct hpsb_host *host, int nodeid, void *data, ...@@ -521,7 +521,7 @@ int highlevel_read(struct hpsb_host *host, int nodeid, void *data,
rcode = RCODE_TYPE_ERROR; rcode = RCODE_TYPE_ERROR;
} }
(u8 *)data += partlength; data += partlength;
length -= partlength; length -= partlength;
addr += partlength; addr += partlength;
...@@ -567,7 +567,7 @@ int highlevel_write(struct hpsb_host *host, int nodeid, int destid, ...@@ -567,7 +567,7 @@ int highlevel_write(struct hpsb_host *host, int nodeid, int destid,
rcode = RCODE_TYPE_ERROR; rcode = RCODE_TYPE_ERROR;
} }
(u8 *)data += partlength; data += partlength;
length -= partlength; length -= partlength;
addr += partlength; addr += partlength;
......
...@@ -2112,6 +2112,7 @@ static int fd_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg) ...@@ -2112,6 +2112,7 @@ static int fd_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
case FDDEFPRM32: case FDDEFPRM32:
case FDGETPRM32: case FDGETPRM32:
{ {
compat_uptr_t name;
struct floppy_struct32 *uf; struct floppy_struct32 *uf;
struct floppy_struct *f; struct floppy_struct *f;
...@@ -2130,7 +2131,8 @@ static int fd_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg) ...@@ -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->rate, &uf->rate);
err |= __get_user(f->spec1, &uf->spec1); err |= __get_user(f->spec1, &uf->spec1);
err |= __get_user(f->fmt_gap, &uf->fmt_gap); 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) { if (err) {
err = -EFAULT; err = -EFAULT;
goto out; goto out;
......
...@@ -1311,7 +1311,7 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry, ...@@ -1311,7 +1311,7 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
memcpy (data1, de, len); memcpy (data1, de, len);
de = (struct ext3_dir_entry_2 *) data1; de = (struct ext3_dir_entry_2 *) data1;
top = data1 + len; 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 = de2;
de->rec_len = cpu_to_le16(data1 + blocksize - (char *) de); de->rec_len = cpu_to_le16(data1 + blocksize - (char *) de);
/* Initialize the root; the dot dirents already exist */ /* Initialize the root; the dot dirents already exist */
......
...@@ -159,7 +159,7 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset, ...@@ -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)) if (__put_user(0, dirent->d_name + namlen))
goto efault; goto efault;
buf->previous = dirent; buf->previous = dirent;
((char *) dirent) += reclen; dirent = (void *)dirent + reclen;
buf->current_dir = dirent; buf->current_dir = dirent;
buf->count -= reclen; buf->count -= reclen;
return 0; return 0;
...@@ -245,7 +245,7 @@ static int filldir64(void * __buf, const char * name, int namlen, loff_t offset, ...@@ -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)) if (__put_user(0, dirent->d_name + namlen))
goto efault; goto efault;
buf->previous = dirent; buf->previous = dirent;
((char *) dirent) += reclen; dirent = (void *)dirent + reclen;
buf->current_dir = dirent; buf->current_dir = dirent;
buf->count -= reclen; buf->count -= reclen;
return 0; return 0;
......
...@@ -85,7 +85,7 @@ extern void disable_lapic_nmi_watchdog(void); ...@@ -85,7 +85,7 @@ extern void disable_lapic_nmi_watchdog(void);
extern void enable_lapic_nmi_watchdog(void); extern void enable_lapic_nmi_watchdog(void);
extern void disable_timer_nmi_watchdog(void); extern void disable_timer_nmi_watchdog(void);
extern void enable_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 int APIC_init_uniprocessor (void);
extern void disable_APIC_timer(void); extern void disable_APIC_timer(void);
extern void enable_APIC_timer(void); extern void enable_APIC_timer(void);
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
*/ */
extern u8 irq_vector[NR_IRQ_VECTORS]; 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); extern void (*interrupt[NR_IRQS])(void);
......
...@@ -394,7 +394,7 @@ static inline _syscall1(int,dup,int,fd) ...@@ -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,execve,const char *,file,char **,argv,char **,envp)
static inline _syscall3(int,open,const char *,file,int,flag,int,mode) static inline _syscall3(int,open,const char *,file,int,flag,int,mode)
static inline _syscall1(int,close,int,fd) 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) static inline _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options)
#endif #endif
......
...@@ -297,8 +297,8 @@ extern u64 efi_mem_attributes (unsigned long phys_addr); ...@@ -297,8 +297,8 @@ extern u64 efi_mem_attributes (unsigned long phys_addr);
extern void efi_initialize_iomem_resources(struct resource *code_resource, extern void efi_initialize_iomem_resources(struct resource *code_resource,
struct resource *data_resource); struct resource *data_resource);
extern efi_status_t phys_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc); 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 unsigned long __init efi_get_time(void);
extern inline int __init efi_set_rtc_mmss(unsigned long nowtime); extern int __init efi_set_rtc_mmss(unsigned long nowtime);
extern struct efi_memory_map memmap; extern struct efi_memory_map memmap;
/* /*
......
...@@ -1781,25 +1781,25 @@ int reiserfs_convert_objectid_map_v1(struct super_block *) ; ...@@ -1781,25 +1781,25 @@ int reiserfs_convert_objectid_map_v1(struct super_block *) ;
/* stree.c */ /* stree.c */
int B_IS_IN_TREE(const struct buffer_head *); int B_IS_IN_TREE(const struct buffer_head *);
extern inline void copy_short_key (void * to, const void * from); 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); const struct item_head * p_v_from);
// first key is in cpu form, second - le // 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); 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); 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 // both are cpu keys
extern inline int comp_cpu_keys (const struct cpu_key *, const struct cpu_key *); extern 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_short_cpu_keys (const struct cpu_key *,
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 // both are in le form
extern inline int comp_le_keys (const struct key *, const struct key *); extern 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_short_le_keys (const struct key *, const struct key *);
// //
// get key version from on disk key - kludge // get key version from on disk key - kludge
......
...@@ -670,7 +670,7 @@ static inline int capable(int cap) ...@@ -670,7 +670,7 @@ static inline int capable(int cap)
extern struct mm_struct * mm_alloc(void); extern struct mm_struct * mm_alloc(void);
/* mmdrop drops the mm and the page tables */ /* 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) static inline void mmdrop(struct mm_struct * mm)
{ {
if (atomic_dec_and_test(&mm->mm_count)) if (atomic_dec_and_test(&mm->mm_count))
......
...@@ -416,7 +416,7 @@ struct mm_struct * mm_alloc(void) ...@@ -416,7 +416,7 @@ struct mm_struct * mm_alloc(void)
* is dropped: either by a lazy thread or by * is dropped: either by a lazy thread or by
* mmput. Free the page directory and the mm. * 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); BUG_ON(mm == &init_mm);
mm_free_pgd(mm); mm_free_pgd(mm);
......
...@@ -99,7 +99,9 @@ u32 attribute((pure)) crc32_le(u32 crc, unsigned char const *p, size_t len) ...@@ -99,7 +99,9 @@ u32 attribute((pure)) crc32_le(u32 crc, unsigned char const *p, size_t len)
/* Align it */ /* Align it */
if(unlikely(((long)b)&3 && len)){ if(unlikely(((long)b)&3 && len)){
do { do {
DO_CRC(*((u8 *)b)++); u8 *p = (u8 *)b;
DO_CRC(*p++);
b = (void *)p;
} while ((--len) && ((long)b)&3 ); } while ((--len) && ((long)b)&3 );
} }
if(likely(len >= 4)){ if(likely(len >= 4)){
...@@ -120,7 +122,9 @@ u32 attribute((pure)) crc32_le(u32 crc, unsigned char const *p, size_t len) ...@@ -120,7 +122,9 @@ u32 attribute((pure)) crc32_le(u32 crc, unsigned char const *p, size_t len)
/* And the last few bytes */ /* And the last few bytes */
if(len){ if(len){
do { do {
DO_CRC(*((u8 *)b)++); u8 *p = (u8 *)b;
DO_CRC(*p++);
b = (void *)p;
} while (--len); } while (--len);
} }
...@@ -200,7 +204,9 @@ u32 attribute((pure)) crc32_be(u32 crc, unsigned char const *p, size_t len) ...@@ -200,7 +204,9 @@ u32 attribute((pure)) crc32_be(u32 crc, unsigned char const *p, size_t len)
/* Align it */ /* Align it */
if(unlikely(((long)b)&3 && len)){ if(unlikely(((long)b)&3 && len)){
do { do {
DO_CRC(*((u8 *)b)++); u8 *p = (u8 *)b;
DO_CRC(*p++);
b = (u32 *)p;
} while ((--len) && ((long)b)&3 ); } while ((--len) && ((long)b)&3 );
} }
if(likely(len >= 4)){ if(likely(len >= 4)){
...@@ -221,7 +227,9 @@ u32 attribute((pure)) crc32_be(u32 crc, unsigned char const *p, size_t len) ...@@ -221,7 +227,9 @@ u32 attribute((pure)) crc32_be(u32 crc, unsigned char const *p, size_t len)
/* And the last few bytes */ /* And the last few bytes */
if(len){ if(len){
do { do {
DO_CRC(*((u8 *)b)++); u8 *p = (u8 *)b;
DO_CRC(*p++);
b = (void *)p;
} while (--len); } while (--len);
} }
return __be32_to_cpu(crc); return __be32_to_cpu(crc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment