diff options
author | David S. Miller <davem@davemloft.net> | 2012-03-06 11:15:26 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-03-06 11:15:26 -0800 |
commit | e92584001a07a7e1a4ad2a4997a429075d36e76a (patch) | |
tree | c967f50060e192e59ecd382cd10fdeed52d28d68 /sysdeps/unix/sysv/linux/sparc | |
parent | f3caba873e7d6952fe4945e2bf222cd4d40cf5c7 (diff) | |
download | glibc-e92584001a07a7e1a4ad2a4997a429075d36e76a.tar.gz glibc-e92584001a07a7e1a4ad2a4997a429075d36e76a.tar.xz glibc-e92584001a07a7e1a4ad2a4997a429075d36e76a.zip |
Fix several build warnings on sparc.
/ * sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c (set_obp_int): New function. (get_obp_int): New function. (__get_clockfreq_via_dev_openprom): Likewise. * sysdeps/unix/sysv/linux/sparc/sysdep.h (INTERNAL_SYSCALL_ERROR_P): Avoid unused variable warnings on 'val' and use builtin_expect. (INLINE_SYSCALL): Don't wrap INTERNAL_SYSCALL_ERROR_P with builtin_expect. (INLINE_CLONE_SYSCALL): Likewise. nptl/ * sysdeps/unix/sysv/linux/sparc/sem_post.c (__new_sem_post): Use atomic_increment and remove unused local variable. (__old_sem_post): Likewise.
Diffstat (limited to 'sysdeps/unix/sysv/linux/sparc')
-rw-r--r-- | sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c | 27 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sparc/sysdep.h | 7 |
2 files changed, 25 insertions, 9 deletions
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c b/sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c index e181d9d36b..ba44a61c86 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c @@ -154,6 +154,22 @@ __get_clockfreq_via_proc_openprom (void) return result; } +static void set_obp_int (struct openpromio *op, int val) +{ + char *cp = op->oprom_array; + int *ip = (int *) cp; + + *ip = val; +} + +static int get_obp_int (struct openpromio *op) +{ + char *cp = op->oprom_array; + int *ip = (int *) cp; + + return *ip; +} + static hp_timing_t __get_clockfreq_via_dev_openprom (void) { @@ -171,11 +187,11 @@ __get_clockfreq_via_dev_openprom (void) obp_cmd->oprom_size = sizeof (obp_buf) - sizeof (unsigned int); - *(int *) obp_cmd->oprom_array = 0; + set_obp_int (obp_cmd, 0); ret = ioctl (obp_dev_fd, OPROMCHILD, (char *) obp_cmd); if (ret == 0) { - int cur_node = *(int *) obp_cmd->oprom_array; + int cur_node = get_obp_int (obp_cmd); while (cur_node != 0 && cur_node != -1) { @@ -190,15 +206,14 @@ __get_clockfreq_via_dev_openprom (void) strcpy (obp_cmd->oprom_array, "clock-frequency"); ret = ioctl (obp_dev_fd, OPROMGETPROP, (char *) obp_cmd); if (ret == 0) - result = - (hp_timing_t) *(unsigned int *) obp_cmd->oprom_array; + result = (hp_timing_t) get_obp_int (obp_cmd); } obp_cmd->oprom_size = sizeof (obp_buf) - sizeof (unsigned int); - *(int *) obp_cmd->oprom_array = cur_node; + set_obp_int (obp_cmd, cur_node); ret = ioctl (obp_dev_fd, OPROMNEXT, (char *) obp_cmd); if (ret < 0) break; - cur_node = *(int *)obp_cmd->oprom_array; + cur_node = get_obp_int (obp_cmd); } } } diff --git a/sysdeps/unix/sysv/linux/sparc/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sysdep.h index 336c8538b5..30144b9f6d 100644 --- a/sysdeps/unix/sysv/linux/sparc/sysdep.h +++ b/sysdeps/unix/sysv/linux/sparc/sysdep.h @@ -23,7 +23,7 @@ #define INLINE_SYSCALL(name, nr, args...) \ ({ INTERNAL_SYSCALL_DECL(err); \ unsigned int resultvar = INTERNAL_SYSCALL(name, err, nr, args); \ - if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (resultvar, err), 0)) \ + if (INTERNAL_SYSCALL_ERROR_P (resultvar, err)) \ { \ __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, err)); \ resultvar = 0xffffffff; \ @@ -44,7 +44,8 @@ inline_syscall##nr(__SYSCALL_STRING, err, name, args) #undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) ((err) != 0) +#define INTERNAL_SYSCALL_ERROR_P(val, err) \ + ((void) (val), __builtin_expect((err) != 0, 0)) #undef INTERNAL_SYSCALL_ERRNO #define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) @@ -152,7 +153,7 @@ "0" (__g1), "1" (__o0), "2" (__o1), \ "r" (__o2), "r" (__o3), "r" (__o4) : \ __SYSCALL_CLOBBERS); \ - if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (__o0, __g1), 0)) \ + if (INTERNAL_SYSCALL_ERROR_P (__o0, __g1)) \ { \ __set_errno (INTERNAL_SYSCALL_ERRNO (__o0, __g1)); \ __o0 = -1L; \ |