Commit f188b2ce authored by Kajol Jain's avatar Kajol Jain Committed by Arnaldo Carvalho de Melo

perf beauty arch_errno_names: Fix shellcheck issue about local variables

Running shellcheck on arch_errno_names.sh generates below warning:

In arch_errno_names.sh line 20:
	local arch="$1"
        ^--------^ SC3043 (warning): In POSIX sh, 'local' is undefined.

......

In arch_errno_names.sh line 61:
	local arch
        ^--------^ SC3043 (warning): In POSIX sh, 'local' is undefined.

In arch_errno_names.sh line 67:
		printf '\t\treturn errno_to_name__%s(err);\n' $(arch_string "$arch")
                                                              ^--------------------^ SC2046 (warning): Quote this to prevent word splitting.

In arch_errno_names.sh line 69:
	printf '\treturn errno_to_name__%s(err);\n' $(arch_string "$default")
                                                    ^-----------------------^ SC2046 (warning): Quote this to prevent word splitting.

Fixed the warnings by:
- Fixing shellcheck warnings for local usage, by removing
  local from the variable names
- Adding quotes to avoid word splitting
Signed-off-by: default avatarKajol Jain <kjain@linux.ibm.com>
Acked-by: default avatarIan Rogers <irogers@google.com>
Cc: Disha Goel <disgoel@linux.vnet.ibm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/r/20230709182800.53002-15-atrajeev@linux.vnet.ibm.comSigned-off-by: default avatarAthira Rajeev <atrajeev@linux.vnet.ibm.com>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 05ef238c
...@@ -17,8 +17,7 @@ arch_string() ...@@ -17,8 +17,7 @@ arch_string()
asm_errno_file() asm_errno_file()
{ {
local arch="$1" arch="$1"
local header
header="$toolsdir/arch/$arch/include/uapi/asm/errno.h" header="$toolsdir/arch/$arch/include/uapi/asm/errno.h"
if test -r "$header"; then if test -r "$header"; then
...@@ -30,8 +29,7 @@ asm_errno_file() ...@@ -30,8 +29,7 @@ asm_errno_file()
create_errno_lookup_func() create_errno_lookup_func()
{ {
local arch=$(arch_string "$1") arch=$(arch_string "$1")
local nr name
printf "static const char *errno_to_name__%s(int err)\n{\n\tswitch (err) {\n" $arch printf "static const char *errno_to_name__%s(int err)\n{\n\tswitch (err) {\n" $arch
...@@ -44,8 +42,8 @@ create_errno_lookup_func() ...@@ -44,8 +42,8 @@ create_errno_lookup_func()
process_arch() process_arch()
{ {
local arch="$1" arch="$1"
local asm_errno=$(asm_errno_file "$arch") asm_errno=$(asm_errno_file "$arch")
$gcc $CFLAGS $include_path -E -dM -x c $asm_errno \ $gcc $CFLAGS $include_path -E -dM -x c $asm_errno \
|grep -hE '^#define[[:blank:]]+(E[^[:blank:]]+)[[:blank:]]+([[:digit:]]+).*' \ |grep -hE '^#define[[:blank:]]+(E[^[:blank:]]+)[[:blank:]]+([[:digit:]]+).*' \
...@@ -56,9 +54,8 @@ process_arch() ...@@ -56,9 +54,8 @@ process_arch()
create_arch_errno_table_func() create_arch_errno_table_func()
{ {
local archlist="$1" archlist="$1"
local default="$2" default="$2"
local arch
printf 'const char *arch_syscalls__strerrno(const char *arch, int err)\n' printf 'const char *arch_syscalls__strerrno(const char *arch, int err)\n'
printf '{\n' printf '{\n'
......
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