kernel-doc (5c34202b8bf942da411b6599668a76b07449bbfd) kernel-doc (5f8c7c98ae3888cf0a2cf320f514f75cc92f00be)
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## ##

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

149# 'funcname()' - function
150# '$ENVVAR' - environmental variable
151# '&struct_name' - name of a structure (up to two words including 'struct')
152# '@parameter' - name of a parameter
153# '%CONST' - name of a constant.
154
155my $errors = 0;
156my $warnings = 0;
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## ##

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

149# 'funcname()' - function
150# '$ENVVAR' - environmental variable
151# '&struct_name' - name of a structure (up to two words including 'struct')
152# '@parameter' - name of a parameter
153# '%CONST' - name of a constant.
154
155my $errors = 0;
156my $warnings = 0;
157my $anon_struct_union = 0;
157
158# match expressions used to find embedded type information
159my $type_constant = '\%([-_\w]+)';
160my $type_func = '(\w+)\(\)';
161my $type_param = '\@(\w+)';
162my $type_struct = '\&((struct\s*)*[_\w]+)';
163my $type_struct_xml = '\\\amp;((struct\s*)*[_\w]+)';
164my $type_env = '(\$\w+)';

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

1505 }
1506 }
1507}
1508
1509sub push_parameter($$$) {
1510 my $param = shift;
1511 my $type = shift;
1512 my $file = shift;
158
159# match expressions used to find embedded type information
160my $type_constant = '\%([-_\w]+)';
161my $type_func = '(\w+)\(\)';
162my $type_param = '\@(\w+)';
163my $type_struct = '\&((struct\s*)*[_\w]+)';
164my $type_struct_xml = '\\\amp;((struct\s*)*[_\w]+)';
165my $type_env = '(\$\w+)';

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

1506 }
1507 }
1508}
1509
1510sub push_parameter($$$) {
1511 my $param = shift;
1512 my $type = shift;
1513 my $file = shift;
1513 my $anon = 0;
1514
1514
1515 if (($anon_struct_union == 1) && ($type eq "") &&
1516 ($param eq "}")) {
1517 return; # ignore the ending }; from anon. struct/union
1518 }
1519
1520 $anon_struct_union = 0;
1515 my $param_name = $param;
1516 $param_name =~ s/\[.*//;
1517
1518 if ($type eq "" && $param =~ /\.\.\.$/)
1519 {
1520 $type="";
1521 $parameterdescs{$param} = "variable arguments";
1522 }
1523 elsif ($type eq "" && ($param eq "" or $param eq "void"))
1524 {
1525 $type="";
1526 $param="void";
1527 $parameterdescs{void} = "no arguments";
1528 }
1529 elsif ($type eq "" && ($param eq "struct" or $param eq "union"))
1530 # handle unnamed (anonymous) union or struct:
1531 {
1532 $type = $param;
1521 my $param_name = $param;
1522 $param_name =~ s/\[.*//;
1523
1524 if ($type eq "" && $param =~ /\.\.\.$/)
1525 {
1526 $type="";
1527 $parameterdescs{$param} = "variable arguments";
1528 }
1529 elsif ($type eq "" && ($param eq "" or $param eq "void"))
1530 {
1531 $type="";
1532 $param="void";
1533 $parameterdescs{void} = "no arguments";
1534 }
1535 elsif ($type eq "" && ($param eq "struct" or $param eq "union"))
1536 # handle unnamed (anonymous) union or struct:
1537 {
1538 $type = $param;
1533 $param = "{unnamed_" . $param. "}";
1539 $param = "{unnamed_" . $param . "}";
1534 $parameterdescs{$param} = "anonymous\n";
1540 $parameterdescs{$param} = "anonymous\n";
1535 $anon = 1;
1541 $anon_struct_union = 1;
1536 }
1537
1538 # warn if parameter has no description
1539 # (but ignore ones starting with # as these are not parameters
1540 # but inline preprocessor statements);
1541 # also ignore unnamed structs/unions;
1542 }
1543
1544 # warn if parameter has no description
1545 # (but ignore ones starting with # as these are not parameters
1546 # but inline preprocessor statements);
1547 # also ignore unnamed structs/unions;
1542 if (!$anon) {
1548 if (!$anon_struct_union) {
1543 if (!defined $parameterdescs{$param_name} && $param_name !~ /^#/) {
1544
1545 $parameterdescs{$param_name} = $undescribed;
1546
1547 if (($type eq 'function') || ($type eq 'enum')) {
1548 print STDERR "Warning(${file}:$.): Function parameter ".
1549 "or member '$param' not " .
1550 "described in '$declaration_name'\n";

--- 418 unchanged lines hidden ---
1549 if (!defined $parameterdescs{$param_name} && $param_name !~ /^#/) {
1550
1551 $parameterdescs{$param_name} = $undescribed;
1552
1553 if (($type eq 'function') || ($type eq 'enum')) {
1554 print STDERR "Warning(${file}:$.): Function parameter ".
1555 "or member '$param' not " .
1556 "described in '$declaration_name'\n";

--- 418 unchanged lines hidden ---