diff mbox series

[2/5] helper: add ABI compile flag

Message ID 20170201131409.26631-3-mike.holmes@linaro.org
State New
Headers show
Series Add ABI compatibility to helper lib | expand

Commit Message

Mike Holmes Feb. 1, 2017, 1:14 p.m. UTC
Signed-off-by: Mike Holmes <mike.holmes@linaro.org>

---
 configure.ac                                 |  6 +++++
 helper/Makefile.am                           |  1 +
 helper/include/odp/helper/.gitignore         |  1 +
 helper/include/odp/helper/static_inline.h.in | 35 ++++++++++++++++++++++++++++
 helper/m4/configure.m4                       |  3 ++-
 5 files changed, 45 insertions(+), 1 deletion(-)
 create mode 100644 helper/include/odp/helper/.gitignore
 create mode 100644 helper/include/odp/helper/static_inline.h.in

-- 
2.9.3

Comments

Bill Fischofer Feb. 2, 2017, 3:57 a.m. UTC | #1
On Wed, Feb 1, 2017 at 7:14 AM, Mike Holmes <mike.holmes@linaro.org> wrote:
> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>

> ---

>  configure.ac                                 |  6 +++++

>  helper/Makefile.am                           |  1 +

>  helper/include/odp/helper/.gitignore         |  1 +

>  helper/include/odp/helper/static_inline.h.in | 35 ++++++++++++++++++++++++++++

>  helper/m4/configure.m4                       |  3 ++-

>  5 files changed, 45 insertions(+), 1 deletion(-)

>  create mode 100644 helper/include/odp/helper/.gitignore

>  create mode 100644 helper/include/odp/helper/static_inline.h.in

>

> diff --git a/configure.ac b/configure.ac

> index daa9b31..71f07f9 100644

> --- a/configure.ac

> +++ b/configure.ac

> @@ -272,16 +272,22 @@ ODP_CFLAGS="$ODP_CFLAGS -DODP_DEBUG=$ODP_DEBUG"

>  # Enable/disable ABI compatible build

>  ##########################################################################

>  ODP_ABI_COMPAT=1

> +ODP_HELPER_ABI_COMPAT=1


Not clear why helpers should not piggyback on the existing
ODP_ABI_COMPAT settings, since you would never have a situation in
which these two were out of sync with each other. If a separate
control were needed, shouldn't it be ODPH_ABI_COMPAT rather than
ODP_HELPER_ABI_COMPAT for consistency with the other odph_ prefix
usage? ODP_HELPER_ABI_COMPAT uses the ODP_ prefix, which is
misleading.

>  abi_compat=yes

>  AC_ARG_ENABLE([abi-compat],

>      [  --disable-abi-compat     disables ABI compatible mode, enables inline code in header files],

>      [if test "x$enableval" = "xno"; then

>         ODP_ABI_COMPAT=0

> +       ODP_HELPER_ABI_COMPAT=0

>         abi_compat=no

>         #if there is no ABI compatibility the .so numbers are meaningless

>         ODP_LIBSO_VERSION=0:0:0

> +       ODPHELPER_LIBSO_VERSION=0:0:0

>      fi])

>  AC_SUBST(ODP_ABI_COMPAT)

> +AC_SUBST(ODP_HELPER_ABI_COMPAT)

> +ODP_CFLAGS="$ODP_CFLAGS -DODP_HELPER_ABI_COMPAT=$ODP_HELPER_ABI_COMPAT"

> +ODP_CFLAGS="$ODP_CFLAGS -DODP_ABI_COMPAT=$ODP_ABI_COMPAT"


Why are these CFLAGS needed? ABI is a config time option, not compile
time, because it operates against installed copies of the libraries.

>

>  ##########################################################################

>  # Default warning setup

> diff --git a/helper/Makefile.am b/helper/Makefile.am

> index b77a928..69531d6 100644

> --- a/helper/Makefile.am

> +++ b/helper/Makefile.am

> @@ -26,6 +26,7 @@ helperinclude_HEADERS = \

>                   $(srcdir)/include/odp/helper/odph_hashtable.h\

>                   $(srcdir)/include/odp/helper/odph_iplookuptable.h\

>                   $(srcdir)/include/odp/helper/odph_lineartable.h\

> +                 $(srcdir)/include/odp/helper/static_inline.h\

>                   $(srcdir)/include/odp/helper/strong_types.h\

>                   $(srcdir)/include/odp/helper/tcp.h\

>                   $(srcdir)/include/odp/helper/table.h\

> diff --git a/helper/include/odp/helper/.gitignore b/helper/include/odp/helper/.gitignore

> new file mode 100644

> index 0000000..95db5f4

> --- /dev/null

> +++ b/helper/include/odp/helper/.gitignore

> @@ -0,0 +1 @@

> +static_inline.h

> diff --git a/helper/include/odp/helper/static_inline.h.in b/helper/include/odp/helper/static_inline.h.in

> new file mode 100644

> index 0000000..a3efcae

> --- /dev/null

> +++ b/helper/include/odp/helper/static_inline.h.in

> @@ -0,0 +1,35 @@

