Commit 5e911c0c authored by Konrad Sztyber's avatar Konrad Sztyber Committed by Tomasz Zawadzki
Browse files

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: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I735cf10d4524318009f8c4282a86e4137bf8c769
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15428


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 3242d3c5
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -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"