mbox

[0/6] fix the curly braces mismatch problem

Message ID tencent_F6238474ECBE8F462E456862FE79944E5109@qq.com (mailing list archive)
Headers

Message

Weiguo Li Feb. 6, 2022, 12:44 a.m. UTC
  To make C header file compatible with C++ linking, a conventional
practice enclose the code with braces as below:

#ifdef __cplusplus
extern "C" {
#endif

...

#ifdef __cplusplus
}
#endif

Some alternative forms of "#ifdef __cplusplus", like 
"#if defined(__cplusplus)" or "# ifdef __cplusplus", also work.

While it's suspicious when a header file matchs this regular
expression "if.*__cplusplus" exactly once.

The following script is used to find these files:
grep -r ~/git/dpdk --include=*.h -e "if.*__cplusplus" -c|grep ":1$"

Apart from two false positive cases, I found some real issues --
some missing the left brace parts, the others missing the right
brace parts. 

In one of the cases, the c++ guard is removed since it's useless in 
private header as previous patch (http://dpdk.org/patch/98948) noted.
For the other cases, the missing parts are supplemented.

Weiguo Li (6):
  bus/dpaa: fix the curly braces mismatch problem
  common/mlx5: fix the curly braces mismatch problem
  net/cxgbe: fix the curly braces mismatch problem
  net/dpaa2: fix the curly braces mismatch problem
  eal/windows: fix the curly braces mismatch problem
  eventdev: remove C++ include guard from private header

 drivers/bus/dpaa/include/fsl_fman.h         | 5 +++++
 drivers/bus/dpaa/rte_dpaa_bus.h             | 4 ++++
 drivers/common/mlx5/windows/mlx5_win_defs.h | 5 +++++
 drivers/common/mlx5/windows/mlx5_win_ext.h  | 4 ++++
 drivers/net/cxgbe/base/common.h             | 5 +++++
 drivers/net/dpaa2/dpaa2_sparser.h           | 5 +++++
 lib/eal/windows/include/dirent.h            | 4 ++++
 lib/eventdev/eventdev_pmd.h                 | 4 ----
 8 files changed, 32 insertions(+), 4 deletions(-)