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

Thomas Monjalon thomas at monjalon.net
Wed Apr 3 16:52:18 CEST 2024


02/04/2024 18:03, Ashish Sadanandan:
> 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.

I remember we were discussing about aligning all files.
I was waiting for a patch applying the rule we discussed.


> 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(-)
> >
> > --- a/doc/guides/contributing/coding_style.rst
> > +++ b/doc/guides/contributing/coding_style.rst
> > +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_ */

This is not describing where the includes should be placed.




More information about the stable mailing list