From patchwork Tue Mar 7 11:52:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Eremin-Solenikov X-Patchwork-Id: 94980 Delivered-To: patch@linaro.org Received: by 10.140.82.71 with SMTP id g65csp1849372qgd; Tue, 7 Mar 2017 03:53:27 -0800 (PST) X-Received: by 10.237.36.153 with SMTP id t25mr21524837qtc.134.1488887606945; Tue, 07 Mar 2017 03:53:26 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id p64si17736846qkd.41.2017.03.07.03.53.26; Tue, 07 Mar 2017 03:53:26 -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 561E6635D5; Tue, 7 Mar 2017 11:53:26 +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 A90B562D18; Tue, 7 Mar 2017 11:52:47 +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 5843460F3B; Tue, 7 Mar 2017 11:52:44 +0000 (UTC) Received: from mail-wm0-f54.google.com (mail-wm0-f54.google.com [74.125.82.54]) by lists.linaro.org (Postfix) with ESMTPS id A1C9362D40 for ; Tue, 7 Mar 2017 11:52:28 +0000 (UTC) Received: by mail-wm0-f54.google.com with SMTP id t189so2551780wmt.1 for ; Tue, 07 Mar 2017 03:52:28 -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:subject:date:message-id:in-reply-to :references; bh=OZOyY/wA+7z3XAEdowBVRMBOILfzRDNfOiLsM5T4Oes=; b=MHdOZyKfqdzwJYivVUTT+QEoiSUFILGFYKOHQdnLv/HEO81UJD4B33WBaKnN2u01vr tDUwq3k84zT3LsrqHwxGavItr1sSqj/cJu3yvWw6g5pndQhK0z34u2bXnOYQsapiLWX5 63Nv66nhoD5IjJpk7qXYrlGYwcXawNbpABUMT9UVRTpKuyeSLMC4bOR08gEuU3kJSJQj zccGl2jQ33F/0WPb1c5m2uTqVsbmxJkJo1VriW9NmeJk0vYRgslLFUmOcyqVFuVGoh2P V+/91Psxjo2111w8KE6rVJ3V4Ia3iLAgAs0viHCsANBa4k9a6z1bPu43ujAIM9CyRiWU tjDg== X-Gm-Message-State: AMke39na/LEmrAl7R4AGlpMXfmTtegE5Kh8Y/r4ugLsj4JJnsUFQErMzA+ZolTvjlpMbWfz/XciXHA== X-Received: by 10.28.29.201 with SMTP id d192mr18482389wmd.94.1488887547524; Tue, 07 Mar 2017 03:52:27 -0800 (PST) Received: from forlindon.c.hoisthospitality.com ([109.74.56.122]) by smtp.gmail.com with ESMTPSA id y145sm18652299wmc.17.2017.03.07.03.52.26 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Mar 2017 03:52:27 -0800 (PST) From: Dmitry Eremin-Solenikov To: lng-odp@lists.linaro.org Date: Tue, 7 Mar 2017 14:52:23 +0300 Message-Id: <20170307115225.29225-2-dmitry.ereminsolenikov@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170307115225.29225-1-dmitry.ereminsolenikov@linaro.org> References: <20170307115225.29225-1-dmitry.ereminsolenikov@linaro.org> Subject: [lng-odp] [API-NEXT 1/3] api: hints: rework ODP_DEPRECATED API 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_DEPRECATED macro uses the deprecated attribute which works only for types and functions, but not e.g. for fields of structure. So let's add ODP_DEPRECATED_FIELD macro suitable for fields, variables and enum values. Also make ODP_DEPRECATED{,_FIELD} macros to be a no-op if ODP_ALLOW_DEPRECATED is defined. ODP code MUST be compiled with this macro, so that it supports deprecated API. Examples SHOULD be compiled without this macro defined, so that they show best current practice of using API but still MAY use the macro untill particular application is ported to new API. User applications SHOULD try to compile without ODP_ALLOW_DEPRECATED macro defined. Signed-off-by: Dmitry Eremin-Solenikov --- doc/helper-guide/Doxyfile | 1 + doc/platform-api-guide/Doxyfile | 1 + helper/Makefile.am | 1 + include/odp/api/spec/hints.h | 13 +++++++++++++ platform/linux-generic/Makefile.am | 1 + 5 files changed, 17 insertions(+) -- 2.11.0 diff --git a/doc/helper-guide/Doxyfile b/doc/helper-guide/Doxyfile index bcc24539..62c1f862 100644 --- a/doc/helper-guide/Doxyfile +++ b/doc/helper-guide/Doxyfile @@ -40,6 +40,7 @@ PREDEFINED = __GNUC__ \ __LITTLE_ENDIAN_BITFIELD \ __x86_64__ \ ODP_PACKED \ + ODP_DEPRECATED_FIELD(x)=x \ "ODP_HANDLE_T(type)=odp_handle_t type" INTERNAL_DOCS = YES DOT_IMAGE_FORMAT = svg diff --git a/doc/platform-api-guide/Doxyfile b/doc/platform-api-guide/Doxyfile index fbe7c936..37175e09 100644 --- a/doc/platform-api-guide/Doxyfile +++ b/doc/platform-api-guide/Doxyfile @@ -17,4 +17,5 @@ PREDEFINED = __GNUC__ \ __LITTLE_ENDIAN_BITFIELD \ __x86_64__ \ ODP_PACKED \ + ODP_DEPRECATED_FIELD(x)=x \ "ODP_HANDLE_T(type)=odp_handle_t type" diff --git a/helper/Makefile.am b/helper/Makefile.am index 2c5452dc..3bd38a46 100644 --- a/helper/Makefile.am +++ b/helper/Makefile.am @@ -10,6 +10,7 @@ AM_CFLAGS += -I$(top_srcdir)/include AM_CFLAGS += -I$(top_srcdir)/include/odp/arch/@ARCH_ABI@ AM_CFLAGS += -I$(top_builddir)/platform/@with_platform@/include AM_CFLAGS += -I$(top_builddir)/include +AM_CFLAGS += -DODP_ALLOW_DEPRECATED AM_LDFLAGS += -version-number '$(ODPHELPER_LIBSO_VERSION)' diff --git a/include/odp/api/spec/hints.h b/include/odp/api/spec/hints.h index 82400f07..3b70db6f 100644 --- a/include/odp/api/spec/hints.h +++ b/include/odp/api/spec/hints.h @@ -54,7 +54,20 @@ extern "C" { /** * Indicate deprecated variables, functions or types */ +#ifdef ODP_ALLOW_DEPRECATED #define ODP_DEPRECATED __attribute__((__deprecated__)) +#else +#define ODP_DEPRECATED +#endif + +/** + * Indicate deprecated field, bitfield or enum value + */ +#ifndef ODP_ALLOW_DEPRECATED +#define ODP_DEPRECATED_FIELD(x) __odp_deprecated_ ## x +#else +#define ODP_DEPRECATED_FIELD(x) x +#endif /** * Intentionally unused variables of functions diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index b21df449..800bf5e8 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -10,6 +10,7 @@ AM_CFLAGS += -I$(top_srcdir)/include/odp/arch/@ARCH_ABI@ AM_CFLAGS += -I$(top_builddir)/include AM_CFLAGS += -Iinclude AM_CFLAGS += -DSYSCONFDIR=\"@sysconfdir@\" +AM_CFLAGS += -DODP_ALLOW_DEPRECATED include_HEADERS = \ $(top_srcdir)/include/odp.h \