DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 0/6] fix the curly braces mismatch problem
@ 2022-02-06  0:44 Weiguo Li
  2022-02-07  9:29 ` Bruce Richardson
  2022-02-07 11:44 ` Weiguo Li
  0 siblings, 2 replies; 5+ messages in thread
From: Weiguo Li @ 2022-02-06  0:44 UTC (permalink / raw)
  To: dev

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(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-02-08 16:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-06  0:44 [PATCH 0/6] fix the curly braces mismatch problem Weiguo Li
2022-02-07  9:29 ` Bruce Richardson
2022-02-07 11:44 ` Weiguo Li
2022-02-07 13:39   ` Bruce Richardson
2022-02-08 16:21     ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).