I can only approve of Mike's patch if we change ODP_ASSERT to do something like this.
On 19 March 2015 at 12:09, Stuart Haslam <[email protected]> wrote: > On Wed, Mar 18, 2015 at 06:17:39PM -0400, Mike Holmes wrote: > > ODP implementations should not call assert directly. > > > > Signed-off-by: Mike Holmes <[email protected]> > > --- > > platform/linux-generic/odp_timer.c | 20 +++++++++++--------- > > 1 file changed, 11 insertions(+), 9 deletions(-) > > > > diff --git a/platform/linux-generic/odp_timer.c > b/platform/linux-generic/odp_timer.c > > index b7cb04f..39d7064 100644 > > --- a/platform/linux-generic/odp_timer.c > > +++ b/platform/linux-generic/odp_timer.c > > @@ -23,9 +23,7 @@ > > > > /* For snprint, POSIX timers and sigevent */ > > #define _POSIX_C_SOURCE 200112L > > -#include <assert.h> > > #include <errno.h> > > -#include <string.h> > > #include <stdlib.h> > > #include <time.h> > > #include <signal.h> > > @@ -123,8 +121,9 @@ static void timer_init(odp_timer *tim, > > /* Teardown when timer is freed */ > > static void timer_fini(odp_timer *tim, tick_buf_t *tb) > > { > > - assert(tb->exp_tck.v == TMO_UNUSED); > > - assert(tb->tmo_buf == ODP_BUFFER_INVALID); > > + ODP_ASSERT(tb->exp_tck.v == TMO_UNUSED, "tb->exp_tck.v == > TMO_UNUSED"); > > + ODP_ASSERT(tb->tmo_buf == ODP_BUFFER_INVALID, > > + "tb->tmo_buf == ODP_BUFFER_INVALID"); > > This isn't too pleasant, and the comments could become stale. How about > we just modify ODP_ASSERT() to do this? (there are no users of it yet) > > Something like this perhaps; > > #define ODP_ASSERT(cond) ODP_ASSERT_STR(cond, " assert failed: " #cond) > > #define ODP_ASSERT_STR(cond, msg) \ > do { if ((ODP_DEBUG == 1) && (!(cond))) { \ > ODP_ERR("%s\n", msg); \ > odp_global_data.abort_fn(); } \ > } while (0) > > -- > Stuart. >
_______________________________________________ lng-odp mailing list [email protected] http://lists.linaro.org/mailman/listinfo/lng-odp
