Commit 36b5401b7669302bc4c35cea2e2cf4ae22e489dc
Committed by
Michal Marek
1 parent
95e2a7d807
Exists in
master
and in
20 other branches
scripts/checkkconfigsymbols.sh: replace echo -e with printf
-e is a non-standard echo option, echo output is implementation-dependent when it is used. Replace echo -e with printf as suggested by POSIX echo manual. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
Showing 1 changed file with 2 additions and 2 deletions Inline Diff
scripts/checkkconfigsymbols.sh
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | # Find Kconfig variables used in source code but never defined in Kconfig | 2 | # Find Kconfig variables used in source code but never defined in Kconfig |
3 | # Copyright (C) 2007, Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> | 3 | # Copyright (C) 2007, Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> |
4 | 4 | ||
5 | # Tested with dash. | 5 | # Tested with dash. |
6 | paths="$@" | 6 | paths="$@" |
7 | [ -z "$paths" ] && paths=. | 7 | [ -z "$paths" ] && paths=. |
8 | 8 | ||
9 | # Doing this once at the beginning saves a lot of time, on a cache-hot tree. | 9 | # Doing this once at the beginning saves a lot of time, on a cache-hot tree. |
10 | Kconfigs="`find . -name 'Kconfig' -o -name 'Kconfig*[^~]'`" | 10 | Kconfigs="`find . -name 'Kconfig' -o -name 'Kconfig*[^~]'`" |
11 | 11 | ||
12 | /bin/echo -e "File list \tundefined symbol used" | 12 | printf "File list \tundefined symbol used\n" |
13 | find $paths -name '*.[chS]' -o -name 'Makefile' -o -name 'Makefile*[^~]'| while read i | 13 | find $paths -name '*.[chS]' -o -name 'Makefile' -o -name 'Makefile*[^~]'| while read i |
14 | do | 14 | do |
15 | # Output the bare Kconfig variable and the filename; the _MODULE part at | 15 | # Output the bare Kconfig variable and the filename; the _MODULE part at |
16 | # the end is not removed here (would need perl an not-hungry regexp for that). | 16 | # the end is not removed here (would need perl an not-hungry regexp for that). |
17 | sed -ne 's!^.*\<\(UML_\)\?CONFIG_\([0-9A-Za-z_]\+\).*!\2 '$i'!p' < $i | 17 | sed -ne 's!^.*\<\(UML_\)\?CONFIG_\([0-9A-Za-z_]\+\).*!\2 '$i'!p' < $i |
18 | done | \ | 18 | done | \ |
19 | # Smart "sort|uniq" implemented in awk and tuned to collect the names of all | 19 | # Smart "sort|uniq" implemented in awk and tuned to collect the names of all |
20 | # files which use a given symbol | 20 | # files which use a given symbol |
21 | awk '{map[$1, count[$1]++] = $2; } | 21 | awk '{map[$1, count[$1]++] = $2; } |
22 | END { | 22 | END { |
23 | for (combIdx in map) { | 23 | for (combIdx in map) { |
24 | split(combIdx, separate, SUBSEP); | 24 | split(combIdx, separate, SUBSEP); |
25 | # The value may have been removed. | 25 | # The value may have been removed. |
26 | if (! ( (separate[1], separate[2]) in map ) ) | 26 | if (! ( (separate[1], separate[2]) in map ) ) |
27 | continue; | 27 | continue; |
28 | symb=separate[1]; | 28 | symb=separate[1]; |
29 | printf "%s ", symb; | 29 | printf "%s ", symb; |
30 | #Use gawk extension to delete the names vector | 30 | #Use gawk extension to delete the names vector |
31 | delete names; | 31 | delete names; |
32 | #Portably delete the names vector | 32 | #Portably delete the names vector |
33 | #split("", names); | 33 | #split("", names); |
34 | for (i=0; i < count[symb]; i++) { | 34 | for (i=0; i < count[symb]; i++) { |
35 | names[map[symb, i]] = 1; | 35 | names[map[symb, i]] = 1; |
36 | # Unfortunately, we may still encounter symb, i in the | 36 | # Unfortunately, we may still encounter symb, i in the |
37 | # outside iteration. | 37 | # outside iteration. |
38 | delete map[symb, i]; | 38 | delete map[symb, i]; |
39 | } | 39 | } |
40 | i=0; | 40 | i=0; |
41 | for (name in names) { | 41 | for (name in names) { |
42 | if (i > 0) | 42 | if (i > 0) |
43 | printf ", %s", name; | 43 | printf ", %s", name; |
44 | else | 44 | else |
45 | printf "%s", name; | 45 | printf "%s", name; |
46 | i++; | 46 | i++; |
47 | } | 47 | } |
48 | printf "\n"; | 48 | printf "\n"; |
49 | } | 49 | } |
50 | }' | | 50 | }' | |
51 | while read symb files; do | 51 | while read symb files; do |
52 | # Remove the _MODULE suffix when checking the variable name. This should | 52 | # Remove the _MODULE suffix when checking the variable name. This should |
53 | # be done only on tristate symbols, actually, but Kconfig parsing is | 53 | # be done only on tristate symbols, actually, but Kconfig parsing is |
54 | # beyond the purpose of this script. | 54 | # beyond the purpose of this script. |
55 | symb_bare=`echo $symb | sed -e 's/_MODULE//'` | 55 | symb_bare=`echo $symb | sed -e 's/_MODULE//'` |
56 | if ! grep -q "\<$symb_bare\>" $Kconfigs; then | 56 | if ! grep -q "\<$symb_bare\>" $Kconfigs; then |
57 | /bin/echo -e "$files: \t$symb" | 57 | printf "$files: \t$symb\n" |
58 | fi | 58 | fi |
59 | done|sort | 59 | done|sort |
60 | 60 |