diff options
author | Jere Leppänen <jere.leppanen@nokia.com> | 2021-09-29 14:17:55 +0300 |
---|---|---|
committer | Matias Elo <matias.elo@nokia.com> | 2021-11-12 09:48:41 +0200 |
commit | 7bef61ebe885c6a089d1cd7b3f7f3b6bdf7b8cf7 (patch) | |
tree | c84f93220247bf644a7a5f761c95802a2911ad1a /helper | |
parent | c4b1cde446777a397c99058de5c19aeffe1faacc (diff) |
helper: implement deprecation
Implement deprecation in the helper library. Deprecated helper APIs
may be enabled with the --enable-helper-deprecated configure
option. By default, deprecated helper APIs are not enabled.
Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com>
Reviewed-by: Matias Elo <matias.elo@nokia.com>
Diffstat (limited to 'helper')
-rw-r--r-- | helper/Makefile.am | 3 | ||||
-rw-r--r-- | helper/include/odp/helper/autoheader_external.h.in | 3 | ||||
-rw-r--r-- | helper/include/odp/helper/deprecated.h | 39 | ||||
-rw-r--r-- | helper/include/odp/helper/odph_api.h | 4 | ||||
-rw-r--r-- | helper/m4/configure.m4 | 12 |
5 files changed, 58 insertions, 3 deletions
diff --git a/helper/Makefile.am b/helper/Makefile.am index 264b3d365..2b89c2223 100644 --- a/helper/Makefile.am +++ b/helper/Makefile.am @@ -14,6 +14,7 @@ AM_LDFLAGS = -version-number '$(ODPHELPER_LIBSO_VERSION)' helperincludedir = $(includedir)/odp/helper/ helperinclude_HEADERS = \ include/odp/helper/autoheader_external.h\ + include/odp/helper/deprecated.h\ include/odp/helper/chksum.h\ include/odp/helper/odph_debug.h \ include/odp/helper/eth.h\ @@ -80,7 +81,7 @@ __LIB__libodphelper_la_LIBADD += $(LIBCLI_LIBS) lib_LTLIBRARIES = $(LIB)/libodphelper.la -CHECK_GLOBALS_REGEX = " odph_" +CHECK_GLOBALS_REGEX = " (odph_|_deprecated_odph_)" TESTS_ENVIRONMENT = \ LIBTOOL="$(LIBTOOL)" \ diff --git a/helper/include/odp/helper/autoheader_external.h.in b/helper/include/odp/helper/autoheader_external.h.in index 6f5187a5b..81f10a737 100644 --- a/helper/include/odp/helper/autoheader_external.h.in +++ b/helper/include/odp/helper/autoheader_external.h.in @@ -11,4 +11,7 @@ /* Define to 1 to display helper debug information */ #undef ODPH_DEBUG_PRINT +/* Define to 1 to enable deprecated helper API definitions */ +#undef ODPH_DEPRECATED_API + #endif diff --git a/helper/include/odp/helper/deprecated.h b/helper/include/odp/helper/deprecated.h new file mode 100644 index 000000000..3415b2127 --- /dev/null +++ b/helper/include/odp/helper/deprecated.h @@ -0,0 +1,39 @@ +/* Copyright (c) 2017-2018, Linaro Limited + * Copyright (c) 2021, Nokia + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * Macro for deprecated API definitions + */ + +#ifndef ODPH_DEPRECATED_H_ +#define ODPH_DEPRECATED_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <odp/helper/autoheader_external.h> + +/** + * @def ODPH_DEPRECATE + * + * Macro to deprecate helper API definitions + */ + +#if ODPH_DEPRECATED_API +#define ODPH_DEPRECATE(x) x +#else +#define ODPH_DEPRECATE(x) _deprecated_ ## x +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/helper/include/odp/helper/odph_api.h b/helper/include/odp/helper/odph_api.h index 7ab875c6e..3c321b9d4 100644 --- a/helper/include/odp/helper/odph_api.h +++ b/helper/include/odp/helper/odph_api.h @@ -18,6 +18,8 @@ extern "C" { #endif +#include <odp/helper/autoheader_external.h> + #include <odp/helper/odph_debug.h> #include <odp/helper/chksum.h> #include <odp/helper/odph_cuckootable.h> @@ -38,8 +40,6 @@ extern "C" { #include <odp/helper/udp.h> #include <odp/helper/version.h> -#include <odp/helper/autoheader_external.h> - #ifdef ODPH_CLI #include <odp/helper/cli.h> #endif diff --git a/helper/m4/configure.m4 b/helper/m4/configure.m4 index 36629c81e..2e1076172 100644 --- a/helper/m4/configure.m4 +++ b/helper/m4/configure.m4 @@ -47,5 +47,17 @@ AS_IF([test "x$enable_helper_debug_print" != "xno"], [ODPH_DEBUG_PRINT=1], AC_DEFINE_UNQUOTED([ODPH_DEBUG_PRINT], [$ODPH_DEBUG_PRINT], [Define to 1 to display helper debug information]) +########################################################################## +# Enable/disable deprecated helper API definitions +########################################################################## +AC_ARG_ENABLE([helper-deprecated], + [AS_HELP_STRING([--enable-helper-deprecated], + [enable deprecated helper API definitions [default=disabled]])], + [], [enable_helper_deprecated=no]) +AS_IF([test "x$enable_helper_deprecated" != "xno"], [ODPH_DEPRECATED_API=1], + [ODPH_DEPRECATED_API=0]) +AC_DEFINE_UNQUOTED([ODPH_DEPRECATED_API], [$ODPH_DEPRECATED_API], + [Define to 1 to enable deprecated helper API definitions]) + AC_CONFIG_FILES([helper/libodphelper.pc helper/test/Makefile]) |