From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 68C43A034F; Mon, 7 Feb 2022 10:30:08 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E329B410EA; Mon, 7 Feb 2022 10:30:07 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id AED6C40DDA for ; Mon, 7 Feb 2022 10:30:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644226205; x=1675762205; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=LtmwA//VY+37WHiGLN7HBvJ7d4+wl4T4ODkmTDkWrXI=; b=YAUA/Oxy9WMHUVbvElGezsFDb/zbsos2W0KEM21zPr7IHMp9zP9JcVbc C43YIqpmgMMuRul/kalfXaFIK9JXbh77GblyvsKWxItStR6sO7hW0uu5l NyDcxso2bcB+W0nL93faOZ2P6OBlTx+uUbyLpjgrbSUhblWEXVKcpID3w ZtQYQwtkeszIpcK9KocdiurTe3KQc8d/m7u9jQkm4f123k7kzGPXrgzy4 RYHRPaOFyM03GlMSyQQDaneOJzkri/a7Mfi/e5KMVMbrXvYjMAoVlM1nE Lo5fv2OROYQa8r86j92tNClmDLmmyOAoMv5LwtxySliiZBtDbmWdXALCi Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10250"; a="246269668" X-IronPort-AV: E=Sophos;i="5.88,349,1635231600"; d="scan'208";a="246269668" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Feb 2022 01:30:04 -0800 X-IronPort-AV: E=Sophos;i="5.88,349,1635231600"; d="scan'208";a="481523403" Received: from bricha3-mobl.ger.corp.intel.com ([10.252.10.89]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-SHA; 07 Feb 2022 01:30:02 -0800 Date: Mon, 7 Feb 2022 09:29:58 +0000 From: Bruce Richardson To: Weiguo Li Cc: dev@dpdk.org Subject: Re: [PATCH 0/6] fix the curly braces mismatch problem Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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