[haiku-gsoc] Re: Xsi semaphorses: patch #1

  • From: Ingo Weinhold <ingo_weinhold@xxxxxx>
  • To: haiku-gsoc@xxxxxxxxxxxxx
  • Date: Mon, 14 Jul 2008 14:19:52 +0200

On 2008-07-14 at 11:10:46 [+0200], Salvatore Benedetto <emitrax@xxxxxxxxx> 
wrote:
> 2008/7/13 Stephan Assmus <superstippi@xxxxxx>:
> >
> > -------- Original-Nachricht --------
> >> Datum: Sun, 13 Jul 2008 23:12:05 +0200 CEST
> >> Von: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
> >> An: haiku-gsoc@xxxxxxxxxxxxx
> >> Betreff: [haiku-gsoc] Re: Xsi semaphorses: patch #1
> >
> >> Stephan Assmus <superstippi@xxxxxx> wrote:
> >> > I have a question about the patch:
> >> >
> >> > +#define RETURN_AND_SET_ERRNO(status) \
> >> > [...]
> >> >
> >> > With how the macro "RETURN_AND_SET_ERRNO" is defined, wouldn't it
> >> > result in
> >> > the function that you pass to the marco being called twice?
> >>
> >> Definitely, nice catch!
> >
> > Maybe we should grep the source for that one, I have a faint memory of 
> > having seen this macro before. ;-)
> 
> In fact you have a good memory. That's one of the many
> RETURN_AND_SET_ERRNO macro definitions you can
> find in Haiku. At first, I used the one defined in syscall_utils.h
> 
> #define RETURN_AND_SET_ERRNO(err)           \
>     do {                                    \
>         __typeof(err) raseResult = (err);   \
>         if (raseResult < 0) {               \
>             errno = raseResult;             \
>             return -1;                      \
>         }                                   \
>         return raseResult;                  \
>     } while (false)
> 
> but this would cause the C file not to compile due to a syntax error,
> so I grabbed the one in src/system/libroot/os/fs_attr.c.

I don't know why that would cause problems with C files, but there's no 
reason not to switch to C++.

CU, Ingo

Other related posts: