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 ...
|
||||
# The validator function may be "" if all combinations are valid
|
||||
|
||||
FILE=$1
|
||||
file=$1
|
||||
shift
|
||||
# this function must echo something iff the clang "-DA -DB ..." string is invalid
|
||||
VALIDATE_OPTIONS=$1
|
||||
validate_options=$1
|
||||
shift
|
||||
OPTIONS=("$@")
|
||||
options=("$@")
|
||||
|
||||
# clear all of the options so that they can be overridden on the clang commandline
|
||||
for OPT in "${OPTIONS[@]}"; do
|
||||
./scripts/config.py unset ${OPT}
|
||||
for opt in "${options[@]}"; do
|
||||
./scripts/config.py unset ${opt}
|
||||
done
|
||||
|
||||
# enter the directory containing the target file & strip the dir from the filename
|
||||
cd $(dirname ${FILE})
|
||||
FILE=$(basename ${FILE})
|
||||
cd $(dirname ${file})
|
||||
file=$(basename ${file})
|
||||
|
||||
# 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.
|
||||
# This ensures that we have any include paths, macro definitions, etc
|
||||
# that may be applied by make.
|
||||
# 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)
|
||||
DEPS=""
|
||||
makefile=$(mktemp)
|
||||
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
|
||||
# each bit of $i is used to determine if OPTIONS[i] will be set or not
|
||||
TARGET="t"
|
||||
CLANG_ARGS=""
|
||||
for ((j = 0; j < ${LEN}; j++)); do
|
||||
OPT=${OPTIONS[j]}
|
||||
# each bit of $i is used to determine if options[i] will be set or not
|
||||
target="t"
|
||||
clang_args=""
|
||||
for ((j = 0; j < ${len}; j++)); do
|
||||
opt=${options[j]}
|
||||
X=$(((i >> j) & 1))
|
||||
[[ $X == 0 ]] && OPT="" || OPT="-D${OPT}"
|
||||
CLANG_ARGS="${CLANG_ARGS} ${OPT}"
|
||||
TARGET="${TARGET}${OPT}"
|
||||
[[ $X == 0 ]] && opt="" || opt="-D${opt}"
|
||||
clang_args="${clang_args} ${opt}"
|
||||
target="${target}${opt}"
|
||||
done
|
||||
|
||||
# check that combination is not known to be invalid
|
||||
INVALID=""
|
||||
[[ "$VALIDATE_OPTIONS" != "" ]] && INVALID=$(${VALIDATE_OPTIONS} "${CLANG_ARGS}")
|
||||
invalid=""
|
||||
[[ "$validate_options" != "" ]] && invalid=$(${validate_options} "${clang_args}")
|
||||
|
||||
# if valid, add it to the makefile
|
||||
if [[ "$INVALID" == "" ]]; then
|
||||
cmd="${COMPILE_CMD} ${CLANG_ARGS}"
|
||||
echo "${TARGET}:" >> ${MAKEFILE}
|
||||
echo -e "\t$cmd" >> ${MAKEFILE}
|
||||
if [[ "$invalid" == "" ]]; then
|
||||
cmd="${compile_cmd} ${clang_args}"
|
||||
echo "${target}:" >> ${makefile}
|
||||
echo -e "\t$cmd" >> ${makefile}
|
||||
|
||||
DEPS="${DEPS} ${TARGET}"
|
||||
deps="${deps} ${target}"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "all: ${DEPS}" >> ${MAKEFILE}
|
||||
echo "all: ${deps}" >> ${makefile}
|
||||
|
||||
# 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
|
||||
rm ${MAKEFILE}
|
||||
rm ${makefile}
|
||||
}
|
||||
|
||||
validate_aes_config_variations() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue