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: Jacek Kalwas <jacek.kalwas@intel.com> Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Change-Id: I1d9931d2e93dc85465ce47a838a176c6ab5f1587 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4357 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Michal Berger <michalx.berger@intel.com>
This commit is contained in:
parent
a1dfb34ad5
commit
de016f2756
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user