From patchwork Tue Mar 7 11:47:35 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: 94977 Delivered-To: patch@linaro.org Received: by 10.140.82.71 with SMTP id g65csp1847732qgd; Tue, 7 Mar 2017 03:48:11 -0800 (PST) X-Received: by 10.55.3.151 with SMTP id 145mr18992403qkd.244.1488887291251; Tue, 07 Mar 2017 03:48:11 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id j186si17718629qkc.127.2017.03.07.03.48.11; Tue, 07 Mar 2017 03:48:11 -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 E12CA62CC1; Tue, 7 Mar 2017 11:48:10 +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_H2, 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 7AD8B62D0B; Tue, 7 Mar 2017 11:47:46 +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 1F9A362CC1; Tue, 7 Mar 2017 11:47:42 +0000 (UTC) Received: from mail-wr0-f178.google.com (mail-wr0-f178.google.com [209.85.128.178]) by lists.linaro.org (Postfix) with ESMTPS id A6BB560F3B for ; Tue, 7 Mar 2017 11:47:40 +0000 (UTC) Received: by mail-wr0-f178.google.com with SMTP id l37so137291625wrc.1 for ; Tue, 07 Mar 2017 03:47:40 -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:in-reply-to :references; bh=pmSj0TJslJXzyK+UGBmb6BqGmp/ndnn2HyUYbSL0bv4=; b=RAztLhL+PGPaVQm9NsBJgxKZf4LBYD6amOARmnU47txz0BwGVSrgkJJqD+ezfUPWP1 6NlfAd+HVnDHXbkw+wMXFwMEYgQWYqxEtlHIcqccR4aF9HZsIPAm+7ZKtAlqIswb2VyH S6BQfIhOJaDA8LwDG0RXfNQDjBOMNsb1YDTyVWD7q9hK2Wjgj6FY05N9uoP32B28uSY9 s3SzWpZPdiLwZ3tiFctDRbs04l6TYwNSDkDX+oMWtXns4Z+csYJzjB/jt4sq2Go2heRH nh6z22pSP3dYddJ97mXAXHsSLSAnXgvYohSsouFHwVGURlO2doGhjdI/TLFA8iDYJIpO +OXQ== X-Gm-Message-State: AMke39mV6kC9XzWKTb5r+AxyW9u7FZk3JUEOc0LKcJ7s+w6N8k8H0wqEWDsvmhE+UAv/mIi9K5c= X-Received: by 10.223.160.231 with SMTP id n36mr21844246wrn.167.1488887259694; Tue, 07 Mar 2017 03:47:39 -0800 (PST) Received: from forlindon.c.hoisthospitality.com ([109.74.56.122]) by smtp.gmail.com with ESMTPSA id x1sm30607978wrd.63.2017.03.07.03.47.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Mar 2017 03:47:39 -0800 (PST) From: Dmitry Eremin-Solenikov To: lng-odp@lists.linaro.org Date: Tue, 7 Mar 2017 14:47:35 +0300 Message-Id: <20170307114737.28171-2-dmitry.ereminsolenikov@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170307114737.28171-1-dmitry.ereminsolenikov@linaro.org> References: <20170307114737.28171-1-dmitry.ereminsolenikov@linaro.org> Cc: Dmitry Eremin-Solenikov 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" From: Dmitry Eremin-Solenikov 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 \