summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2012-01-26 15:15:23 +0100
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2012-01-26 15:15:23 +0100
commit549fa53225910f5341092d6647a1e3dd705b605f (patch)
tree04a37070ddefbeeb9def964aa2690d9d75e4c756 /libc
parentba48da4e3c8aa2478f30f7e3b745f3a355ed9442 (diff)
*: silence some warnings
warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'libc')
-rw-r--r--libc/sysdeps/linux/alpha/bits/syscalls.h15
-rw-r--r--libc/sysdeps/linux/arm/bits/syscalls.h26
-rw-r--r--libc/sysdeps/linux/avr32/bits/syscalls.h5
-rw-r--r--libc/sysdeps/linux/bfin/bits/syscalls.h7
-rw-r--r--libc/sysdeps/linux/c6x/bits/syscalls.h5
-rw-r--r--libc/sysdeps/linux/common/bits/syscalls-common.h22
-rw-r--r--libc/sysdeps/linux/cris/bits/syscalls.h5
-rw-r--r--libc/sysdeps/linux/hppa/bits/syscalls.h12
-rw-r--r--libc/sysdeps/linux/i386/bits/syscalls.h7
-rw-r--r--libc/sysdeps/linux/ia64/bits/syscalls.h11
-rw-r--r--libc/sysdeps/linux/m68k/bits/syscalls.h6
-rw-r--r--libc/sysdeps/linux/microblaze/bits/syscalls.h5
-rw-r--r--libc/sysdeps/linux/nios2/bits/syscalls.h4
-rw-r--r--libc/sysdeps/linux/powerpc/bits/syscalls.h5
-rw-r--r--libc/sysdeps/linux/sh/bits/syscalls.h25
-rw-r--r--libc/sysdeps/linux/sparc/bits/syscalls.h5
-rw-r--r--libc/sysdeps/linux/x86_64/bits/syscalls.h8
-rw-r--r--libc/sysdeps/linux/xtensa/bits/syscalls.h6
18 files changed, 111 insertions, 68 deletions
diff --git a/libc/sysdeps/linux/alpha/bits/syscalls.h b/libc/sysdeps/linux/alpha/bits/syscalls.h
index ee56788a6..7ffd0253c 100644
--- a/libc/sysdeps/linux/alpha/bits/syscalls.h
+++ b/libc/sysdeps/linux/alpha/bits/syscalls.h
@@ -27,25 +27,28 @@
#ifndef __ASSEMBLER__
#define INLINE_SYSCALL_NCS(name, nr, args...) \
-({ \
+(__extension__ \
+ ({ \
long _sc_ret, _sc_err; \
inline_syscall##nr(name, args); \
- if (__builtin_expect (_sc_err, 0)) \
+ if (unlikely (_sc_err)) \
{ \
__set_errno (_sc_ret); \
_sc_ret = -1L; \
} \
_sc_ret; \
-})
+ }) \
+)
#define INTERNAL_SYSCALL_NCS(name, err_out, nr, args...) \
-({ \
+(__extension__ \
+ ({ \
long _sc_ret, _sc_err; \
inline_syscall##nr(name, args); \
err_out = _sc_err; \
_sc_ret; \
-})
-
+ }) \
+)
#define INTERNAL_SYSCALL_DECL(err) long int err
#define INTERNAL_SYSCALL_ERROR_P(val, err) err
#define INTERNAL_SYSCALL_ERRNO(val, err) val
diff --git a/libc/sysdeps/linux/arm/bits/syscalls.h b/libc/sysdeps/linux/arm/bits/syscalls.h
index 92bba7da3..6b747d91b 100644
--- a/libc/sysdeps/linux/arm/bits/syscalls.h
+++ b/libc/sysdeps/linux/arm/bits/syscalls.h
@@ -31,17 +31,22 @@
#include <errno.h>
#define INLINE_SYSCALL_NCS(name, nr, args...) \
- ({ unsigned int _inline_sys_result = INTERNAL_SYSCALL_NCS (name, , nr, args); \
- if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_inline_sys_result, ), 0)) \
+(__extension__ \
+ ({ \
+ unsigned int _inline_sys_result = INTERNAL_SYSCALL_NCS (name, , nr, args);\
+ if (unlikely (INTERNAL_SYSCALL_ERROR_P (_inline_sys_result, ))) \
{ \
- __set_errno (INTERNAL_SYSCALL_ERRNO (_inline_sys_result, )); \
- _inline_sys_result = (unsigned int) -1; \
+ __set_errno (INTERNAL_SYSCALL_ERRNO (_inline_sys_result, )); \
+ _inline_sys_result = (unsigned int) -1; \
} \
- (int) _inline_sys_result; })
+ (int) _inline_sys_result; \
+ }) \
+)
#if !defined(__thumb__)
#if defined(__ARM_EABI__)
#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
+(__extension__ \
({unsigned int __internal_sys_result; \
{ \
register int __a1 __asm__ ("r0"), _nr __asm__ ("r7"); \
@@ -53,10 +58,12 @@
: "memory"); \
__internal_sys_result = __a1; \
} \
- (int) __internal_sys_result; })
+ (int) __internal_sys_result; }) \
+)
#else /* defined(__ARM_EABI__) */
#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
+(__extension__ \
({ unsigned int __internal_sys_result; \
{ \
register int __a1 __asm__ ("a1"); \
@@ -67,13 +74,15 @@
: "memory"); \
__internal_sys_result = __a1; \
} \
- (int) __internal_sys_result; })
+ (int) __internal_sys_result; }) \
+)
#endif
#else /* !defined(__thumb__) */
/* We can't use push/pop inside the asm because that breaks
unwinding (ie. thread cancellation).
*/
#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
+(__extension__ \
({ unsigned int __internal_sys_result; \
{ \
int _sys_buf[2]; \
@@ -90,7 +99,8 @@
: "memory"); \
__internal_sys_result = __a1; \
} \
- (int) __internal_sys_result; })
+ (int) __internal_sys_result; }) \
+)
#endif /*!defined(__thumb__)*/
#define INTERNAL_SYSCALL_ERROR_P(val, err) \
diff --git a/libc/sysdeps/linux/avr32/bits/syscalls.h b/libc/sysdeps/linux/avr32/bits/syscalls.h
index 836cb2d76..70dc1d958 100644
--- a/libc/sysdeps/linux/avr32/bits/syscalls.h
+++ b/libc/sysdeps/linux/avr32/bits/syscalls.h
@@ -9,6 +9,7 @@
#include <errno.h>
#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
+(__extension__ \
({ \
register int __a1 __asm__("r12"); \
register int _scno __asm__("r8") = name; \
@@ -18,8 +19,8 @@
: "r"(_scno) ASM_ARGS_##nr \
: "cc", "memory"); \
__a1; \
- })
-
+ }) \
+)
#define INTERNAL_SYSCALL_ERROR_P(val, err) \
((unsigned int)(val) >= 0xfffff001U)
diff --git a/libc/sysdeps/linux/bfin/bits/syscalls.h b/libc/sysdeps/linux/bfin/bits/syscalls.h
index 6230b03d8..da549ff58 100644
--- a/libc/sysdeps/linux/bfin/bits/syscalls.h
+++ b/libc/sysdeps/linux/bfin/bits/syscalls.h
@@ -7,7 +7,8 @@
#ifndef __ASSEMBLER__
#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
-({ \
+(__extension__ \
+ ({ \
long __res; \
__asm__ __volatile__ ( \
"excpt 0;\n\t" \
@@ -15,8 +16,8 @@
: "qA" (name) ASMFMT_##nr(args) \
: "memory","CC"); \
__res; \
-})
-
+ }) \
+)
#define ASMFMT_0()
#define ASMFMT_1(arg1) \
diff --git a/libc/sysdeps/linux/c6x/bits/syscalls.h b/libc/sysdeps/linux/c6x/bits/syscalls.h
index 56a1667c3..504d0c36d 100644
--- a/libc/sysdeps/linux/c6x/bits/syscalls.h
+++ b/libc/sysdeps/linux/c6x/bits/syscalls.h
@@ -58,6 +58,7 @@
#define INTERNAL_SYSCALL_NCS(sys_num, err, nr, args...) \
+(__extension__ \
({ \
register long __A4 __asm__("A4"); \
register long __b0 __asm__("B0") = sys_num; \
@@ -67,8 +68,8 @@
: "b" (__b0) ASM_ARGS_##nr \
: __SYSCALL_CLOBBERS ); \
(int)__A4; \
- })
-
+ }) \
+)
#undef INTERNAL_SYSCALL_ERROR_P
#define INTERNAL_SYSCALL_ERROR_P(val, err) \
((unsigned int) (val) >= 0xfffff001u)
diff --git a/libc/sysdeps/linux/common/bits/syscalls-common.h b/libc/sysdeps/linux/common/bits/syscalls-common.h
index 1b84d9e2b..faebd1b71 100644
--- a/libc/sysdeps/linux/common/bits/syscalls-common.h
+++ b/libc/sysdeps/linux/common/bits/syscalls-common.h
@@ -40,21 +40,27 @@
/* Just like INLINE_SYSCALL(), but take a non-constant syscall (NCS) argument */
#ifndef INLINE_SYSCALL_NCS
# define INLINE_SYSCALL_NCS(name, nr, args...) \
-({ \
+(__extension__ \
+ ({ \
INTERNAL_SYSCALL_DECL(__err); \
- long __res = INTERNAL_SYSCALL_NCS(name, __err, nr, args); \
- if (unlikely(INTERNAL_SYSCALL_ERROR_P(__res, __err))) { \
+ (__extension__ \
+ ({ \
+ long __res = INTERNAL_SYSCALL_NCS(name, __err, nr, args); \
+ if (unlikely(INTERNAL_SYSCALL_ERROR_P(__res, __err))) { \
__set_errno(INTERNAL_SYSCALL_ERRNO(__res, __err)); \
__res = -1L; \
- } \
- __res; \
-})
+ } \
+ __res; \
+ }) \
+ ); \
+ }) \
+)
#endif
#ifndef INLINE_SYSCALL_NOERR_NCS
# define INLINE_SYSCALL_NOERR_NCS(name, nr, args...) \
({ \
- INTERNAL_SYSCALL_DECL(__err); \
- long __res = INTERNAL_SYSCALL_NCS(name, __err, nr, args); \
+ /*INTERNAL_SYSCALL_DECL(__err);*/ \
+ long __res = INTERNAL_SYSCALL_NCS(name, /*__err*/, nr, args); \
__res; \
})
#endif
diff --git a/libc/sysdeps/linux/cris/bits/syscalls.h b/libc/sysdeps/linux/cris/bits/syscalls.h
index 9db08407c..cb2f41cf7 100644
--- a/libc/sysdeps/linux/cris/bits/syscalls.h
+++ b/libc/sysdeps/linux/cris/bits/syscalls.h
@@ -8,6 +8,7 @@
#ifndef __ASSEMBLER__
#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
+(__extension__ \
({ \
register unsigned long __res __asm__ ("r10"); \
LOAD_ARGS_c_##nr(args) \
@@ -20,8 +21,8 @@
: ASM_ARGS_##nr (args) \
: ASM_CLOBBER_##nr); \
__res; \
- })
-
+ }) \
+)
#define LOAD_ARGS_c_0()
#define LOAD_ARGS_asm_0()
#define ASM_CLOBBER_0 "memory"
diff --git a/libc/sysdeps/linux/hppa/bits/syscalls.h b/libc/sysdeps/linux/hppa/bits/syscalls.h
index 783ed3246..fddad622d 100644
--- a/libc/sysdeps/linux/hppa/bits/syscalls.h
+++ b/libc/sysdeps/linux/hppa/bits/syscalls.h
@@ -38,9 +38,11 @@
across the syscall. */
#define K_CALL_CLOB_REGS "%r1", "%r2", K_USING_GR4 \
- "%r20", "%r29", "%r31"
+ "%r20", "%r29", "%r31"
-#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) ({ \
+#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
+(__extension__ \
+ ({ \
register unsigned long __res __asm__("r28"); \
K_LOAD_ARGS_##nr(args) \
/* FIXME: HACK stw/ldw r19 around syscall */ \
@@ -50,12 +52,12 @@
" ldi %1, %%r20\n" \
K_LDW_ASM_PIC \
: "=r" (__res) \
- : "i" (name) K_ASM_ARGS_##nr \
+ : "i" (name) K_ASM_ARGS_##nr \
: "memory", K_CALL_CLOB_REGS K_CLOB_ARGS_##nr \
); \
__res; \
-})
-
+ }) \
+)
#define K_LOAD_ARGS_0()
#define K_LOAD_ARGS_1(r26) \
register unsigned long __r26 __asm__("r26") = (unsigned long)(r26); \
diff --git a/libc/sysdeps/linux/i386/bits/syscalls.h b/libc/sysdeps/linux/i386/bits/syscalls.h
index eeafb3a48..9fb4f35a9 100644
--- a/libc/sysdeps/linux/i386/bits/syscalls.h
+++ b/libc/sysdeps/linux/i386/bits/syscalls.h
@@ -15,7 +15,8 @@
#include <errno.h>
#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
-({ \
+(__extension__ \
+ ({ \
register unsigned int resultvar; \
__asm__ __volatile__ ( \
LOADARGS_##nr \
@@ -26,8 +27,8 @@
: "g" (name) ASMFMT_##nr(args) : "memory", "cc" \
); \
(int) resultvar; \
-})
-
+ }) \
+)
#if 1 /* defined __PIC__ || defined __pic__ */
diff --git a/libc/sysdeps/linux/ia64/bits/syscalls.h b/libc/sysdeps/linux/ia64/bits/syscalls.h
index 90297596b..ae09687de 100644
--- a/libc/sysdeps/linux/ia64/bits/syscalls.h
+++ b/libc/sysdeps/linux/ia64/bits/syscalls.h
@@ -62,6 +62,7 @@
_retval = _r8;
#define INLINE_SYSCALL_NCS(name, nr, args...) \
+(__extension__ \
({ \
DO_INLINE_SYSCALL_NCS (name, nr, args) \
if (unlikely (_r10 == -1)) \
@@ -69,16 +70,20 @@
__set_errno (_retval); \
_retval = -1; \
} \
- _retval; })
+ _retval; \
+ }) \
+)
#define INTERNAL_SYSCALL_DECL(err) long int err
#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
+(__extension__ \
({ \
DO_INLINE_SYSCALL_NCS (name, nr, args) \
err = _r10; \
- _retval; })
-
+ _retval; \
+ }) \
+)
#define INTERNAL_SYSCALL_ERROR_P(val, err) (err == -1)
#define INTERNAL_SYSCALL_ERRNO(val, err) (val)
diff --git a/libc/sysdeps/linux/m68k/bits/syscalls.h b/libc/sysdeps/linux/m68k/bits/syscalls.h
index 2c56613e4..17966ed06 100644
--- a/libc/sysdeps/linux/m68k/bits/syscalls.h
+++ b/libc/sysdeps/linux/m68k/bits/syscalls.h
@@ -45,6 +45,7 @@
normally. It will never touch errno. This returns just what the kernel
gave back. */
#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
+(__extension__ \
({ unsigned int _sys_result; \
{ \
/* Load argument values in temporary variables
@@ -59,8 +60,9 @@
: "memory"); \
_sys_result = _d0; \
} \
- (int) _sys_result; })
-
+ (int) _sys_result; \
+ }) \
+)
#define LOAD_ARGS_0()
#define LOAD_REGS_0
#define ASM_ARGS_0
diff --git a/libc/sysdeps/linux/microblaze/bits/syscalls.h b/libc/sysdeps/linux/microblaze/bits/syscalls.h
index f4bdc4522..535502b86 100644
--- a/libc/sysdeps/linux/microblaze/bits/syscalls.h
+++ b/libc/sysdeps/linux/microblaze/bits/syscalls.h
@@ -10,6 +10,7 @@
#include <errno.h>
#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
+(__extension__ \
({ \
register int __ret __asm__("r3"); \
register int _scno __asm__("r12") = name; \
@@ -19,8 +20,8 @@
: "r"(_scno) ASM_ARGS_##nr \
: __SYSCALL_CLOBBERS ); \
__ret; \
- })
-
+ }) \
+)
#define INTERNAL_SYSCALL_ERROR_P(val, err) \
((unsigned int)(val) >= 0xfffff001U)
diff --git a/libc/sysdeps/linux/nios2/bits/syscalls.h b/libc/sysdeps/linux/nios2/bits/syscalls.h
index f80bea206..3214e3ce2 100644
--- a/libc/sysdeps/linux/nios2/bits/syscalls.h
+++ b/libc/sysdeps/linux/nios2/bits/syscalls.h
@@ -19,6 +19,7 @@
} while (0)
#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
+(__extension__ \
({ \
long __res; \
__asm__ __volatile__ ( \
@@ -36,7 +37,8 @@
CLOB_ARGS_##nr /* Clobbered */ \
); \
__res; \
- })
+ }) \
+)
#define INTERNAL_SYSCALL_ERROR_P(val, err) \
((unsigned long)(val) >= (unsigned long)(-125))
diff --git a/libc/sysdeps/linux/powerpc/bits/syscalls.h b/libc/sysdeps/linux/powerpc/bits/syscalls.h
index 1c7b929b2..3e52b5d4f 100644
--- a/libc/sysdeps/linux/powerpc/bits/syscalls.h
+++ b/libc/sysdeps/linux/powerpc/bits/syscalls.h
@@ -141,6 +141,7 @@
# define INTERNAL_SYSCALL_DECL(err) long int err
# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
+(__extension__ \
({ \
register long int r0 __asm__ ("r0"); \
register long int r3 __asm__ ("r3"); \
@@ -164,8 +165,8 @@
: "cr0", "ctr", "memory"); \
err = r0; \
(int) r3; \
- })
-
+ }) \
+)
# define INTERNAL_SYSCALL_ERROR_P(val, err) \
((void) (val), __builtin_expect ((err) & (1 << 28), 0))
diff --git a/libc/sysdeps/linux/sh/bits/syscalls.h b/libc/sysdeps/linux/sh/bits/syscalls.h
index 59d2d1ec7..b308276c5 100644
--- a/libc/sysdeps/linux/sh/bits/syscalls.h
+++ b/libc/sysdeps/linux/sh/bits/syscalls.h
@@ -114,18 +114,19 @@
/* The _NCS variant allows non-constant syscall numbers. */
#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
- ({ \
- unsigned long int resultvar; \
- register long int r3 __asm__ ("%r3") = (name); \
- SUBSTITUTE_ARGS_##nr(args); \
- \
- __asm__ __volatile__ (SYSCALL_INST_STR##nr SYSCALL_INST_PAD \
- : "=z" (resultvar) \
- : "r" (r3) ASMFMT_##nr \
- : "memory"); \
- \
- (int) resultvar; })
-
+(__extension__ \
+ ({ \
+ unsigned long int resultvar; \
+ register long int r3 __asm__ ("%r3") = (name); \
+ SUBSTITUTE_ARGS_##nr(args); \
+ __asm__ __volatile__ (SYSCALL_INST_STR##nr SYSCALL_INST_PAD \
+ : "=z" (resultvar) \
+ : "r" (r3) ASMFMT_##nr \
+ : "memory" \
+ ); \
+ (int) resultvar; \
+ }) \
+)
#define INTERNAL_SYSCALL_ERROR_P(val, err) \
((unsigned int) (val) >= 0xfffff001u)
diff --git a/libc/sysdeps/linux/sparc/bits/syscalls.h b/libc/sysdeps/linux/sparc/bits/syscalls.h
index dc8d63713..948c2fa3e 100644
--- a/libc/sysdeps/linux/sparc/bits/syscalls.h
+++ b/libc/sysdeps/linux/sparc/bits/syscalls.h
@@ -36,6 +36,7 @@
#endif
#define INTERNAL_SYSCALL_NCS(sys_num, err, nr, args...) \
+(__extension__ \
({ \
unsigned int __res; \
{ \
@@ -48,8 +49,8 @@
: __SYSCALL_CLOBBERS ); \
} \
(int)__res; \
- })
-
+ }) \
+)
#define INTERNAL_SYSCALL_ERROR_P(val, err) \
((unsigned int) (val) >= 0xfffff001u)
diff --git a/libc/sysdeps/linux/x86_64/bits/syscalls.h b/libc/sysdeps/linux/x86_64/bits/syscalls.h
index 8042ab8b9..e4ea4d833 100644
--- a/libc/sysdeps/linux/x86_64/bits/syscalls.h
+++ b/libc/sysdeps/linux/x86_64/bits/syscalls.h
@@ -67,16 +67,18 @@
/* Define a macro which expands inline into the wrapper code for a system
call. */
#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
+(__extension__ \
({ \
unsigned long resultvar; \
LOAD_ARGS_##nr (args) \
LOAD_REGS_##nr \
- __asm__ __volatile__ ( \
+ __asm__ __volatile__ ( \
"syscall\n\t" \
: "=a" (resultvar) \
: "0" (name) ASM_ARGS_##nr : "memory", "cc", "r11", "cx"); \
- (long) resultvar; })
-
+ (long) resultvar; \
+ }) \
+)
#define LOAD_ARGS_0()
#define LOAD_REGS_0
#define ASM_ARGS_0
diff --git a/libc/sysdeps/linux/xtensa/bits/syscalls.h b/libc/sysdeps/linux/xtensa/bits/syscalls.h
index cc6c41e10..7e900c590 100644
--- a/libc/sysdeps/linux/xtensa/bits/syscalls.h
+++ b/libc/sysdeps/linux/xtensa/bits/syscalls.h
@@ -73,13 +73,15 @@
call. */
#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
+(__extension__ \
({ LD_ARG(2, name); \
LD_ARGS_##nr(args); \
__asm__ __volatile__ ("syscall\n" \
: "=a" (_a2) \
: ASM_ARGS_##nr \
: "memory"); \
- (long) _a2; })
-
+ (long) _a2; \
+ }) \
+)
#endif /* not __ASSEMBLER__ */
#endif /* _BITS_SYSCALLS_H */