From 5e911c0c06ced634748f0a52c8c3eb0ceabbbf54 Mon Sep 17 00:00:00 2001 From: Konrad Sztyber Date: Mon, 14 Nov 2022 12:22:31 +0100 Subject: [PATCH] check_format: search all declarations in naming conv check Look for all declarations instead of only the ones introduced in the tested patch. It makes this test pass if a patch adds definition for a function that already has a declaration in the header file (e.g. the implementation depends on some #ifdef). Signed-off-by: Konrad Sztyber Change-Id: I735cf10d4524318009f8c4282a86e4137bf8c769 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15428 Tested-by: SPDK CI Jenkins Reviewed-by: Tomasz Zawadzki Reviewed-by: Jim Harris --- scripts/check_format.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/check_format.sh b/scripts/check_format.sh index d62f221f2..137d9ef36 100755 --- a/scripts/check_format.sh +++ b/scripts/check_format.sh @@ -296,9 +296,9 @@ function check_naming_conventions() { # Build an array of all the modified C libraries. mapfile -t changed_c_libs < <(git diff --name-only HEAD $commit_to_compare -- lib/**/*.c module/**/*.c | xargs -r dirname | sort | uniq) - # Matching groups are 1. qualifiers / return type. 2. function name 3. argument list / comments and stuff after that. - # Capture just the names of newly added (or modified) function definitions. - mapfile -t declared_symbols < <(git diff -U0 $commit_to_compare HEAD -- include/spdk*/*.h | sed -En 's/(^[+].*)(spdk[a-z,A-Z,0-9,_]*)(\(.*)/\2/p') + # Capture the names of all function declarations + mapfile -t declared_symbols < <(grep -Eh 'spdk_[a-zA-Z0-9_]*\(' include/spdk*/*.h \ + | sed -En 's/.*(spdk[a-z,A-Z,0-9,_]*)\(.*/\1/p') for c_lib in "${changed_c_libs[@]}"; do lib_map_file="mk/spdk_blank.map"