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 <konrad.sztyber@intel.com>
Change-Id: I735cf10d4524318009f8c4282a86e4137bf8c769
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15428
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Konrad Sztyber 2022-11-14 12:22:31 +01:00 committed by Tomasz Zawadzki
parent 3242d3c524
commit 5e911c0c06

View File

@ -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"