[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

RE: SVN_ERR_ASSERT calls abort() in non-maintainer-mode

From: Bert Huijben <bert_at_qqmail.nl>
Date: Thu, 19 May 2011 16:56:21 +0200

> -----Original Message-----
> From: Arwin Arni [mailto:arwin_at_collab.net]
> Sent: donderdag 19 mei 2011 15:48
> To: Subversion Development
> Subject: SVN_ERR_ASSERT calls abort() in non-maintainer-mode
>
> In our implementation of SVN_ERR_ASSERT, we do:
>
> #define SVN_ERR_ASSERT(expr) \
> do { \
> if (!(expr)) \
> SVN_ERR(svn_error__malfunction(TRUE, __FILE__, __LINE__, #expr)); \
> } while (0)
>
> This ends up calling svn_error_abort_on_malfunction (inside
> subversion/libsvn_subr/error.c) which calls abort() indiscriminately:
>
> svn_error_t *
> svn_error_abort_on_malfunction(svn_boolean_t can_return,
> const char *file, int line,
> const char *expr)
> {
> svn_error_t *err = svn_error_raise_on_malfunction(TRUE, file, line,
> expr);
>
> svn_handle_error2(err, stderr, FALSE, "svn: ");
> abort();
> return err; /* Not reached. */
> }
>
>
> Wouldn't this abort() regardless of maintainer-mode?
> Shouldn't there be some difference between maintainer-mode and
> production?
>
> Am I missing something here?

The documentation says that you are not allowed to return from the function
when it has that FALSE ca_return, you can *never* return.

(You are free to do a long jump or throw a C++ exception or whatever you
want to do, but you can't return).

And we can't call the function a second time, to say that you didn't follow
that rule.

        Bert
Received on 2011-05-19 16:57:42 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.