kernel-doc (b7d3622a39fde7658170b7f3cf6c6889bb8db30d) kernel-doc (cbb4d3e6510b99522719c5ef0cd0482886a324c0)
1#!/usr/bin/perl -w
2
3use strict;
4
5## Copyright (c) 1998 Michael Zucchi, All Rights Reserved ##
6## Copyright (C) 2000, 1 Tim Waugh <twaugh@redhat.com> ##
7## Copyright (C) 2001 Simon Huggins ##
8## Copyright (C) 2005-2012 Randy Dunlap ##

--- 2059 unchanged lines hidden (view full) ---

2068
2069##
2070# takes a function prototype and the name of the current file being
2071# processed and spits out all the details stored in the global
2072# arrays/hashes.
2073sub dump_function($$) {
2074 my $prototype = shift;
2075 my $file = shift;
1#!/usr/bin/perl -w
2
3use strict;
4
5## Copyright (c) 1998 Michael Zucchi, All Rights Reserved ##
6## Copyright (C) 2000, 1 Tim Waugh <twaugh@redhat.com> ##
7## Copyright (C) 2001 Simon Huggins ##
8## Copyright (C) 2005-2012 Randy Dunlap ##

--- 2059 unchanged lines hidden (view full) ---

2068
2069##
2070# takes a function prototype and the name of the current file being
2071# processed and spits out all the details stored in the global
2072# arrays/hashes.
2073sub dump_function($$) {
2074 my $prototype = shift;
2075 my $file = shift;
2076 my $noret = 0;
2076
2077 $prototype =~ s/^static +//;
2078 $prototype =~ s/^extern +//;
2079 $prototype =~ s/^asmlinkage +//;
2080 $prototype =~ s/^inline +//;
2081 $prototype =~ s/^__inline__ +//;
2082 $prototype =~ s/^__inline +//;
2083 $prototype =~ s/^__always_inline +//;
2084 $prototype =~ s/^noinline +//;
2085 $prototype =~ s/__init +//;
2086 $prototype =~ s/__init_or_module +//;
2087 $prototype =~ s/__must_check +//;
2088 $prototype =~ s/__weak +//;
2077
2078 $prototype =~ s/^static +//;
2079 $prototype =~ s/^extern +//;
2080 $prototype =~ s/^asmlinkage +//;
2081 $prototype =~ s/^inline +//;
2082 $prototype =~ s/^__inline__ +//;
2083 $prototype =~ s/^__inline +//;
2084 $prototype =~ s/^__always_inline +//;
2085 $prototype =~ s/^noinline +//;
2086 $prototype =~ s/__init +//;
2087 $prototype =~ s/__init_or_module +//;
2088 $prototype =~ s/__must_check +//;
2089 $prototype =~ s/__weak +//;
2089 $prototype =~ s/^#\s*define\s+//; #ak added
2090 my $define = $prototype =~ s/^#\s*define\s+//; #ak added
2090 $prototype =~ s/__attribute__\s*\(\([a-z,]*\)\)//;
2091
2092 # Yes, this truly is vile. We are looking for:
2093 # 1. Return type (may be nothing if we're looking at a macro)
2094 # 2. Function name
2095 # 3. Function parameters.
2096 #
2097 # All the while we have to watch out for function pointer parameters
2098 # (which IIRC is what the two sections are for), C types (these
2099 # regexps don't even start to express all the possibilities), and
2100 # so on.
2101 #
2102 # If you mess with these regexps, it's a good idea to check that
2103 # the following functions' documentation still comes out right:
2104 # - parport_register_device (function pointer parameters)
2105 # - atomic_set (macro)
2106 # - pci_match_device, __copy_to_user (long return type)
2107
2091 $prototype =~ s/__attribute__\s*\(\([a-z,]*\)\)//;
2092
2093 # Yes, this truly is vile. We are looking for:
2094 # 1. Return type (may be nothing if we're looking at a macro)
2095 # 2. Function name
2096 # 3. Function parameters.
2097 #
2098 # All the while we have to watch out for function pointer parameters
2099 # (which IIRC is what the two sections are for), C types (these
2100 # regexps don't even start to express all the possibilities), and
2101 # so on.
2102 #
2103 # If you mess with these regexps, it's a good idea to check that
2104 # the following functions' documentation still comes out right:
2105 # - parport_register_device (function pointer parameters)
2106 # - atomic_set (macro)
2107 # - pci_match_device, __copy_to_user (long return type)
2108
2108 if ($prototype =~ m/^()([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
2109 if ($define && $prototype =~ m/^()([a-zA-Z0-9_~:]+)\s+/) {
2110 # This is an object-like macro, it has no return type and no parameter
2111 # list.
2112 # Function-like macros are not allowed to have spaces between
2113 # declaration_name and opening parenthesis (notice the \s+).
2114 $return_type = $1;
2115 $declaration_name = $2;
2116 $noret = 1;
2117 } elsif ($prototype =~ m/^()([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
2109 $prototype =~ m/^(\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
2110 $prototype =~ m/^(\w+\s*\*)\s*([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
2111 $prototype =~ m/^(\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
2112 $prototype =~ m/^(\w+\s+\w+\s*\*+)\s*([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
2113 $prototype =~ m/^(\w+\s+\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
2114 $prototype =~ m/^(\w+\s+\w+\s+\w+\s*\*)\s*([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
2115 $prototype =~ m/^()([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ ||
2116 $prototype =~ m/^(\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ ||

--- 18 unchanged lines hidden (view full) ---

2135 my $prms = join " ", @parameterlist;
2136 check_sections($file, $declaration_name, "function", $sectcheck, $prms, "");
2137
2138 # This check emits a lot of warnings at the moment, because many
2139 # functions don't have a 'Return' doc section. So until the number
2140 # of warnings goes sufficiently down, the check is only performed in
2141 # verbose mode.
2142 # TODO: always perform the check.
2118 $prototype =~ m/^(\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
2119 $prototype =~ m/^(\w+\s*\*)\s*([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
2120 $prototype =~ m/^(\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
2121 $prototype =~ m/^(\w+\s+\w+\s*\*+)\s*([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
2122 $prototype =~ m/^(\w+\s+\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
2123 $prototype =~ m/^(\w+\s+\w+\s+\w+\s*\*)\s*([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
2124 $prototype =~ m/^()([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ ||
2125 $prototype =~ m/^(\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ ||

--- 18 unchanged lines hidden (view full) ---

2144 my $prms = join " ", @parameterlist;
2145 check_sections($file, $declaration_name, "function", $sectcheck, $prms, "");
2146
2147 # This check emits a lot of warnings at the moment, because many
2148 # functions don't have a 'Return' doc section. So until the number
2149 # of warnings goes sufficiently down, the check is only performed in
2150 # verbose mode.
2151 # TODO: always perform the check.
2143 if ($verbose) {
2152 if ($verbose && !$noret) {
2144 check_return_section($file, $declaration_name, $return_type);
2145 }
2146
2147 output_declaration($declaration_name,
2148 'function',
2149 {'function' => $declaration_name,
2150 'module' => $modulename,
2151 'functiontype' => $return_type,

--- 458 unchanged lines hidden ---
2153 check_return_section($file, $declaration_name, $return_type);
2154 }
2155
2156 output_declaration($declaration_name,
2157 'function',
2158 {'function' => $declaration_name,
2159 'module' => $modulename,
2160 'functiontype' => $return_type,

--- 458 unchanged lines hidden ---