[PATCH v3 1/1] eal: add C++ include guard in generic/rte_vect.h

Ashish Sadanandan ashish.sadanandan at gmail.com
Tue Apr 2 18:03:07 CEST 2024


Hi everyone,
I've made the updates as suggested. Could someone please review the latest
patchset? Not sure if I followed the new patchset instructions correctly,
I've always had trouble with that part.

Thanks,
Ashish.

On Sun, Mar 17, 2024 at 8:44 PM Ashish Sadanandan <
ashish.sadanandan at gmail.com> wrote:

> The header was missing the extern "C" directive which causes name
> mangling of functions by C++ compilers, leading to linker errors
> complaining of undefined references to these functions.
>
> Also updated the coding style contribution guideline with a new
> "Language Linkage" section stating `extern "C"` block should be added to
> public headers.
>
> Fixes: 86c743cf9140 ("eal: define generic vector types")
> Cc: nelio.laranjeiro at 6wind.com
> Cc: stable at dpdk.org
>
> Signed-off-by: Ashish Sadanandan <ashish.sadanandan at gmail.com>
> ---
>  .mailmap                                 |  2 +-
>  doc/guides/contributing/coding_style.rst | 21 +++++++++++++++++++++
>  lib/eal/include/generic/rte_vect.h       |  8 ++++++++
>  3 files changed, 30 insertions(+), 1 deletion(-)
>
> diff --git a/.mailmap b/.mailmap
> index 50726e1232..24de59ba89 100644
> --- a/.mailmap
> +++ b/.mailmap
> @@ -142,7 +142,7 @@ Ashijeet Acharya <ashijeet.acharya at 6wind.com>
>  Ashish Gupta <ashishg at marvell.com> <ashish.gupta at marvell.com> <
> ashish.gupta at caviumnetworks.com>
>  Ashish Jain <ashish.jain at nxp.com>
>  Ashish Paul <apaul at juniper.net>
> -Ashish Sadanandan <ashish.sadanandan at gmail.com>
> +Ashish Sadanandan <ashish.sadanandan at gmail.com> <
> quic_asadanan at quicinc.com>
>  Ashish Shah <ashish.n.shah at intel.com>
>  Ashwin Sekhar T K <asekhar at marvell.com> <ashwin.sekhar at caviumnetworks.com
> >
>  Asim Jamshed <asim.jamshed at gmail.com>
> diff --git a/doc/guides/contributing/coding_style.rst
> b/doc/guides/contributing/coding_style.rst
> index 1ebc79ca3c..27c947fcec 100644
> --- a/doc/guides/contributing/coding_style.rst
> +++ b/doc/guides/contributing/coding_style.rst
> @@ -106,6 +106,27 @@ Headers should be protected against multiple
> inclusion with the usual:
>
>     #endif /* _FILE_H_ */
>
> +Language Linkage
> +~~~~~~~~~~~~~~~~
> +
> +Public headers should enclose all function and variable declarations and
> definitions in an ``extern "C"`` block to facilitate interoperability with
> C++.
> +
> +.. code-block:: c
> +
> +   #ifndef _FILE_H_
> +   #define _FILE_H_
> +
> +   #ifdef __cplusplus
> +   extern "C" {
> +   #endif
> +
> +   /* Code */
> +
> +   #ifdef __cplusplus
> +   }
> +   #endif
> +
> +   #endif /* _FILE_H_ */
>
>  Macros
>  ~~~~~~
> diff --git a/lib/eal/include/generic/rte_vect.h
> b/lib/eal/include/generic/rte_vect.h
> index 6540419cd2..3578d8749b 100644
> --- a/lib/eal/include/generic/rte_vect.h
> +++ b/lib/eal/include/generic/rte_vect.h
> @@ -15,6 +15,10 @@
>
>  #include <stdint.h>
>
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
>  #ifndef RTE_TOOLCHAIN_MSVC
>
>  /* Unsigned vector types */
> @@ -226,4 +230,8 @@ uint16_t rte_vect_get_max_simd_bitwidth(void);
>   */
>  int rte_vect_set_max_simd_bitwidth(uint16_t bitwidth);
>
> +#ifdef __cplusplus
> +}
> +#endif
> +
>  #endif /* _RTE_VECT_H_ */
> --
> 2.31.1
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mails.dpdk.org/archives/stable/attachments/20240402/dc9d49a8/attachment.htm>


More information about the stable mailing list