From patchwork Mon Jul 21 17:17:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taras Kondratiuk X-Patchwork-Id: 34009 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f72.google.com (mail-yh0-f72.google.com [209.85.213.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D9EF520672 for ; Mon, 21 Jul 2014 17:17:59 +0000 (UTC) Received: by mail-yh0-f72.google.com with SMTP id f73sf24416841yha.3 for ; Mon, 21 Jul 2014 10:17:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=Z6PamYCa7gyBpzrGKngGmD+ADqMUNbD/n1I7woIAw9U=; b=EnWtBEP8GTLpzNmcchtJ8//NeBaxGoTjWKfwc3k0VZ+HaX9+fKtLoS67yHdh2lgbBw jtdn92VULdQ1MLVlX2PbbQl4EfCc8Wva88+zcXrVFdk0lqSXnNrrZlSsjZWLd9uZwIlL dwYzRqeMzAkQVrksmCgDT3qoKvBUHvhgWVpCmrFIj/WOTv6hruK8Qx4iBqAUxhZ9RBPy W/1dOuhnCAZ39uTS6jVazg2u8s5S0H/YKWgMBhZik4hQeljt4I/11rPOcaOJ/QYWdvB7 5Goa+E5b1x5iMUHv1mMAnqDbUzIwcxm8E2z2C0O4LhYKqxqed8DVGDRBxWJGnifWPEtn ScsQ== X-Gm-Message-State: ALoCoQl0G25G3b5Zk7zrsAdBwGBns/zOIBXPE6cgfpzxuHEraGCzpT8TR/xuBx5tdtNl1jODPcdX X-Received: by 10.224.169.20 with SMTP id w20mr8656637qay.4.1405963079523; Mon, 21 Jul 2014 10:17:59 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.36.37 with SMTP id o34ls1854325qgo.67.gmail; Mon, 21 Jul 2014 10:17:59 -0700 (PDT) X-Received: by 10.52.103.97 with SMTP id fv1mr27055098vdb.42.1405963079326; Mon, 21 Jul 2014 10:17:59 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id vi8si11911676vec.97.2014.07.21.10.17.51 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 21 Jul 2014 10:17:51 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id hq11so11033306vcb.24 for ; Mon, 21 Jul 2014 10:17:51 -0700 (PDT) X-Received: by 10.52.120.38 with SMTP id kz6mr3448730vdb.86.1405963070955; Mon, 21 Jul 2014 10:17:50 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp129952vcb; Mon, 21 Jul 2014 10:17:50 -0700 (PDT) X-Received: by 10.70.2.5 with SMTP id 5mr26816233pdq.51.1405963070112; Mon, 21 Jul 2014 10:17:50 -0700 (PDT) Received: from ip-10-141-164-156.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id a20si29860193qai.74.2014.07.21.10.17.49 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 21 Jul 2014 10:17:50 -0700 (PDT) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-141-164-156.ec2.internal) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1X9HDh-0000PW-1m; Mon, 21 Jul 2014 17:17:49 +0000 Received: from mail-lb0-f174.google.com ([209.85.217.174]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1X9HDQ-0000OS-DU for lng-odp@lists.linaro.org; Mon, 21 Jul 2014 17:17:32 +0000 Received: by mail-lb0-f174.google.com with SMTP id c11so4944750lbj.5 for ; Mon, 21 Jul 2014 10:17:26 -0700 (PDT) X-Received: by 10.112.164.33 with SMTP id yn1mr25945521lbb.51.1405963046029; Mon, 21 Jul 2014 10:17:26 -0700 (PDT) Received: from uglx0153363.synapse.com ([195.238.92.128]) by mx.google.com with ESMTPSA id 5sm9450990lau.29.2014.07.21.10.17.25 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 21 Jul 2014 10:17:25 -0700 (PDT) From: Taras Kondratiuk To: lng-odp@lists.linaro.org Date: Mon, 21 Jul 2014 20:17:13 +0300 Message-Id: <1405963033-29230-4-git-send-email-taras.kondratiuk@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1405963033-29230-1-git-send-email-taras.kondratiuk@linaro.org> References: <1405963033-29230-1-git-send-email-taras.kondratiuk@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH 3/3] debug: Convert ODP_ASSERT to a runtime assertion X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: taras.kondratiuk@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Accordingly to architecture document this should be a runtime assertion and call abort() in case of failure. Signed-off-by: Taras Kondratiuk Reviewed-by: Anders Roxell Tested-by: Mike Holmes --- include/odp_debug.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/include/odp_debug.h b/include/odp_debug.h index edc775f..9a5ea2a 100644 --- a/include/odp_debug.h +++ b/include/odp_debug.h @@ -38,9 +38,14 @@ extern "C" { #endif /** - * Compile time assertion-macro - fail compilation if cond is false. + * Runtime assertion-macro - aborts if 'cond' is false. */ -#define ODP_ASSERT(cond, msg) typedef char msg[(cond) ? 1 : -1] +#ifndef ODP_NO_DEBUG +#define ODP_ASSERT(cond, msg) \ + do { if (!(cond)) {ODP_ERR("%s\n", msg); abort(); } } while (0) +#else +#define ODP_ASSERT(cond, msg) +#endif /** * Compile time assertion-macro - fail compilation if cond is false.