diff mbox

linus-generic: debug: Allow formatted ODP_ASSERT

Message ID 1423130731-13545-1-git-send-email-taras.kondratiuk@linaro.org
State New
Headers show

Commit Message

Taras Kondratiuk Feb. 5, 2015, 10:05 a.m. UTC
Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
---
 platform/linux-generic/include/odp_debug_internal.h | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Mike Holmes Feb. 12, 2015, 12:31 a.m. UTC | #1
looks good to me, did you force an abort call to check it works?
I see about 23 locations in the current implementation that call abort, but
I don't know if any can be triggered by API calls in the unit tests to
prove this works.

On 5 February 2015 at 18:05, Taras Kondratiuk <taras.kondratiuk@linaro.org>
wrote:

> Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
> ---
>  platform/linux-generic/include/odp_debug_internal.h | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/platform/linux-generic/include/odp_debug_internal.h
> b/platform/linux-generic/include/odp_debug_internal.h
> index dec5c15..265d9be 100644
> --- a/platform/linux-generic/include/odp_debug_internal.h
> +++ b/platform/linux-generic/include/odp_debug_internal.h
> @@ -32,10 +32,9 @@ extern "C" {
>  /**
>   * Runtime assertion-macro - aborts if 'cond' is false.
>   */
> -#define ODP_ASSERT(cond, msg) \
> -       do { if ((ODP_DEBUG == 1) && (!(cond))) { \
> -               ODP_ERR("%s\n", msg); \
> -               odp_global_data.abort_fn(); } \
> +#define ODP_ASSERT(cond, fmt, ...) \
> +       do { if ((ODP_DEBUG == 1) && (!(cond))) \
> +               ODP_ABORT("%s\n", fmt, ##__VA_ARGS__); \
>         } while (0)
>
>  /**
> --
> 1.9.1
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
Taras Kondratiuk Feb. 17, 2015, 2:11 p.m. UTC | #2
On 02/12/2015 02:31 AM, Mike Holmes wrote:
> looks good to me, did you force an abort call to check it works?
> I see about 23 locations in the current implementation that call abort,
> but I don't know if any can be triggered by API calls in the unit tests
> to prove this works.

Please ignore it. I'll post v2.
diff mbox

Patch

diff --git a/platform/linux-generic/include/odp_debug_internal.h b/platform/linux-generic/include/odp_debug_internal.h
index dec5c15..265d9be 100644
--- a/platform/linux-generic/include/odp_debug_internal.h
+++ b/platform/linux-generic/include/odp_debug_internal.h
@@ -32,10 +32,9 @@  extern "C" {
 /**
  * Runtime assertion-macro - aborts if 'cond' is false.
  */
-#define ODP_ASSERT(cond, msg) \
-	do { if ((ODP_DEBUG == 1) && (!(cond))) { \
-		ODP_ERR("%s\n", msg); \
-		odp_global_data.abort_fn(); } \
+#define ODP_ASSERT(cond, fmt, ...) \
+	do { if ((ODP_DEBUG == 1) && (!(cond))) \
+		ODP_ABORT("%s\n", fmt, ##__VA_ARGS__); \
 	} while (0)
 
 /**