Message ID | 1398185660-25698-1-git-send-email-mike.holmes@linaro.org |
---|---|
State | Accepted |
Headers | show |
_Static_assert() vs. _static_assert? Are both supported in C99 or common extensions? I Google and just get confused. What about all the usages of the old ODP_ASSERT which ought to be converted to ODP_STATIC_ASSERT?
The C11 construct is _Static_assert() (with the caps). Agree we need to do a find/replace for all uses as part of this change. Bill On Tue, Apr 22, 2014 at 2:35 PM, Ola Liljedahl <ola.liljedahl@linaro.org>wrote: > _Static_assert() vs. _static_assert? Are both supported in C99 or > common extensions? I Google and just get confused. > > What about all the usages of the old ODP_ASSERT which ought to be > converted to ODP_STATIC_ASSERT? > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > http://lists.linaro.org/mailman/listinfo/lng-odp >
diff --git a/include/odp_debug.h b/include/odp_debug.h index 4d4f04e..e35c1ac 100644 --- a/include/odp_debug.h +++ b/include/odp_debug.h @@ -43,6 +43,12 @@ extern "C" { #define ODP_ASSERT(cond, msg) typedef char msg[(cond) ? 1 : -1] /** + * Compile time assertion-macro - fail compilation if cond is false. + * @note This macro has zero runtime overhead + */ +#define ODP_STATIC_ASSERT(cond, msg) _static_assert(cond, msg) + +/** * Debug printing macro, which prints output when DEBUG flag is set. */ #define ODP_DBG(fmt, ...) \
Signed-off-by: Mike Holmes <mike.holmes@linaro.org> --- include/odp_debug.h | 6 ++++++ 1 file changed, 6 insertions(+)