[v6,01/30] devtools: check packed attributes
Checks
Commit Message
Ensure __rte_packed_begin and __rte_packed_end show up in pairs
when checking patches.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
devtools/checkpatches.sh | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
Comments
On Tue, Nov 26, 2024 at 04:52:12PM -0800, Andre Muezerie wrote:
> Ensure __rte_packed_begin and __rte_packed_end show up in pairs
> when checking patches.
>
> Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
> ---
Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
@@ -362,6 +362,21 @@ check_aligned_attributes() { # <patch>
return $res
}
+check_packed_attributes() { # <patch>
+ res=0
+
+ 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() { # <patch>
rel_notes_prefix=doc/guides/rel_notes/release_
IFS=. read year month release < VERSION
@@ -479,6 +494,14 @@ check () { # <patch-file> <commit>
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