Commit 43cec44b authored by John Koleszar's avatar John Koleszar
Browse files

Remove 'local' variables in rtcd.sh

These aren't required to be supported by sh.

Change-Id: I54d641a2377531e0b320676d29d4ecdeee82288a
parent 0ef72720
...@@ -59,13 +59,13 @@ for f in $defs_file; do [ -f "$f" ] || usage; done ...@@ -59,13 +59,13 @@ for f in $defs_file; do [ -f "$f" ] || usage; done
# Routines for the RTCD DSL to call # Routines for the RTCD DSL to call
# #
prototype() { prototype() {
local rtyp rtyp=""
case "$1" in case "$1" in
unsigned) rtyp="$1 "; shift;; unsigned) rtyp="$1 "; shift;;
esac esac
rtyp="${rtyp}$1" rtyp="${rtyp}$1"
local fn="$2" fn="$2"
local args="$3" args="$3"
eval "${2}_rtyp='$rtyp'" eval "${2}_rtyp='$rtyp'"
eval "${2}_args='$3'" eval "${2}_args='$3'"
...@@ -74,7 +74,7 @@ prototype() { ...@@ -74,7 +74,7 @@ prototype() {
} }
specialize() { specialize() {
local fn="$1" fn="$1"
shift shift
for opt in "$@"; do for opt in "$@"; do
eval "${fn}_${opt}=${fn}_${opt}" eval "${fn}_${opt}=${fn}_${opt}"
...@@ -84,13 +84,13 @@ specialize() { ...@@ -84,13 +84,13 @@ specialize() {
require() { require() {
for fn in $ALL_FUNCS; do for fn in $ALL_FUNCS; do
for opt in "$@"; do for opt in "$@"; do
local ofn=$(eval "echo \$${fn}_${opt}") ofn=$(eval "echo \$${fn}_${opt}")
[ -z "$ofn" ] && continue [ -z "$ofn" ] && continue
# if we already have a default, then we can disable it, as we know # if we already have a default, then we can disable it, as we know
# we can do better. # we can do better.
local best=$(eval "echo \$${fn}_default") best=$(eval "echo \$${fn}_default")
local best_ofn=$(eval "echo \$${best}") best_ofn=$(eval "echo \$${best}")
[ -n "$best" ] && [ "$best_ofn" != "$ofn" ] && eval "${best}_link=false" [ -n "$best" ] && [ "$best_ofn" != "$ofn" ] && eval "${best}_link=false"
eval "${fn}_default=${fn}_${opt}" eval "${fn}_default=${fn}_${opt}"
eval "${fn}_${opt}_link=true" eval "${fn}_${opt}_link=true"
...@@ -121,15 +121,15 @@ process_forward_decls() { ...@@ -121,15 +121,15 @@ process_forward_decls() {
determine_indirection() { determine_indirection() {
[ "$CONFIG_RUNTIME_CPU_DETECT" = "yes" ] || require $ALL_ARCHS [ "$CONFIG_RUNTIME_CPU_DETECT" = "yes" ] || require $ALL_ARCHS
for fn in $ALL_FUNCS; do for fn in $ALL_FUNCS; do
local n="" n=""
local rtyp="$(eval "echo \$${fn}_rtyp")" rtyp="$(eval "echo \$${fn}_rtyp")"
local args="$(eval "echo \"\$${fn}_args\"")" args="$(eval "echo \"\$${fn}_args\"")"
local dfn="$(eval "echo \$${fn}_default")" dfn="$(eval "echo \$${fn}_default")"
dfn=$(eval "echo \$${dfn}") dfn=$(eval "echo \$${dfn}")
for opt in "$@"; do for opt in "$@"; do
local ofn=$(eval "echo \$${fn}_${opt}") ofn=$(eval "echo \$${fn}_${opt}")
[ -z "$ofn" ] && continue [ -z "$ofn" ] && continue
local link=$(eval "echo \$${fn}_${opt}_link") link=$(eval "echo \$${fn}_${opt}_link")
[ "$link" = "false" ] && continue [ "$link" = "false" ] && continue
n="${n}x" n="${n}x"
done done
...@@ -143,12 +143,12 @@ determine_indirection() { ...@@ -143,12 +143,12 @@ determine_indirection() {
declare_function_pointers() { declare_function_pointers() {
for fn in $ALL_FUNCS; do for fn in $ALL_FUNCS; do
local rtyp="$(eval "echo \$${fn}_rtyp")" rtyp="$(eval "echo \$${fn}_rtyp")"
local args="$(eval "echo \"\$${fn}_args\"")" args="$(eval "echo \"\$${fn}_args\"")"
local dfn="$(eval "echo \$${fn}_default")" dfn="$(eval "echo \$${fn}_default")"
dfn=$(eval "echo \$${dfn}") dfn=$(eval "echo \$${dfn}")
for opt in "$@"; do for opt in "$@"; do
local ofn=$(eval "echo \$${fn}_${opt}") ofn=$(eval "echo \$${fn}_${opt}")
[ -z "$ofn" ] && continue [ -z "$ofn" ] && continue
echo "$rtyp ${ofn}($args);" echo "$rtyp ${ofn}($args);"
done done
...@@ -163,20 +163,20 @@ declare_function_pointers() { ...@@ -163,20 +163,20 @@ declare_function_pointers() {
set_function_pointers() { set_function_pointers() {
for fn in $ALL_FUNCS; do for fn in $ALL_FUNCS; do
local n="" n=""
local rtyp="$(eval "echo \$${fn}_rtyp")" rtyp="$(eval "echo \$${fn}_rtyp")"
local args="$(eval "echo \"\$${fn}_args\"")" args="$(eval "echo \"\$${fn}_args\"")"
local dfn="$(eval "echo \$${fn}_default")" dfn="$(eval "echo \$${fn}_default")"
dfn=$(eval "echo \$${dfn}") dfn=$(eval "echo \$${dfn}")
if $(eval "echo \$${fn}_indirect"); then if $(eval "echo \$${fn}_indirect"); then
echo " $fn = $dfn;" echo " $fn = $dfn;"
for opt in "$@"; do for opt in "$@"; do
local ofn=$(eval "echo \$${fn}_${opt}") ofn=$(eval "echo \$${fn}_${opt}")
[ -z "$ofn" ] && continue [ -z "$ofn" ] && continue
[ "$ofn" = "$dfn" ] && continue; [ "$ofn" = "$dfn" ] && continue;
local link=$(eval "echo \$${fn}_${opt}_link") link=$(eval "echo \$${fn}_${opt}_link")
[ "$link" = "false" ] && continue [ "$link" = "false" ] && continue
local cond="$(eval "echo \$have_${opt}")" cond="$(eval "echo \$have_${opt}")"
echo " if (${cond}) $fn = $ofn;" echo " if (${cond}) $fn = $ofn;"
done done
fi fi
...@@ -185,7 +185,7 @@ set_function_pointers() { ...@@ -185,7 +185,7 @@ set_function_pointers() {
} }
filter() { filter() {
local filtered filtered=""
for opt in "$@"; do for opt in "$@"; do
[ -z $(eval "echo \$disable_${opt}") ] && filtered="$filtered $opt" [ -z $(eval "echo \$disable_${opt}") ] && filtered="$filtered $opt"
done done
...@@ -196,8 +196,8 @@ filter() { ...@@ -196,8 +196,8 @@ filter() {
# Helper functions for generating the arch specific RTCD files # Helper functions for generating the arch specific RTCD files
# #
common_top() { common_top() {
local outfile_basename=$(basename ${symbol:-rtcd.h}) outfile_basename=$(basename ${symbol:-rtcd.h})
local include_guard=$(echo $outfile_basename | tr '[a-z]' '[A-Z]' | tr -c '[A-Z]' _) include_guard=$(echo $outfile_basename | tr '[a-z]' '[A-Z]' | tr -c '[A-Z]' _)
cat <<EOF cat <<EOF
#ifndef ${include_guard} #ifndef ${include_guard}
#define ${include_guard} #define ${include_guard}
...@@ -227,7 +227,7 @@ x86() { ...@@ -227,7 +227,7 @@ x86() {
# Assign the helper variable for each enabled extension # Assign the helper variable for each enabled extension
for opt in $ALL_ARCHS; do for opt in $ALL_ARCHS; do
local uc=$(echo $opt | tr '[a-z]' '[A-Z]') uc=$(echo $opt | tr '[a-z]' '[A-Z]')
eval "have_${opt}=\"flags & HAS_${uc}\"" eval "have_${opt}=\"flags & HAS_${uc}\""
done done
...@@ -254,7 +254,7 @@ arm() { ...@@ -254,7 +254,7 @@ arm() {
# Assign the helper variable for each enabled extension # Assign the helper variable for each enabled extension
for opt in $ALL_ARCHS; do for opt in $ALL_ARCHS; do
local uc=$(echo $opt | tr '[a-z]' '[A-Z]') uc=$(echo $opt | tr '[a-z]' '[A-Z]')
eval "have_${opt}=\"flags & HAS_${uc}\"" eval "have_${opt}=\"flags & HAS_${uc}\""
done done
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment