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 AF4DF45F83; Tue, 31 Dec 2024 19:38:49 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 087784042F; Tue, 31 Dec 2024 19:38:35 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 056DD402E0 for ; Tue, 31 Dec 2024 19:38:28 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id 06D6F2046767; Tue, 31 Dec 2024 10:38:28 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 06D6F2046767 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1735670308; bh=ryh+L3KJIa7nKPhKDPKosuNqg0HNaPnkZqs8AtXZDwQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lHEUuJHsEL1q65JWREONMDASyCW2/5A/yovdf/RAzMwtS5lzS3RJ693PBbEvJ2YBM 4ckLVwarmIheOiT8SjyrraTuuMirTgTUg07zYHYKKPTpHecIEdiU4tMG8dxJO9NyTY PCIAVevNTkTThFb/fJQhMrpdQ5clwY5tCjUsr3ns= From: Andre Muezerie To: roretzla@linux.microsoft.com Cc: aman.deep.singh@intel.com, anatoly.burakov@intel.com, bruce.richardson@intel.com, byron.marohn@intel.com, conor.walsh@intel.com, cristian.dumitrescu@intel.com, david.hunt@intel.com, dev@dpdk.org, dsosnowski@nvidia.com, gakhil@marvell.com, jerinj@marvell.com, jingjing.wu@intel.com, kirill.rybalchenko@intel.com, konstantin.v.ananyev@yandex.ru, matan@nvidia.com, mb@smartsharesystems.com, orika@nvidia.com, radu.nicolau@intel.com, ruifeng.wang@arm.com, sameh.gobriel@intel.com, sivaprasad.tummala@amd.com, skori@marvell.com, stephen@networkplumber.org, suanmingm@nvidia.com, vattunuru@marvell.com, viacheslavo@nvidia.com, vladimir.medvedkin@intel.com, yipeng1.wang@intel.com, Andre Muezerie Subject: [PATCH v8 01/29] devtools: check packed attributes Date: Tue, 31 Dec 2024 10:37:43 -0800 Message-Id: <1735670291-23224-2-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1735670291-23224-1-git-send-email-andremue@linux.microsoft.com> References: <1710968771-16435-1-git-send-email-roretzla@linux.microsoft.com> <1735670291-23224-1-git-send-email-andremue@linux.microsoft.com> 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 Ensure __rte_packed_begin and __rte_packed_end show up in pairs when checking patches. Signed-off-by: Andre Muezerie Acked-by: Tyler Retzlaff --- devtools/checkpatches.sh | 43 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh index 4a8591be22..7868f5e522 100755 --- a/devtools/checkpatches.sh +++ b/devtools/checkpatches.sh @@ -202,6 +202,14 @@ check_forbidden_additions() { # -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \ "$1" || res=1 + # forbid use of __rte_packed_begin with enums + awk -v FOLDERS='lib drivers app examples' \ + -v EXPRESSIONS='enum.*__rte_packed_begin' \ + -v RET_ON_FAIL=1 \ + -v MESSAGE='Using __rte_packed_begin with enum is not allowed' \ + -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \ + "$1" || res=1 + # forbid use of experimental build flag except in examples awk -v FOLDERS='lib drivers app' \ -v EXPRESSIONS='-DALLOW_EXPERIMENTAL_API allow_experimental_apis' \ @@ -362,6 +370,33 @@ check_aligned_attributes() { # return $res } +check_packed_attributes() { # + res=0 + + if [ $(grep -E '^\+.*__rte_packed_begin' "$1" | \ + grep -vE '\' | \ + grep -vE '\' | \ + grep -vE '\<__rte_cache_aligned[[:space:]]*__rte_packed_begin\>' | \ + grep -vE '\<__rte_cache_min_aligned[[:space:]]*__rte_packed_begin\>' | \ + grep -vE '\<__rte_aligned\(.*\)[[:space:]]*__rte_packed_begin\>' | \ + wc -l) != 0 ]; then + echo "Please use __rte_packed_begin only after struct, union," \ + " __rte_cache_aligned, __rte_cache_min_aligned or __rte_aligned." + res=1 + fi + + begin_count=$(grep '__rte_packed_begin' "$1" | \ + wc -l) + end_count=$(grep '__rte_packed_end' "$1" | \ + wc -l) + if [ $begin_count != $end_count ]; then + echo "__rte_packed_begin and __rte_packed_end mismatch. They should always be used in pairs." + res=1 + fi + + return $res +} + check_release_notes() { # rel_notes_prefix=doc/guides/rel_notes/release_ IFS=. read year month release < VERSION @@ -479,6 +514,14 @@ check () { # ret=1 fi + ! $verbose || printf '\nChecking packed attributes:\n' + report=$(check_packed_attributes "$tmpinput") + if [ $? -ne 0 ] ; then + $headline_printed || print_headline "$subject" + printf '%s\n' "$report" + ret=1 + fi + ! $verbose || printf '\nChecking release notes updates:\n' report=$(check_release_notes "$tmpinput") if [ $? -ne 0 ] ; then -- 2.47.0.vfs.0.3