> +/* Copyright (c) 2017, Linaro Limited

> + * All rights reserved.

> + *

> + * SPDX-License-Identifier: BSD-3-Clause

> + */

> +

> +/**

> + * @file

> + *

> + * Macro for static inline functions

> + */

> +

> +#ifndef ODP_HELPER_STATIC_INLINE_H_

> +#define ODP_HELPER_STATIC_INLINE_H_

> +

> +#ifdef __cplusplus

> +extern "C" {

> +#endif

> +

> +/**

> + * @internal

> + * @def _HELPER_STATIC

> + * Control conditional static inline expansions for ABI compatibility

> + */

> +#if @ODP_HELPER_ABI_COMPAT@

> +#define _HELPER_STATIC

> +#else

> +#define _HELPER_STATIC static inline

> +#endif

> +

> +#ifdef __cplusplus

> +}

> +#endif

> +

> +#endif

> diff --git a/helper/m4/configure.m4 b/helper/m4/configure.m4

> index 38c95d9..71b1f2d 100644

> --- a/helper/m4/configure.m4

> +++ b/helper/m4/configure.m4

> @@ -20,4 +20,5 @@ AC_ARG_ENABLE([helper-extn],

>         fi])

>

>  AC_CONFIG_FILES([helper/Makefile

> -               helper/test/Makefile])

> +               helper/test/Makefile

> +               helper/include/odp/helper/static_inline.h])

> \ No newline at end of file


Note missing newline

> --

> 2.9.3

>
diff mbox series

Patch

diff --git a/configure.ac b/configure.ac
index daa9b31..71f07f9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -272,16 +272,22 @@  ODP_CFLAGS="$ODP_CFLAGS -DODP_DEBUG=$ODP_DEBUG"
 # Enable/disable ABI compatible build
 ##########################################################################
 ODP_ABI_COMPAT=1
+ODP_HELPER_ABI_COMPAT=1
 abi_compat=yes
 AC_ARG_ENABLE([abi-compat],
     [  --disable-abi-compat     disables ABI compatible mode, enables inline code in header files],
     [if test "x$enableval" = "xno"; then
 	ODP_ABI_COMPAT=0
+	ODP_HELPER_ABI_COMPAT=0
 	abi_compat=no
 	#if there is no ABI compatibility the .so numbers are meaningless
 	ODP_LIBSO_VERSION=0:0:0
+	ODPHELPER_LIBSO_VERSION=0:0:0
     fi])
 AC_SUBST(ODP_ABI_COMPAT)
+AC_SUBST(ODP_HELPER_ABI_COMPAT)
+ODP_CFLAGS="$ODP_CFLAGS -DODP_HELPER_ABI_COMPAT=$ODP_HELPER_ABI_COMPAT"
+ODP_CFLAGS="$ODP_CFLAGS -DODP_ABI_COMPAT=$ODP_ABI_COMPAT"
 
 ##########################################################################
 # Default warning setup
diff --git a/helper/Makefile.am b/helper/Makefile.am
index b77a928..69531d6 100644
--- a/helper/Makefile.am
+++ b/helper/Makefile.am
@@ -26,6 +26,7 @@  helperinclude_HEADERS = \
 		  $(srcdir)/include/odp/helper/odph_hashtable.h\
 		  $(srcdir)/include/odp/helper/odph_iplookuptable.h\
 		  $(srcdir)/include/odp/helper/odph_lineartable.h\
+		  $(srcdir)/include/odp/helper/static_inline.h\
 		  $(srcdir)/include/odp/helper/strong_types.h\
 		  $(srcdir)/include/odp/helper/tcp.h\
 		  $(srcdir)/include/odp/helper/table.h\
diff --git a/helper/include/odp/helper/.gitignore b/helper/include/odp/helper/.gitignore
new file mode 100644
index 0000000..95db5f4
--- /dev/null
+++ b/helper/include/odp/helper/.gitignore
@@ -0,0 +1 @@ 
+static_inline.h
diff --git a/helper/include/odp/helper/static_inline.h.in b/helper/include/odp/helper/static_inline.h.in
new file mode 100644
index 0000000..a3efcae
--- /dev/null
+++ b/helper/include/odp/helper/static_inline.h.in
@@ -0,0 +1,35 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * Macro for static inline functions
+ */
+
+#ifndef ODP_HELPER_STATIC_INLINE_H_
+#define ODP_HELPER_STATIC_INLINE_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @internal
+ * @def _HELPER_STATIC
+ * Control conditional static inline expansions for ABI compatibility
+ */
+#if @ODP_HELPER_ABI_COMPAT@
+#define _HELPER_STATIC
+#else
+#define _HELPER_STATIC static inline
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/helper/m4/configure.m4 b/helper/m4/configure.m4
index 38c95d9..71b1f2d 100644
--- a/helper/m4/configure.m4
+++ b/helper/m4/configure.m4
@@ -20,4 +20,5 @@  AC_ARG_ENABLE([helper-extn],
 	fi])
 
 AC_CONFIG_FILES([helper/Makefile
-		helper/test/Makefile])
+		helper/test/Makefile
+		helper/include/odp/helper/static_inline.h])
\ No newline at end of file