Message ID | 552EC85A.8060505@linaro.org |
---|---|
State | New |
Headers | show |
> * sysdeps/unix/sysv/linux/alpha/sysdep.h [INLINE_VSYSCALL]: Define > INLINE_SYSCALL. The [foo] syntax corresponds to an '#if foo' block. The (foo) syntax is what you use when foo is what you touched, whether it's a function, variable, macro, type, or whatever. A coherent entry for what the change actually does would be: * sysdeps/unix/sysv/linux/alpha/sysdep.h (INLINE_VSYSCALL): New macro; just use INLINE_SYSCALL. But repeating boilerplate like this across a lot of sysdeps files is usually a sign that you're doing it wrong. Why not instead have some common place that does: #ifndef INLINE_VSYSCALL # define INLINE_VSYSCALL INLINE_SYSCALL #endif ?
On 15 Apr 2015 17:21, Adhemerval Zanella wrote: > --- a/sysdeps/unix/sysv/linux/nios2/sysdep.h > +++ b/sysdeps/unix/sysv/linux/nios2/sysdep.h > > +#undef INLINE_VSYSCALL > +#define INLINE_VSYSCALL(name, nr, args...) \ > + INLINE_SYSCALL (name, nr, ##args) this one has odd indent compared to all the rest -mike
Hi On 15-04-2015 19:26, Roland McGrath wrote: >> * sysdeps/unix/sysv/linux/alpha/sysdep.h [INLINE_VSYSCALL]: Define >> INLINE_SYSCALL. > > The [foo] syntax corresponds to an '#if foo' block. The (foo) syntax is > what you use when foo is what you touched, whether it's a function, > variable, macro, type, or whatever. A coherent entry for what the change > actually does would be: > > * sysdeps/unix/sysv/linux/alpha/sysdep.h (INLINE_VSYSCALL): > New macro; just use INLINE_SYSCALL. Right, I will change it. > > But repeating boilerplate like this across a lot of sysdeps files is > usually a sign that you're doing it wrong. Why not instead have some > common place that does: > > #ifndef INLINE_VSYSCALL > # define INLINE_VSYSCALL INLINE_SYSCALL > #endif > > ? > That is my idea of a subsequent patch, however seems that a more comprehensible refactor will be better. I am withdrawing this patch and I will send another one soon.
diff --git a/sysdeps/unix/sysv/linux/alpha/sysdep.h b/sysdeps/unix/sysv/linux/alpha/sysdep.h index a95b113..422f7e4 100644 --- a/sysdeps/unix/sysv/linux/alpha/sysdep.h +++ b/sysdeps/unix/sysv/linux/alpha/sysdep.h @@ -84,6 +84,10 @@ INLINE_SYSCALL1(name, nr, args); \ }) +#undef INLINE_VSYSCALL +#define INLINE_VSYSCALL(name, nr, args...) \ + INLINE_SYSCALL (name, nr, ##args) + #undef INTERNAL_SYSCALL #define INTERNAL_SYSCALL(name, err_out, nr, args...) \ ({ \ diff --git a/sysdeps/unix/sysv/linux/arm/sysdep.h b/sysdeps/unix/sysv/linux/arm/sysdep.h index 37eac19..15bc357 100644 --- a/sysdeps/unix/sysv/linux/arm/sysdep.h +++ b/sysdeps/unix/sysv/linux/arm/sysdep.h @@ -328,6 +328,10 @@ __local_syscall_error: \ } \ (int) _sys_result; }) +#undef INLINE_VSYSCALL +#define INLINE_VSYSCALL(name, nr, args...) \ + INLINE_SYSCALL (name, nr, ##args) + #undef INTERNAL_SYSCALL_DECL #define INTERNAL_SYSCALL_DECL(err) do { } while (0) diff --git a/sysdeps/unix/sysv/linux/hppa/sysdep.h b/sysdeps/unix/sysv/linux/hppa/sysdep.h index ac47814..f7aa68e 100644 --- a/sysdeps/unix/sysv/linux/hppa/sysdep.h +++ b/sysdeps/unix/sysv/linux/hppa/sysdep.h @@ -386,6 +386,10 @@ L(pre_end): ASM_LINE_SEP \ __sys_res; \ }) +#undef INLINE_VSYSCALL +#define INLINE_VSYSCALL(name, nr, args...) \ + INLINE_SYSCALL (name, nr, ##args) + /* INTERNAL_SYSCALL_DECL - Allows us to setup some function static value to use within the context of the syscall INTERNAL_SYSCALL_ERROR_P - Returns 0 if it wasn't an error, 1 otherwise diff --git a/sysdeps/unix/sysv/linux/ia64/sysdep.h b/sysdeps/unix/sysv/linux/ia64/sysdep.h index 03efae9..da9b1b11 100644 --- a/sysdeps/unix/sysv/linux/ia64/sysdep.h +++ b/sysdeps/unix/sysv/linux/ia64/sysdep.h @@ -251,6 +251,10 @@ } \ _retval; }) +#undef INLINE_VSYSCALL +#define INLINE_VSYSCALL(name, nr, args...) \ + INLINE_SYSCALL (name, nr, ##args) + #undef INTERNAL_SYSCALL_DECL #define INTERNAL_SYSCALL_DECL(err) long int err __attribute__ ((unused)) diff --git a/sysdeps/unix/sysv/linux/m68k/sysdep.h b/sysdeps/unix/sysv/linux/m68k/sysdep.h index 2b88add..3760452 100644 --- a/sysdeps/unix/sysv/linux/m68k/sysdep.h +++ b/sysdeps/unix/sysv/linux/m68k/sysdep.h @@ -266,6 +266,10 @@ SYSCALL_ERROR_LABEL: \ #undef INTERNAL_SYSCALL_ERRNO #define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) +#undef INLINE_VSYSCALL +#define INLINE_VSYSCALL(name, nr, args...) \ + INLINE_SYSCALL (name, nr, ##args) + #define LOAD_ARGS_0() #define LOAD_REGS_0 #define ASM_ARGS_0 diff --git a/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h index e5025ba..2fa2d31 100644 --- a/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h +++ b/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h @@ -67,6 +67,10 @@ #undef INTERNAL_SYSCALL_ERRNO #define INTERNAL_SYSCALL_ERRNO(val, err) ((void) (err), val) +#undef INLINE_VSYSCALL +#define INLINE_VSYSCALL(name, nr, args...) \ + INLINE_SYSCALL (name, nr, ##args) + /* Note that the original Linux syscall restart convention required the instruction immediately preceding SYSCALL to initialize $v0 with the syscall number. Then if a restart triggered, $v0 would have been diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h index ac663bc..7ccc9d3 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h +++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h @@ -69,6 +69,10 @@ #undef INTERNAL_SYSCALL_ERRNO #define INTERNAL_SYSCALL_ERRNO(val, err) ((void) (err), val) +#undef INLINE_VSYSCALL +#define INLINE_VSYSCALL(name, nr, args...) \ + INLINE_SYSCALL (name, nr, ##args) + /* Note that the original Linux syscall restart convention required the instruction immediately preceding SYSCALL to initialize $v0 with the syscall number. Then if a restart triggered, $v0 would have been diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h index 312f210..e05ec07 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h +++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h @@ -65,6 +65,10 @@ #undef INTERNAL_SYSCALL_ERRNO #define INTERNAL_SYSCALL_ERRNO(val, err) ((void) (err), val) +#undef INLINE_VSYSCALL +#define INLINE_VSYSCALL(name, nr, args...) \ + INLINE_SYSCALL (name, nr, ##args) + /* Note that the original Linux syscall restart convention required the instruction immediately preceding SYSCALL to initialize $v0 with the syscall number. Then if a restart triggered, $v0 would have been diff --git a/sysdeps/unix/sysv/linux/nios2/sysdep.h b/sysdeps/unix/sysv/linux/nios2/sysdep.h index 66a77f4..8cbeb42 100644 --- a/sysdeps/unix/sysv/linux/nios2/sysdep.h +++ b/sysdeps/unix/sysv/linux/nios2/sysdep.h @@ -190,6 +190,10 @@ #define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \ INTERNAL_SYSCALL_RAW(number, err, nr, args) +#undef INLINE_VSYSCALL +#define INLINE_VSYSCALL(name, nr, args...) \ + INLINE_SYSCALL (name, nr, ##args) + #define LOAD_ARGS_0() #define LOAD_REGS_0 #define ASM_ARGS_0 diff --git a/sysdeps/unix/sysv/linux/sh/sysdep.h b/sysdeps/unix/sysv/linux/sh/sysdep.h index 5226ff6..041d1e8 100644 --- a/sysdeps/unix/sysv/linux/sh/sysdep.h +++ b/sysdeps/unix/sysv/linux/sh/sysdep.h @@ -297,6 +297,10 @@ } \ (int) resultvar; }) +#undef INLINE_VSYSCALL +#define INLINE_VSYSCALL(name, nr, args...) \ + INLINE_SYSCALL (name, nr, ##args) + #undef INTERNAL_SYSCALL #define INTERNAL_SYSCALL(name, err, nr, args...) \ ({ \ diff --git a/sysdeps/unix/sysv/linux/sparc/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sysdep.h index e215dbb..db4b993 100644 --- a/sysdeps/unix/sysv/linux/sparc/sysdep.h +++ b/sysdeps/unix/sysv/linux/sparc/sysdep.h @@ -45,6 +45,10 @@ (long) resultvar; \ }) +#undef INLINE_VSYSCALL +#define INLINE_VSYSCALL(name, nr, args...) \ + INLINE_SYSCALL (name, nr, ##args) + #undef INTERNAL_SYSCALL_DECL #define INTERNAL_SYSCALL_DECL(err) \ register long err __asm__("g1");