diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2012-09-14 02:04:07 -0500 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2012-09-14 03:49:21 -0500 |
commit | 445c647a52f21fe402afc5c60505e151e035f019 (patch) | |
tree | f7b740079048676faea1b3e3f936c0439165335d /sal | |
parent | b42094b2b06f4837a6df65e6b87caf8139fc0d0d (diff) |
add a configure option to make assert() abort in release code
Change-Id: I93720ee3338426174b31a6ea6dba3af7ffb7e207
Diffstat (limited to 'sal')
-rw-r--r-- | sal/inc/sal/macros.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/sal/inc/sal/macros.h b/sal/inc/sal/macros.h index 6f10585c542e..bb0e46e9876e 100644 --- a/sal/inc/sal/macros.h +++ b/sal/inc/sal/macros.h @@ -31,6 +31,22 @@ #include <stddef.h> +/* we want to be able to compile release code while retaining the abort capabilities of assert(). + * This presume that this include is called early... i.e before anyone else included assert.h + * which should more often than not be the case since macros.h is included by sal/types.h + * which is included at the top of most source (or should be) + */ +#ifdef ASSERT_ALWAYS_ABORT +# ifdef NDEBUG +# undef NDEBUG +# include <assert.h> +# define NDEBUG +# else /* Ndef NDEBUG */ +# include <assert.h> +# endif /* Ndef NDEBUG */ +#else /* NDef ASSERT_ALWAYS_ABORT */ +# include <assert.h> +#endif /* NDef ASSERT_ALWAYS_ABORT */ #ifndef SAL_N_ELEMENTS # if defined(__cplusplus) && ( defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L ) |