Commit de016f27 authored by Tomasz Zawadzki's avatar Tomasz Zawadzki
Browse files

scripts/check_format: match exact string when moving symbols



Original code removed $symbol prefix from every entry in
$defined_symbols. This was incorrect shown by example
patch next in series.

Original function spdk_json_decode_object() was moved
and spdk_json_decode_object_relaxed() was added.
This resulted in $defined_symbols containing entry "_relaxed".

Now each entry in $defined_symbols is checked separatly to
match exactly to the removed $symbol.

Reported-by: default avatarJacek Kalwas <jacek.kalwas@intel.com>
Signed-off-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I1d9931d2e93dc85465ce47a838a176c6ab5f1587
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4357


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarMichal Berger <michalx.berger@intel.com>
parent a1dfb34a
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -283,7 +283,11 @@ function check_naming_conventions() {
		# Capture the names of removed symbols to catch edge cases where we just move definitions around.
		mapfile -t removed_symbols < <(git diff -U0 $commit_to_compare HEAD -- $c_file | sed -En 's/(^[-])(spdk[a-z,A-Z,0-9,_]*)(\(.*)/\2/p')
		for symbol in "${removed_symbols[@]}"; do
			defined_symbols=("${defined_symbols[@]/$symbol/}")
			for i in "${!defined_symbols[@]}"; do
				if [[ ${defined_symbols[i]} = "$symbol" ]]; then
					unset -v 'defined_symbols[i]'
				fi
			done
		done
		# It's possible that we just modified a functions arguments so unfortunately we can't just look at changed lines in this function.
		# matching groups are 1. All leading whitespace 2. function name. Capture just the symbol name.