[PATCH 1/6] Add INLINE_SYSCALL_RETURN/INLINE_SYSCALL_ERROR_RETURN

H.J. Lu hjl.tools@gmail.com
Fri Aug 14 17:42:00 GMT 2015


On Fri, Aug 14, 2015 at 10:39 AM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> "H.J. Lu" <hjl.tools@gmail.com> writes:
>
>> +#define INLINE_SYSCALL_RETURN(name, nr, type, args...) \
>> +  do                                                         \
>> +    {                                                                \
>> +      return (type) INLINE_SYSCALL (name, nr, args);         \
>> +    }                                                                \
>> +  while (0)
>
> There is no point for using do while here.

I can use

#define INLINE_SYSCALL_RETURN(name, nr, type, args...)  \
   return (type) INLINE_SYSCALL (name, nr, args)

>
> Also, I don't like the hiding of return in the macro.

i386 version isn't a simple return:

#define INLINE_SYSCALL_RETURN(name, nr, type, args...) \
  do                                                                    \
    {                                                                   \
      unsigned int resultvar = INTERNAL_SYSCALL (name, , nr, args);     \
      if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (resultvar, )))    \
        INLINE_SYSCALL_ERROR_RETURN (resultvar, type, );                \
      return (type) resultvar;                                          \
    }                                                                   \
  while (0)

What is your suggestion?

-- 
H.J.



More information about the Libc-alpha mailing list