From patchwork Wed Feb 1 14:30:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 93030 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp2442755qgi; Wed, 1 Feb 2017 06:30:35 -0800 (PST) X-Received: by 10.237.42.12 with SMTP id c12mr2930332qtd.284.1485959435662; Wed, 01 Feb 2017 06:30:35 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id i200si14532004qke.178.2017.02.01.06.30.35; Wed, 01 Feb 2017 06:30:35 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 1888160872; Wed, 1 Feb 2017 14:30:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id E02346065B; Wed, 1 Feb 2017 14:30:30 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 8600C606A0; Wed, 1 Feb 2017 14:30:28 +0000 (UTC) Received: from mail-ot0-f179.google.com (mail-ot0-f179.google.com [74.125.82.179]) by lists.linaro.org (Postfix) with ESMTPS id 6A8356063F for ; Wed, 1 Feb 2017 14:30:27 +0000 (UTC) Received: by mail-ot0-f179.google.com with SMTP id f9so290949978otd.1 for ; Wed, 01 Feb 2017 06:30:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=i7l7AFQ/HgoW4iKh4XzFtJIMkNUltIq+VXdCaATD2cs=; b=MPXg87tgccQAgDr2i/6fVL+TsCyre1dIP91WFda0dJbWsc0yuXQHiTOTTeRRpyzfQc p0MUm4+1VsOMBOzVAm4OQXbC2eBVfaukJ+oJXIfRaPQMcJcq8LiMtvHxdh1BBuiSRJl5 ksq34fM8NrSL21G7Serw54kQZRep4X1EPfOwC7pz1WilXtUmlRNtnSQr1FzU0nB6b47v AIae1rtnjwcXGr/eoF0rVRQXpneWRYB71nkDm3G5YEE3u0Q1/AYfoHcOTduvTlDUbq5G piYASLGX8yFVaMewCnTV7iA40uVeXPFXp5bRrZi9J+3sYmfcydlTsZ2ZlNqZxoWynBqz GmEA== X-Gm-Message-State: AMke39mH4Jpbfcg/39e32y3QYdaTWy4gmfZWJk3uCtzFPBqODl8PBBeq2sxc+CRbM+jSTkHaVog= X-Received: by 10.157.3.40 with SMTP id 37mr1324578otv.117.1485959426668; Wed, 01 Feb 2017 06:30:26 -0800 (PST) Received: from localhost.localdomain (cpe-70-121-83-241.austin.res.rr.com. [70.121.83.241]) by smtp.gmail.com with ESMTPSA id c18sm10514070ote.24.2017.02.01.06.30.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Feb 2017 06:30:26 -0800 (PST) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Wed, 1 Feb 2017 08:30:22 -0600 Message-Id: <20170201143022.11022-1-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.11.0.295.gd7dffce Subject: [lng-odp] [PATCHv2] linux-generic: debug: enable helper use from c++ programs X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" The ODP_STATIC_ASSERT() macro expands to _Static_assert(), however when used in C++ programs this needs to expand to static_assert(). This resolves Bug https://bugs.linaro.org/show_bug.cgi?id=2852 Signed-off-by: Bill Fischofer --- Changes for v2: - Update C++ test case to include helper apis to validate this fix platform/linux-generic/include/odp/api/debug.h | 6 ++++-- test/common_plat/miscellaneous/odp_api_from_cpp.cpp | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) -- 2.11.0.295.gd7dffce diff --git a/platform/linux-generic/include/odp/api/debug.h b/platform/linux-generic/include/odp/api/debug.h index 7db14339..19659a9b 100644 --- a/platform/linux-generic/include/odp/api/debug.h +++ b/platform/linux-generic/include/odp/api/debug.h @@ -39,9 +39,11 @@ extern "C" { * if condition 'cond' is false. Macro definition is empty when compiler is not * supported or the compiler does not support static assertion. */ -#define ODP_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg) +#ifndef __cplusplus +#define ODP_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg) -#ifdef __cplusplus +#else +#define ODP_STATIC_ASSERT(cond, msg) static_assert(cond, msg) } #endif diff --git a/test/common_plat/miscellaneous/odp_api_from_cpp.cpp b/test/common_plat/miscellaneous/odp_api_from_cpp.cpp index 2b307864..962b7fdc 100644 --- a/test/common_plat/miscellaneous/odp_api_from_cpp.cpp +++ b/test/common_plat/miscellaneous/odp_api_from_cpp.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include int main(int argc ODP_UNUSED, const char *argv[] ODP_UNUSED) {