diff options
| author | Thomas Gleixner <tglx@linutronix.de> | 2017-11-14 04:01:49 -0500 |
|---|---|---|
| committer | Thomas Gleixner <tglx@linutronix.de> | 2017-11-14 04:01:49 -0500 |
| commit | d4bfeabe9ff7967f4b8c24aabf2de1ce3a909cd9 (patch) | |
| tree | 6b419b8497c7d57ddec20a3558697ef36ea37b11 /scripts | |
| parent | 8a7a8e1eab929eb3a5b735a788a23b9731139046 (diff) | |
| parent | b29c6ef7bb1257853c1e31616d84f55e561cf631 (diff) | |
Merge branch 'linus' into timers/urgent
Get upstream changes so dependent patches can be applied.
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/Makefile.build | 2 | ||||
| -rwxr-xr-x | scripts/documentation-file-ref-check | 15 | ||||
| -rwxr-xr-x | scripts/find-unused-docs.sh | 62 | ||||
| -rwxr-xr-x | scripts/headers_install.sh | 2 | ||||
| -rwxr-xr-x | scripts/kernel-doc | 17 |
5 files changed, 92 insertions, 6 deletions
diff --git a/scripts/Makefile.build b/scripts/Makefile.build index bb831d49bcfd..e63af4e19382 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build | |||
| @@ -259,7 +259,7 @@ ifneq ($(SKIP_STACK_VALIDATION),1) | |||
| 259 | 259 | ||
| 260 | __objtool_obj := $(objtree)/tools/objtool/objtool | 260 | __objtool_obj := $(objtree)/tools/objtool/objtool |
| 261 | 261 | ||
| 262 | objtool_args = $(if $(CONFIG_ORC_UNWINDER),orc generate,check) | 262 | objtool_args = $(if $(CONFIG_UNWINDER_ORC),orc generate,check) |
| 263 | 263 | ||
| 264 | ifndef CONFIG_FRAME_POINTER | 264 | ifndef CONFIG_FRAME_POINTER |
| 265 | objtool_args += --no-fp | 265 | objtool_args += --no-fp |
diff --git a/scripts/documentation-file-ref-check b/scripts/documentation-file-ref-check new file mode 100755 index 000000000000..bc1659900e89 --- /dev/null +++ b/scripts/documentation-file-ref-check | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # Treewide grep for references to files under Documentation, and report | ||
| 3 | # non-existing files in stderr. | ||
| 4 | |||
| 5 | for f in $(git ls-files); do | ||
| 6 | for ref in $(grep -ho "Documentation/[A-Za-z0-9_.,~/*+-]*" "$f"); do | ||
| 7 | # presume trailing . and , are not part of the name | ||
| 8 | ref=${ref%%[.,]} | ||
| 9 | |||
| 10 | # use ls to handle wildcards | ||
| 11 | if ! ls $ref >/dev/null 2>&1; then | ||
| 12 | echo "$f: $ref" >&2 | ||
| 13 | fi | ||
| 14 | done | ||
| 15 | done | ||
diff --git a/scripts/find-unused-docs.sh b/scripts/find-unused-docs.sh new file mode 100755 index 000000000000..3f46f8977dc4 --- /dev/null +++ b/scripts/find-unused-docs.sh | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # (c) 2017, Jonathan Corbet <corbet@lwn.net> | ||
| 3 | # sayli karnik <karniksayli1995@gmail.com> | ||
| 4 | # | ||
| 5 | # This script detects files with kernel-doc comments for exported functions | ||
| 6 | # that are not included in documentation. | ||
| 7 | # | ||
| 8 | # usage: Run 'scripts/find-unused-docs.sh directory' from top level of kernel | ||
| 9 | # tree. | ||
| 10 | # | ||
| 11 | # example: $scripts/find-unused-docs.sh drivers/scsi | ||
| 12 | # | ||
| 13 | # Licensed under the terms of the GNU GPL License | ||
| 14 | |||
| 15 | if ! [ -d "Documentation" ]; then | ||
| 16 | echo "Run from top level of kernel tree" | ||
| 17 | exit 1 | ||
| 18 | fi | ||
| 19 | |||
| 20 | if [ "$#" -ne 1 ]; then | ||
| 21 | echo "Usage: scripts/find-unused-docs.sh directory" | ||
| 22 | exit 1 | ||
| 23 | fi | ||
| 24 | |||
| 25 | if ! [ -d "$1" ]; then | ||
| 26 | echo "Directory $1 doesn't exist" | ||
| 27 | exit 1 | ||
| 28 | fi | ||
| 29 | |||
| 30 | cd "$( dirname "${BASH_SOURCE[0]}" )" | ||
| 31 | cd .. | ||
| 32 | |||
| 33 | cd Documentation/ | ||
| 34 | |||
| 35 | echo "The following files contain kerneldoc comments for exported functions \ | ||
| 36 | that are not used in the formatted documentation" | ||
| 37 | |||
| 38 | # FILES INCLUDED | ||
| 39 | |||
| 40 | files_included=($(grep -rHR ".. kernel-doc" --include \*.rst | cut -d " " -f 3)) | ||
| 41 | |||
| 42 | declare -A FILES_INCLUDED | ||
| 43 | |||
| 44 | for each in "${files_included[@]}"; do | ||
| 45 | FILES_INCLUDED[$each]="$each" | ||
| 46 | done | ||
| 47 | |||
| 48 | cd .. | ||
| 49 | |||
| 50 | # FILES NOT INCLUDED | ||
| 51 | |||
| 52 | for file in `find $1 -name '*.c'`; do | ||
| 53 | |||
| 54 | if [[ ${FILES_INCLUDED[$file]+_} ]]; then | ||
| 55 | continue; | ||
| 56 | fi | ||
| 57 | str=$(scripts/kernel-doc -text -export "$file" 2>/dev/null) | ||
| 58 | if [[ -n "$str" ]]; then | ||
| 59 | echo "$file" | ||
| 60 | fi | ||
| 61 | done | ||
| 62 | |||
diff --git a/scripts/headers_install.sh b/scripts/headers_install.sh index 4d1ea96e8794..a18bca720995 100755 --- a/scripts/headers_install.sh +++ b/scripts/headers_install.sh | |||
| @@ -34,7 +34,7 @@ do | |||
| 34 | sed -r \ | 34 | sed -r \ |
| 35 | -e 's/([ \t(])(__user|__force|__iomem)[ \t]/\1/g' \ | 35 | -e 's/([ \t(])(__user|__force|__iomem)[ \t]/\1/g' \ |
| 36 | -e 's/__attribute_const__([ \t]|$)/\1/g' \ | 36 | -e 's/__attribute_const__([ \t]|$)/\1/g' \ |
| 37 | -e 's@^#include <linux/compiler.h>@@' \ | 37 | -e 's@^#include <linux/compiler(|_types).h>@@' \ |
| 38 | -e 's/(^|[^a-zA-Z0-9])__packed([^a-zA-Z0-9_]|$)/\1__attribute__((packed))\2/g' \ | 38 | -e 's/(^|[^a-zA-Z0-9])__packed([^a-zA-Z0-9_]|$)/\1__attribute__((packed))\2/g' \ |
| 39 | -e 's/(^|[ \t(])(inline|asm|volatile)([ \t(]|$)/\1__\2__\3/g' \ | 39 | -e 's/(^|[ \t(])(inline|asm|volatile)([ \t(]|$)/\1__\2__\3/g' \ |
| 40 | -e 's@#(ifndef|define|endif[ \t]*/[*])[ \t]*_UAPI@#\1 @' \ | 40 | -e 's@#(ifndef|define|endif[ \t]*/[*])[ \t]*_UAPI@#\1 @' \ |
diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 9d3eafea58f0..67d051edd615 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc | |||
| @@ -2168,7 +2168,7 @@ sub dump_struct($$) { | |||
| 2168 | my $nested; | 2168 | my $nested; |
| 2169 | 2169 | ||
| 2170 | if ($x =~ /(struct|union)\s+(\w+)\s*{(.*)}/) { | 2170 | if ($x =~ /(struct|union)\s+(\w+)\s*{(.*)}/) { |
| 2171 | #my $decl_type = $1; | 2171 | my $decl_type = $1; |
| 2172 | $declaration_name = $2; | 2172 | $declaration_name = $2; |
| 2173 | my $members = $3; | 2173 | my $members = $3; |
| 2174 | 2174 | ||
| @@ -2194,7 +2194,7 @@ sub dump_struct($$) { | |||
| 2194 | $members =~ s/DECLARE_HASHTABLE\s*\(([^,)]+), ([^,)]+)\)/unsigned long $1\[1 << (($2) - 1)\]/gos; | 2194 | $members =~ s/DECLARE_HASHTABLE\s*\(([^,)]+), ([^,)]+)\)/unsigned long $1\[1 << (($2) - 1)\]/gos; |
| 2195 | 2195 | ||
| 2196 | create_parameterlist($members, ';', $file); | 2196 | create_parameterlist($members, ';', $file); |
| 2197 | check_sections($file, $declaration_name, "struct", $sectcheck, $struct_actual, $nested); | 2197 | check_sections($file, $declaration_name, $decl_type, $sectcheck, $struct_actual, $nested); |
| 2198 | 2198 | ||
| 2199 | output_declaration($declaration_name, | 2199 | output_declaration($declaration_name, |
| 2200 | 'struct', | 2200 | 'struct', |
| @@ -2226,6 +2226,8 @@ sub dump_enum($$) { | |||
| 2226 | if ($x =~ /enum\s+(\w+)\s*{(.*)}/) { | 2226 | if ($x =~ /enum\s+(\w+)\s*{(.*)}/) { |
| 2227 | $declaration_name = $1; | 2227 | $declaration_name = $1; |
| 2228 | my $members = $2; | 2228 | my $members = $2; |
| 2229 | my %_members; | ||
| 2230 | |||
| 2229 | $members =~ s/\s+$//; | 2231 | $members =~ s/\s+$//; |
| 2230 | 2232 | ||
| 2231 | foreach my $arg (split ',', $members) { | 2233 | foreach my $arg (split ',', $members) { |
| @@ -2236,9 +2238,16 @@ sub dump_enum($$) { | |||
| 2236 | print STDERR "${file}:$.: warning: Enum value '$arg' ". | 2238 | print STDERR "${file}:$.: warning: Enum value '$arg' ". |
| 2237 | "not described in enum '$declaration_name'\n"; | 2239 | "not described in enum '$declaration_name'\n"; |
| 2238 | } | 2240 | } |
| 2239 | 2241 | $_members{$arg} = 1; | |
| 2240 | } | 2242 | } |
| 2241 | 2243 | ||
| 2244 | while (my ($k, $v) = each %parameterdescs) { | ||
| 2245 | if (!exists($_members{$k})) { | ||
| 2246 | print STDERR "${file}:$.: warning: Excess enum value " . | ||
| 2247 | "'$k' description in '$declaration_name'\n"; | ||
| 2248 | } | ||
| 2249 | } | ||
| 2250 | |||
| 2242 | output_declaration($declaration_name, | 2251 | output_declaration($declaration_name, |
| 2243 | 'enum', | 2252 | 'enum', |
| 2244 | {'enum' => $declaration_name, | 2253 | {'enum' => $declaration_name, |
| @@ -2506,7 +2515,7 @@ sub check_sections($$$$$$) { | |||
| 2506 | } else { | 2515 | } else { |
| 2507 | if ($nested !~ m/\Q$sects[$sx]\E/) { | 2516 | if ($nested !~ m/\Q$sects[$sx]\E/) { |
| 2508 | print STDERR "${file}:$.: warning: " . | 2517 | print STDERR "${file}:$.: warning: " . |
| 2509 | "Excess struct/union/enum/typedef member " . | 2518 | "Excess $decl_type member " . |
| 2510 | "'$sects[$sx]' " . | 2519 | "'$sects[$sx]' " . |
| 2511 | "description in '$decl_name'\n"; | 2520 | "description in '$decl_name'\n"; |
| 2512 | ++$warnings; | 2521 | ++$warnings; |
