From: Bruce Richardson <bruce.richardson@intel.com>
To: Weiguo Li <liwg06@foxmail.com>
Cc: dev@dpdk.org
Subject: Re: [PATCH 0/6] fix the curly braces mismatch problem
Date: Mon, 7 Feb 2022 09:29:58 +0000 [thread overview]
Message-ID: <YgDmln6Qd3SMFg9o@bricha3-MOBL.ger.corp.intel.com> (raw)
In-Reply-To: <tencent_F6238474ECBE8F462E456862FE79944E5109@qq.com>
On Sun, Feb 06, 2022 at 08:44:08AM +0800, Weiguo Li wrote:
> 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.
>
Any headers that have filenames not starting with "rte_" are internal
headers, and so should have the guards removed. Therefore, I think that
most patches in this set should just be removing guards. From my tests with
building our public headers in C++ files, resulting in series[1], I only
found one public header with an incorrect guard.
/Bruce
[1]http://patches.dpdk.org/project/dpdk/list/?series=21466
next prev parent reply other threads:[~2022-02-07 9:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-06 0:44 Weiguo Li
2022-02-07 9:29 ` Bruce Richardson [this message]
2022-02-07 11:44 ` Weiguo Li
2022-02-07 13:39 ` Bruce Richardson
2022-02-08 16:21 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YgDmln6Qd3SMFg9o@bricha3-MOBL.ger.corp.intel.com \
--to=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=liwg06@foxmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).