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 EFF69A00C5; Tue, 15 Feb 2022 18:30:54 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A22BD41155; Tue, 15 Feb 2022 18:30:49 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 95C9741154 for ; Tue, 15 Feb 2022 18:30:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644946247; x=1676482247; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tU+l8SPSE8XWp/UxmbRD7yp48IoZMFJSCGEU2zCRaTU=; b=egsWwFb/iL30r27HJKgtedXA6w4il0bdIhu+pYEdGoUsfyL5aMNFC+8V B4cp/KuLEUSR3ycXCBfyknJdCzs/RyLxPnJk7kLUlDWjnsOYA8uaWn1Gx tjHOZqHXZ+lIOXY6Rxyk2N1p/gcy/zbOO9v3JONgfmYr7A0m1+3ZBstyG 7abN4e0GU3/ZiApSynlWMPu6prKBXTi70WU7zTU3OYBovfdTdJYSL3A7c Xld2FrlVJJPOe+EeW8XFCHB7dtVbNfbpS1Dxya9bDKfa2vldmv0M3xZ0S gFsPiM1IrPurzONDLR5azCgzJqGHVQ+bBxeuEr6W5HPrmkGfreNCfijev Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10259"; a="250608828" X-IronPort-AV: E=Sophos;i="5.88,371,1635231600"; d="scan'208";a="250608828" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Feb 2022 09:30:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,371,1635231600"; d="scan'208";a="570927459" Received: from silpixa00399126.ir.intel.com ([10.237.223.192]) by orsmga001.jf.intel.com with ESMTP; 15 Feb 2022 09:30:46 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Subject: [PATCH 3/3] buildtools/chkincs: add checks for missing C++ guards Date: Tue, 15 Feb 2022 17:30:29 +0000 Message-Id: <20220215173029.1893710-4-bruce.richardson@intel.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220215173029.1893710-1-bruce.richardson@intel.com> References: <20220215173029.1893710-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Simply compiling a C header with a C++ compiler is not enough to flag missing 'extern "C"' guards. To catch missing guards, we can just use a simple grep for the 'extern "C"' part, and error out if any files have a miss. Signed-off-by: Bruce Richardson --- Depends-on: series-21685 ("add missing C++ guards") --- buildtools/chkincs/meson.build | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/buildtools/chkincs/meson.build b/buildtools/chkincs/meson.build index 9442235200..77ef59fb13 100644 --- a/buildtools/chkincs/meson.build +++ b/buildtools/chkincs/meson.build @@ -37,6 +37,16 @@ if not add_languages('cpp', required: false) subdir_done() endif +# check for extern C in files, since this is not detected as an error by the compiler +grep = find_program('grep', required: false) +if grep.found() + errlist = run_command([grep, '--files-without-match', '^extern "C"', dpdk_chkinc_headers], + check: false, capture: true).stdout().split() + if errlist != [] + error('Files missing C++ \'extern "C"\' guards:\n- ' + '\n- '.join(errlist)) + endif +endif + gen_cpp_files = generator(gen_c_file_for_header, output: '@BASENAME@.cpp', arguments: ['@INPUT@', '@OUTPUT@']) -- 2.32.0