Use lower-case for local variables
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
parent
3cde6a2be2
commit
28e38d8e12
1 changed files with 31 additions and 31 deletions
|
@ -3939,70 +3939,70 @@ build_test_config_combos() {
|
||||||
# syntax: build_test_config_combos FILE VALIDATOR_FUNCTION OPT1 OPT2 ...
|
# syntax: build_test_config_combos FILE VALIDATOR_FUNCTION OPT1 OPT2 ...
|
||||||
# The validator function may be "" if all combinations are valid
|
# The validator function may be "" if all combinations are valid
|
||||||
|
|
||||||
FILE=$1
|
file=$1
|
||||||
shift
|
shift
|
||||||
# this function must echo something iff the clang "-DA -DB ..." string is invalid
|
# this function must echo something iff the clang "-DA -DB ..." string is invalid
|
||||||
VALIDATE_OPTIONS=$1
|
validate_options=$1
|
||||||
shift
|
shift
|
||||||
OPTIONS=("$@")
|
options=("$@")
|
||||||
|
|
||||||
# clear all of the options so that they can be overridden on the clang commandline
|
# clear all of the options so that they can be overridden on the clang commandline
|
||||||
for OPT in "${OPTIONS[@]}"; do
|
for opt in "${options[@]}"; do
|
||||||
./scripts/config.py unset ${OPT}
|
./scripts/config.py unset ${opt}
|
||||||
done
|
done
|
||||||
|
|
||||||
# enter the directory containing the target file & strip the dir from the filename
|
# enter the directory containing the target file & strip the dir from the filename
|
||||||
cd $(dirname ${FILE})
|
cd $(dirname ${file})
|
||||||
FILE=$(basename ${FILE})
|
file=$(basename ${file})
|
||||||
|
|
||||||
# The most common issue is unused variables/functions, so ensure -Wunused is set.
|
# The most common issue is unused variables/functions, so ensure -Wunused is set.
|
||||||
WARNING_FLAGS="-Werror -Wall -Wextra -Wwrite-strings -Wpointer-arith -Wimplicit-fallthrough -Wshadow -Wvla -Wformat=2 -Wno-format-nonliteral -Wshadow -Wasm-operand-widths -Wunused"
|
warning_flags="-Werror -Wall -Wextra -Wwrite-strings -Wpointer-arith -Wimplicit-fallthrough -Wshadow -Wvla -Wformat=2 -Wno-format-nonliteral -Wshadow -Wasm-operand-widths -Wunused"
|
||||||
|
|
||||||
# Extract the command generated by the Makefile to build the target file.
|
# Extract the command generated by the Makefile to build the target file.
|
||||||
# This ensures that we have any include paths, macro definitions, etc
|
# This ensures that we have any include paths, macro definitions, etc
|
||||||
# that may be applied by make.
|
# that may be applied by make.
|
||||||
# Add -fsyntax-only as we only want a syntax check and don't need to generate a file.
|
# Add -fsyntax-only as we only want a syntax check and don't need to generate a file.
|
||||||
COMPILE_CMD=$(make -B -n ${FILE} CC=clang CFLAGS="${WARNING_FLAGS} -fsyntax-only" | egrep "^clang")
|
compile_cmd=$(make -B -n ${file} CC=clang CFLAGS="${warning_flags} -fsyntax-only" | egrep "^clang")
|
||||||
|
|
||||||
MAKEFILE=$(mktemp)
|
makefile=$(mktemp)
|
||||||
DEPS=""
|
deps=""
|
||||||
|
|
||||||
LEN=${#OPTIONS[@]}
|
len=${#options[@]}
|
||||||
|
|
||||||
for ((i = 0; i < $((2**${LEN})); i++)); do
|
for ((i = 0; i < $((2**${len})); i++)); do
|
||||||
# generate each of 2^n combinations of options
|
# generate each of 2^n combinations of options
|
||||||
# each bit of $i is used to determine if OPTIONS[i] will be set or not
|
# each bit of $i is used to determine if options[i] will be set or not
|
||||||
TARGET="t"
|
target="t"
|
||||||
CLANG_ARGS=""
|
clang_args=""
|
||||||
for ((j = 0; j < ${LEN}; j++)); do
|
for ((j = 0; j < ${len}; j++)); do
|
||||||
OPT=${OPTIONS[j]}
|
opt=${options[j]}
|
||||||
X=$(((i >> j) & 1))
|
X=$(((i >> j) & 1))
|
||||||
[[ $X == 0 ]] && OPT="" || OPT="-D${OPT}"
|
[[ $X == 0 ]] && opt="" || opt="-D${opt}"
|
||||||
CLANG_ARGS="${CLANG_ARGS} ${OPT}"
|
clang_args="${clang_args} ${opt}"
|
||||||
TARGET="${TARGET}${OPT}"
|
target="${target}${opt}"
|
||||||
done
|
done
|
||||||
|
|
||||||
# check that combination is not known to be invalid
|
# check that combination is not known to be invalid
|
||||||
INVALID=""
|
invalid=""
|
||||||
[[ "$VALIDATE_OPTIONS" != "" ]] && INVALID=$(${VALIDATE_OPTIONS} "${CLANG_ARGS}")
|
[[ "$validate_options" != "" ]] && invalid=$(${validate_options} "${clang_args}")
|
||||||
|
|
||||||
# if valid, add it to the makefile
|
# if valid, add it to the makefile
|
||||||
if [[ "$INVALID" == "" ]]; then
|
if [[ "$invalid" == "" ]]; then
|
||||||
cmd="${COMPILE_CMD} ${CLANG_ARGS}"
|
cmd="${compile_cmd} ${clang_args}"
|
||||||
echo "${TARGET}:" >> ${MAKEFILE}
|
echo "${target}:" >> ${makefile}
|
||||||
echo -e "\t$cmd" >> ${MAKEFILE}
|
echo -e "\t$cmd" >> ${makefile}
|
||||||
|
|
||||||
DEPS="${DEPS} ${TARGET}"
|
deps="${deps} ${target}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "all: ${DEPS}" >> ${MAKEFILE}
|
echo "all: ${deps}" >> ${makefile}
|
||||||
|
|
||||||
# execute all of the commands via Make (probably in parallel)
|
# execute all of the commands via Make (probably in parallel)
|
||||||
make -s -f ${MAKEFILE} all
|
make -s -f ${makefile} all
|
||||||
|
|
||||||
# clean up the temporary makefile
|
# clean up the temporary makefile
|
||||||
rm ${MAKEFILE}
|
rm ${makefile}
|
||||||
}
|
}
|
||||||
|
|
||||||
validate_aes_config_variations() {
|
validate_aes_config_variations() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue