diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-11 21:32:29 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-11 21:32:29 -0400 |
| commit | cbd8aca472134e666eee87462177f1be854ebbf8 (patch) | |
| tree | fbe0dd2ffbd14eeb1b8ec5dbb39fe52b0cbb76e5 /scripts | |
| parent | 35e9a274fdc9c8feb763e4970a32d7089f51393c (diff) | |
| parent | 26de9c26bf8557584c1977da92f3ed1b752291cf (diff) | |
Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull kbuild misc changes from Michal Marek:
"In the non-critical part of kbuild, I have
- Some make coccicheck improvements and two new tests
- Support for a cleaner html output in scripts/kernel-doc, named
html5 (no, it does not play videos, yet)
BTW, Randy wants to route further kernel-doc patches through the
kbuild tree."
* 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
Update SmPL/Coccinelle section of MAINTAINERS
coccicheck: Add the rep+ctxt mode
scripts/coccinelle/tests/odd_ptr_err.cocci: semantic patch for IS_ERR/PTR_ERR inconsistency
scripts/tags.sh: Add magic for pci access functions
scripts/coccinelle: ptr_ret: Add ternary operator version
scripts/kernel-doc: drop maintainer
scripts/kernel-doc: added support for html5
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/coccicheck | 3 | ||||
| -rw-r--r-- | scripts/coccinelle/api/ptr_ret.cocci | 26 | ||||
| -rw-r--r-- | scripts/coccinelle/tests/odd_ptr_err.cocci | 65 | ||||
| -rwxr-xr-x | scripts/kernel-doc | 273 | ||||
| -rwxr-xr-x | scripts/tags.sh | 8 |
5 files changed, 366 insertions, 9 deletions
diff --git a/scripts/coccicheck b/scripts/coccicheck index 823e972149e5..1a49d1c7ecfe 100755 --- a/scripts/coccicheck +++ b/scripts/coccicheck | |||
| @@ -95,6 +95,9 @@ coccinelle () { | |||
| 95 | $SPATCH -D report $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff || \ | 95 | $SPATCH -D report $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff || \ |
| 96 | $SPATCH -D context $FLAGS -sp_file $COCCI $OPT $OPTIONS || \ | 96 | $SPATCH -D context $FLAGS -sp_file $COCCI $OPT $OPTIONS || \ |
| 97 | $SPATCH -D org $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff || exit 1 | 97 | $SPATCH -D org $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff || exit 1 |
| 98 | elif [ "$MODE" = "rep+ctxt" ] ; then | ||
| 99 | $SPATCH -D report $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff && \ | ||
| 100 | $SPATCH -D context $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1 | ||
| 98 | else | 101 | else |
| 99 | $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1 | 102 | $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1 |
| 100 | fi | 103 | fi |
diff --git a/scripts/coccinelle/api/ptr_ret.cocci b/scripts/coccinelle/api/ptr_ret.cocci index cbfd08c7d8c7..15f076fdecbe 100644 --- a/scripts/coccinelle/api/ptr_ret.cocci +++ b/scripts/coccinelle/api/ptr_ret.cocci | |||
| @@ -30,6 +30,13 @@ expression ptr; | |||
| 30 | - if (IS_ERR(ptr)) return PTR_ERR(ptr); return 0; | 30 | - if (IS_ERR(ptr)) return PTR_ERR(ptr); return 0; |
| 31 | + return PTR_RET(ptr); | 31 | + return PTR_RET(ptr); |
| 32 | 32 | ||
| 33 | @depends on patch@ | ||
| 34 | expression ptr; | ||
| 35 | @@ | ||
| 36 | |||
| 37 | - (IS_ERR(ptr) ? PTR_ERR(ptr) : 0) | ||
| 38 | + PTR_RET(ptr) | ||
| 39 | |||
| 33 | @r1 depends on !patch@ | 40 | @r1 depends on !patch@ |
| 34 | expression ptr; | 41 | expression ptr; |
| 35 | position p1; | 42 | position p1; |
| @@ -44,6 +51,13 @@ position p2; | |||
| 44 | 51 | ||
| 45 | * if@p2 (IS_ERR(ptr)) return PTR_ERR(ptr); return 0; | 52 | * if@p2 (IS_ERR(ptr)) return PTR_ERR(ptr); return 0; |
| 46 | 53 | ||
| 54 | @r3 depends on !patch@ | ||
| 55 | expression ptr; | ||
| 56 | position p3; | ||
| 57 | @@ | ||
| 58 | |||
| 59 | * IS_ERR@p3(ptr) ? PTR_ERR(ptr) : 0 | ||
| 60 | |||
| 47 | @script:python depends on org@ | 61 | @script:python depends on org@ |
| 48 | p << r1.p1; | 62 | p << r1.p1; |
| 49 | @@ | 63 | @@ |
| @@ -57,6 +71,12 @@ p << r2.p2; | |||
| 57 | 71 | ||
| 58 | coccilib.org.print_todo(p[0], "WARNING: PTR_RET can be used") | 72 | coccilib.org.print_todo(p[0], "WARNING: PTR_RET can be used") |
| 59 | 73 | ||
| 74 | @script:python depends on org@ | ||
| 75 | p << r3.p3; | ||
| 76 | @@ | ||
| 77 | |||
| 78 | coccilib.org.print_todo(p[0], "WARNING: PTR_RET can be used") | ||
| 79 | |||
| 60 | @script:python depends on report@ | 80 | @script:python depends on report@ |
| 61 | p << r1.p1; | 81 | p << r1.p1; |
| 62 | @@ | 82 | @@ |
| @@ -68,3 +88,9 @@ p << r2.p2; | |||
| 68 | @@ | 88 | @@ |
| 69 | 89 | ||
| 70 | coccilib.report.print_report(p[0], "WARNING: PTR_RET can be used") | 90 | coccilib.report.print_report(p[0], "WARNING: PTR_RET can be used") |
| 91 | |||
| 92 | @script:python depends on report@ | ||
| 93 | p << r3.p3; | ||
| 94 | @@ | ||
| 95 | |||
| 96 | coccilib.report.print_report(p[0], "WARNING: PTR_RET can be used") | ||
diff --git a/scripts/coccinelle/tests/odd_ptr_err.cocci b/scripts/coccinelle/tests/odd_ptr_err.cocci new file mode 100644 index 000000000000..e8dd8a6b28a2 --- /dev/null +++ b/scripts/coccinelle/tests/odd_ptr_err.cocci | |||
| @@ -0,0 +1,65 @@ | |||
| 1 | /// PTR_ERR should access the value just tested by IS_ERR | ||
| 2 | //# There can be false positives in the patch case, where it is the call | ||
| 3 | //# IS_ERR that is wrong. | ||
| 4 | /// | ||
| 5 | // Confidence: High | ||
| 6 | // Copyright: (C) 2012 Julia Lawall, INRIA. GPLv2. | ||
| 7 | // Copyright: (C) 2012 Gilles Muller, INRIA. GPLv2. | ||
| 8 | // URL: http://coccinelle.lip6.fr/ | ||
| 9 | // Comments: | ||
| 10 | // Options: -no_includes -include_headers | ||
| 11 | |||
| 12 | virtual patch | ||
| 13 | virtual context | ||
| 14 | virtual org | ||
| 15 | virtual report | ||
| 16 | |||
| 17 | @depends on patch@ | ||
| 18 | expression e,e1; | ||
| 19 | @@ | ||
| 20 | |||
| 21 | ( | ||
| 22 | if (IS_ERR(e)) { ... PTR_ERR(e) ... } | ||
| 23 | | | ||
| 24 | if (IS_ERR(e=e1)) { ... PTR_ERR(e) ... } | ||
| 25 | | | ||
| 26 | if (IS_ERR(e)) | ||
| 27 | { ... | ||
| 28 | PTR_ERR( | ||
| 29 | - e1 | ||
| 30 | + e | ||
| 31 | ) | ||
| 32 | ... } | ||
| 33 | ) | ||
| 34 | |||
| 35 | @r depends on !patch@ | ||
| 36 | expression e,e1; | ||
| 37 | position p1,p2; | ||
| 38 | @@ | ||
| 39 | |||
| 40 | ( | ||
| 41 | if (IS_ERR(e)) { ... PTR_ERR(e) ... } | ||
| 42 | | | ||
| 43 | if (IS_ERR(e=e1)) { ... PTR_ERR(e) ... } | ||
| 44 | | | ||
| 45 | *if (IS_ERR@p1(e)) | ||
| 46 | { ... | ||
| 47 | * PTR_ERR@p2(e1) | ||
| 48 | ... } | ||
| 49 | ) | ||
| 50 | |||
| 51 | @script:python depends on org@ | ||
| 52 | p1 << r.p1; | ||
| 53 | p2 << r.p2; | ||
| 54 | @@ | ||
| 55 | |||
| 56 | cocci.print_main("inconsistent IS_ERR and PTR_ERR",p1) | ||
| 57 | cocci.print_secs("PTR_ERR",p2) | ||
| 58 | |||
| 59 | @script:python depends on report@ | ||
| 60 | p1 << r.p1; | ||
| 61 | p2 << r.p2; | ||
| 62 | @@ | ||
| 63 | |||
| 64 | msg = "inconsistent IS_ERR and PTR_ERR, PTR_ERR on line %s" % (p2[0].line) | ||
| 65 | coccilib.report.print_report(p1[0],msg) | ||
diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 01e8a8e22602..46e7aff80d1a 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc | |||
| @@ -6,6 +6,7 @@ use strict; | |||
| 6 | ## Copyright (C) 2000, 1 Tim Waugh <twaugh@redhat.com> ## | 6 | ## Copyright (C) 2000, 1 Tim Waugh <twaugh@redhat.com> ## |
| 7 | ## Copyright (C) 2001 Simon Huggins ## | 7 | ## Copyright (C) 2001 Simon Huggins ## |
| 8 | ## Copyright (C) 2005-2012 Randy Dunlap ## | 8 | ## Copyright (C) 2005-2012 Randy Dunlap ## |
| 9 | ## Copyright (C) 2012 Dan Luedtke ## | ||
| 9 | ## ## | 10 | ## ## |
| 10 | ## #define enhancements by Armin Kuster <akuster@mvista.com> ## | 11 | ## #define enhancements by Armin Kuster <akuster@mvista.com> ## |
| 11 | ## Copyright (c) 2000 MontaVista Software, Inc. ## | 12 | ## Copyright (c) 2000 MontaVista Software, Inc. ## |
| @@ -35,6 +36,8 @@ use strict; | |||
| 35 | # Small fixes (like spaces vs. \s in regex) | 36 | # Small fixes (like spaces vs. \s in regex) |
| 36 | # -- Tim Jansen <tim@tjansen.de> | 37 | # -- Tim Jansen <tim@tjansen.de> |
| 37 | 38 | ||
| 39 | # 25/07/2012 - Added support for HTML5 | ||
| 40 | # -- Dan Luedtke <mail@danrl.de> | ||
| 38 | 41 | ||
| 39 | # | 42 | # |
| 40 | # This will read a 'c' file and scan for embedded comments in the | 43 | # This will read a 'c' file and scan for embedded comments in the |
| @@ -44,12 +47,16 @@ use strict; | |||
| 44 | # Note: This only supports 'c'. | 47 | # Note: This only supports 'c'. |
| 45 | 48 | ||
| 46 | # usage: | 49 | # usage: |
| 47 | # kernel-doc [ -docbook | -html | -text | -man | -list ] [ -no-doc-sections ] | 50 | # kernel-doc [ -docbook | -html | -html5 | -text | -man | -list ] |
| 48 | # [ -function funcname [ -function funcname ...] ] c file(s)s > outputfile | 51 | # [ -no-doc-sections ] |
| 52 | # [ -function funcname [ -function funcname ...] ] | ||
| 53 | # c file(s)s > outputfile | ||
| 49 | # or | 54 | # or |
| 50 | # [ -nofunction funcname [ -function funcname ...] ] c file(s)s > outputfile | 55 | # [ -nofunction funcname [ -function funcname ...] ] |
| 56 | # c file(s)s > outputfile | ||
| 51 | # | 57 | # |
| 52 | # Set output format using one of -docbook -html -text or -man. Default is man. | 58 | # Set output format using one of -docbook -html -html5 -text or -man. |
| 59 | # Default is man. | ||
| 53 | # The -list format is for internal use by docproc. | 60 | # The -list format is for internal use by docproc. |
| 54 | # | 61 | # |
| 55 | # -no-doc-sections | 62 | # -no-doc-sections |
| @@ -182,6 +189,14 @@ my $local_lt = "\\\\\\\\lt:"; | |||
| 182 | my $local_gt = "\\\\\\\\gt:"; | 189 | my $local_gt = "\\\\\\\\gt:"; |
| 183 | my $blankline_html = $local_lt . "p" . $local_gt; # was "<p>" | 190 | my $blankline_html = $local_lt . "p" . $local_gt; # was "<p>" |
| 184 | 191 | ||
| 192 | # html version 5 | ||
| 193 | my %highlights_html5 = ( $type_constant, "<span class=\"const\">\$1</span>", | ||
| 194 | $type_func, "<span class=\"func\">\$1</span>", | ||
| 195 | $type_struct_xml, "<span class=\"struct\">\$1</span>", | ||
| 196 | $type_env, "<span class=\"env\">\$1</span>", | ||
| 197 | $type_param, "<span class=\"param\">\$1</span>" ); | ||
| 198 | my $blankline_html5 = $local_lt . "br /" . $local_gt; | ||
| 199 | |||
| 185 | # XML, docbook format | 200 | # XML, docbook format |
| 186 | my %highlights_xml = ( "([^=])\\\"([^\\\"<]+)\\\"", "\$1<quote>\$2</quote>", | 201 | my %highlights_xml = ( "([^=])\\\"([^\\\"<]+)\\\"", "\$1<quote>\$2</quote>", |
| 187 | $type_constant, "<constant>\$1</constant>", | 202 | $type_constant, "<constant>\$1</constant>", |
| @@ -311,6 +326,10 @@ while ($ARGV[0] =~ m/^-(.*)/) { | |||
| 311 | $output_mode = "html"; | 326 | $output_mode = "html"; |
| 312 | %highlights = %highlights_html; | 327 | %highlights = %highlights_html; |
| 313 | $blankline = $blankline_html; | 328 | $blankline = $blankline_html; |
| 329 | } elsif ($cmd eq "-html5") { | ||
| 330 | $output_mode = "html5"; | ||
| 331 | %highlights = %highlights_html5; | ||
| 332 | $blankline = $blankline_html5; | ||
| 314 | } elsif ($cmd eq "-man") { | 333 | } elsif ($cmd eq "-man") { |
| 315 | $output_mode = "man"; | 334 | $output_mode = "man"; |
| 316 | %highlights = %highlights_man; | 335 | %highlights = %highlights_man; |
| @@ -353,10 +372,11 @@ while ($ARGV[0] =~ m/^-(.*)/) { | |||
| 353 | # continue execution near EOF; | 372 | # continue execution near EOF; |
| 354 | 373 | ||
| 355 | sub usage { | 374 | sub usage { |
| 356 | print "Usage: $0 [ -v ] [ -docbook | -html | -text | -man | -list ]\n"; | 375 | print "Usage: $0 [ -docbook | -html | -html5 | -text | -man | -list ]\n"; |
| 357 | print " [ -no-doc-sections ]\n"; | 376 | print " [ -no-doc-sections ]\n"; |
| 358 | print " [ -function funcname [ -function funcname ...] ]\n"; | 377 | print " [ -function funcname [ -function funcname ...] ]\n"; |
| 359 | print " [ -nofunction funcname [ -nofunction funcname ...] ]\n"; | 378 | print " [ -nofunction funcname [ -nofunction funcname ...] ]\n"; |
| 379 | print " [ -v ]\n"; | ||
| 360 | print " c source file(s) > outputfile\n"; | 380 | print " c source file(s) > outputfile\n"; |
| 361 | print " -v : verbose output, more warnings & other info listed\n"; | 381 | print " -v : verbose output, more warnings & other info listed\n"; |
| 362 | exit 1; | 382 | exit 1; |
| @@ -450,7 +470,8 @@ sub output_highlight { | |||
| 450 | # confess "output_highlight got called with no args?\n"; | 470 | # confess "output_highlight got called with no args?\n"; |
| 451 | # } | 471 | # } |
| 452 | 472 | ||
| 453 | if ($output_mode eq "html" || $output_mode eq "xml") { | 473 | if ($output_mode eq "html" || $output_mode eq "html5" || |
| 474 | $output_mode eq "xml") { | ||
| 454 | $contents = local_unescape($contents); | 475 | $contents = local_unescape($contents); |
| 455 | # convert data read & converted thru xml_escape() into &xyz; format: | 476 | # convert data read & converted thru xml_escape() into &xyz; format: |
| 456 | $contents =~ s/\\\\\\/\&/g; | 477 | $contents =~ s/\\\\\\/\&/g; |
| @@ -460,6 +481,11 @@ sub output_highlight { | |||
| 460 | die $@ if $@; | 481 | die $@ if $@; |
| 461 | # print STDERR "contents af:$contents\n"; | 482 | # print STDERR "contents af:$contents\n"; |
| 462 | 483 | ||
| 484 | # strip whitespaces when generating html5 | ||
| 485 | if ($output_mode eq "html5") { | ||
| 486 | $contents =~ s/^\s+//; | ||
| 487 | $contents =~ s/\s+$//; | ||
| 488 | } | ||
| 463 | foreach $line (split "\n", $contents) { | 489 | foreach $line (split "\n", $contents) { |
| 464 | if (! $output_preformatted) { | 490 | if (! $output_preformatted) { |
| 465 | $line =~ s/^\s*//; | 491 | $line =~ s/^\s*//; |
| @@ -480,7 +506,7 @@ sub output_highlight { | |||
| 480 | } | 506 | } |
| 481 | } | 507 | } |
| 482 | 508 | ||
| 483 | #output sections in html | 509 | # output sections in html |
| 484 | sub output_section_html(%) { | 510 | sub output_section_html(%) { |
| 485 | my %args = %{$_[0]}; | 511 | my %args = %{$_[0]}; |
| 486 | my $section; | 512 | my $section; |
| @@ -640,6 +666,239 @@ sub output_blockhead_html(%) { | |||
| 640 | print "<hr>\n"; | 666 | print "<hr>\n"; |
| 641 | } | 667 | } |
| 642 | 668 | ||
| 669 | # output sections in html5 | ||
| 670 | sub output_section_html5(%) { | ||
| 671 | my %args = %{$_[0]}; | ||
| 672 | my $section; | ||
| 673 | |||
| 674 | foreach $section (@{$args{'sectionlist'}}) { | ||
| 675 | print "<section>\n"; | ||
| 676 | print "<h1>$section</h1>\n"; | ||
| 677 | print "<p>\n"; | ||
| 678 | output_highlight($args{'sections'}{$section}); | ||
| 679 | print "</p>\n"; | ||
| 680 | print "</section>\n"; | ||
| 681 | } | ||
| 682 | } | ||
| 683 | |||
| 684 | # output enum in html5 | ||
| 685 | sub output_enum_html5(%) { | ||
| 686 | my %args = %{$_[0]}; | ||
| 687 | my ($parameter); | ||
| 688 | my $count; | ||
| 689 | my $html5id; | ||
| 690 | |||
| 691 | $html5id = $args{'enum'}; | ||
| 692 | $html5id =~ s/[^a-zA-Z0-9\-]+/_/g; | ||
| 693 | print "<article class=\"enum\" id=\"enum:". $html5id . "\">"; | ||
| 694 | print "<h1>enum " . $args{'enum'} . "</h1>\n"; | ||
| 695 | print "<ol class=\"code\">\n"; | ||
| 696 | print "<li>"; | ||
| 697 | print "<span class=\"keyword\">enum</span> "; | ||
| 698 | print "<span class=\"identifier\">" . $args{'enum'} . "</span> {"; | ||
| 699 | print "</li>\n"; | ||
| 700 | $count = 0; | ||
| 701 | foreach $parameter (@{$args{'parameterlist'}}) { | ||
| 702 | print "<li class=\"indent\">"; | ||
| 703 | print "<span class=\"param\">" . $parameter . "</span>"; | ||
| 704 | if ($count != $#{$args{'parameterlist'}}) { | ||
| 705 | $count++; | ||
| 706 | print ","; | ||
| 707 | } | ||
| 708 | print "</li>\n"; | ||
| 709 | } | ||
| 710 | print "<li>};</li>\n"; | ||
| 711 | print "</ol>\n"; | ||
| 712 | |||
| 713 | print "<section>\n"; | ||
| 714 | print "<h1>Constants</h1>\n"; | ||
| 715 | print "<dl>\n"; | ||
| 716 | foreach $parameter (@{$args{'parameterlist'}}) { | ||
| 717 | print "<dt>" . $parameter . "</dt>\n"; | ||
| 718 | print "<dd>"; | ||
| 719 | output_highlight($args{'parameterdescs'}{$parameter}); | ||
| 720 | print "</dd>\n"; | ||
| 721 | } | ||
| 722 | print "</dl>\n"; | ||
| 723 | print "</section>\n"; | ||
| 724 | output_section_html5(@_); | ||
| 725 | print "</article>\n"; | ||
| 726 | } | ||
| 727 | |||
| 728 | # output typedef in html5 | ||
| 729 | sub output_typedef_html5(%) { | ||
| 730 | my %args = %{$_[0]}; | ||
| 731 | my ($parameter); | ||
| 732 | my $count; | ||
| 733 | my $html5id; | ||
| 734 | |||
| 735 | $html5id = $args{'typedef'}; | ||
| 736 | $html5id =~ s/[^a-zA-Z0-9\-]+/_/g; | ||
| 737 | print "<article class=\"typedef\" id=\"typedef:" . $html5id . "\">\n"; | ||
| 738 | print "<h1>typedef " . $args{'typedef'} . "</h1>\n"; | ||
| 739 | |||
| 740 | print "<ol class=\"code\">\n"; | ||
| 741 | print "<li>"; | ||
| 742 | print "<span class=\"keyword\">typedef</span> "; | ||
| 743 | print "<span class=\"identifier\">" . $args{'typedef'} . "</span>"; | ||
| 744 | print "</li>\n"; | ||
| 745 | print "</ol>\n"; | ||
| 746 | output_section_html5(@_); | ||
| 747 | print "</article>\n"; | ||
| 748 | } | ||
| 749 | |||
| 750 | # output struct in html5 | ||
| 751 | sub output_struct_html5(%) { | ||
| 752 | my %args = %{$_[0]}; | ||
| 753 | my ($parameter); | ||
| 754 | my $html5id; | ||
| 755 | |||
| 756 | $html5id = $args{'struct'}; | ||
| 757 | $html5id =~ s/[^a-zA-Z0-9\-]+/_/g; | ||
| 758 | print "<article class=\"struct\" id=\"struct:" . $html5id . "\">\n"; | ||
| 759 | print "<hgroup>\n"; | ||
| 760 | print "<h1>" . $args{'type'} . " " . $args{'struct'} . "</h1>"; | ||
| 761 | print "<h2>". $args{'purpose'} . "</h2>\n"; | ||
| 762 | print "</hgroup>\n"; | ||
| 763 | print "<ol class=\"code\">\n"; | ||
| 764 | print "<li>"; | ||
| 765 | print "<span class=\"type\">" . $args{'type'} . "</span> "; | ||
| 766 | print "<span class=\"identifier\">" . $args{'struct'} . "</span> {"; | ||
| 767 | print "</li>\n"; | ||
| 768 | foreach $parameter (@{$args{'parameterlist'}}) { | ||
| 769 | print "<li class=\"indent\">"; | ||
| 770 | if ($parameter =~ /^#/) { | ||
| 771 | print "<span class=\"param\">" . $parameter ."</span>\n"; | ||
| 772 | print "</li>\n"; | ||
| 773 | next; | ||
| 774 | } | ||
| 775 | my $parameter_name = $parameter; | ||
| 776 | $parameter_name =~ s/\[.*//; | ||
| 777 | |||
| 778 | ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; | ||
| 779 | $type = $args{'parametertypes'}{$parameter}; | ||
| 780 | if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { | ||
| 781 | # pointer-to-function | ||
| 782 | print "<span class=\"type\">$1</span> "; | ||
| 783 | print "<span class=\"param\">$parameter</span>"; | ||
| 784 | print "<span class=\"type\">)</span> "; | ||
| 785 | print "(<span class=\"args\">$2</span>);"; | ||
| 786 | } elsif ($type =~ m/^(.*?)\s*(:.*)/) { | ||
| 787 | # bitfield | ||
| 788 | print "<span class=\"type\">$1</span> "; | ||
| 789 | print "<span class=\"param\">$parameter</span>"; | ||
| 790 | print "<span class=\"bits\">$2</span>;"; | ||
| 791 | } else { | ||
| 792 | print "<span class=\"type\">$type</span> "; | ||
| 793 | print "<span class=\"param\">$parameter</span>;"; | ||
| 794 | } | ||
| 795 | print "</li>\n"; | ||
| 796 | } | ||
| 797 | print "<li>};</li>\n"; | ||
| 798 | print "</ol>\n"; | ||
| 799 | |||
| 800 | print "<section>\n"; | ||
| 801 | print "<h1>Members</h1>\n"; | ||
| 802 | print "<dl>\n"; | ||
| 803 | foreach $parameter (@{$args{'parameterlist'}}) { | ||
| 804 | ($parameter =~ /^#/) && next; | ||
| 805 | |||
| 806 | my $parameter_name = $parameter; | ||
| 807 | $parameter_name =~ s/\[.*//; | ||
| 808 | |||
| 809 | ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; | ||
| 810 | print "<dt>" . $parameter . "</dt>\n"; | ||
| 811 | print "<dd>"; | ||
| 812 | output_highlight($args{'parameterdescs'}{$parameter_name}); | ||
| 813 | print "</dd>\n"; | ||
| 814 | } | ||
| 815 | print "</dl>\n"; | ||
| 816 | print "</section>\n"; | ||
| 817 | output_section_html5(@_); | ||
| 818 | print "</article>\n"; | ||
| 819 | } | ||
| 820 | |||
| 821 | # output function in html5 | ||
| 822 | sub output_function_html5(%) { | ||
| 823 | my %args = %{$_[0]}; | ||
| 824 | my ($parameter, $section); | ||
| 825 | my $count; | ||
| 826 | my $html5id; | ||
| 827 | |||
| 828 | $html5id = $args{'function'}; | ||
| 829 | $html5id =~ s/[^a-zA-Z0-9\-]+/_/g; | ||
| 830 | print "<article class=\"function\" id=\"func:". $html5id . "\">\n"; | ||
| 831 | print "<hgroup>\n"; | ||
| 832 | print "<h1>" . $args{'function'} . "</h1>"; | ||
| 833 | print "<h2>" . $args{'purpose'} . "</h2>\n"; | ||
| 834 | print "</hgroup>\n"; | ||
| 835 | print "<ol class=\"code\">\n"; | ||
| 836 | print "<li>"; | ||
| 837 | print "<span class=\"type\">" . $args{'functiontype'} . "</span> "; | ||
| 838 | print "<span class=\"identifier\">" . $args{'function'} . "</span> ("; | ||
| 839 | print "</li>"; | ||
| 840 | $count = 0; | ||
| 841 | foreach $parameter (@{$args{'parameterlist'}}) { | ||
| 842 | print "<li class=\"indent\">"; | ||
| 843 | $type = $args{'parametertypes'}{$parameter}; | ||
| 844 | if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { | ||
| 845 | # pointer-to-function | ||
| 846 | print "<span class=\"type\">$1</span> "; | ||
| 847 | print "<span class=\"param\">$parameter</span>"; | ||
| 848 | print "<span class=\"type\">)</span> "; | ||
| 849 | print "(<span class=\"args\">$2</span>)"; | ||
| 850 | } else { | ||
| 851 | print "<span class=\"type\">$type</span> "; | ||
| 852 | print "<span class=\"param\">$parameter</span>"; | ||
| 853 | } | ||
| 854 | if ($count != $#{$args{'parameterlist'}}) { | ||
| 855 | $count++; | ||
| 856 | print ","; | ||
| 857 | } | ||
| 858 | print "</li>\n"; | ||
| 859 | } | ||
| 860 | print "<li>)</li>\n"; | ||
| 861 | print "</ol>\n"; | ||
| 862 | |||
| 863 | print "<section>\n"; | ||
| 864 | print "<h1>Arguments</h1>\n"; | ||
| 865 | print "<p>\n"; | ||
| 866 | print "<dl>\n"; | ||
| 867 | foreach $parameter (@{$args{'parameterlist'}}) { | ||
| 868 | my $parameter_name = $parameter; | ||
| 869 | $parameter_name =~ s/\[.*//; | ||
| 870 | |||
| 871 | ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; | ||
| 872 | print "<dt>" . $parameter . "</dt>\n"; | ||
| 873 | print "<dd>"; | ||
| 874 | output_highlight($args{'parameterdescs'}{$parameter_name}); | ||
| 875 | print "</dd>\n"; | ||
| 876 | } | ||
| 877 | print "</dl>\n"; | ||
| 878 | print "</section>\n"; | ||
| 879 | output_section_html5(@_); | ||
| 880 | print "</article>\n"; | ||
| 881 | } | ||
| 882 | |||
| 883 | # output DOC: block header in html5 | ||
| 884 | sub output_blockhead_html5(%) { | ||
| 885 | my %args = %{$_[0]}; | ||
| 886 | my ($parameter, $section); | ||
| 887 | my $count; | ||
| 888 | my $html5id; | ||
| 889 | |||
| 890 | foreach $section (@{$args{'sectionlist'}}) { | ||
| 891 | $html5id = $section; | ||
| 892 | $html5id =~ s/[^a-zA-Z0-9\-]+/_/g; | ||
| 893 | print "<article class=\"doc\" id=\"doc:". $html5id . "\">\n"; | ||
| 894 | print "<h1>$section</h1>\n"; | ||
| 895 | print "<p>\n"; | ||
| 896 | output_highlight($args{'sections'}{$section}); | ||
| 897 | print "</p>\n"; | ||
| 898 | } | ||
| 899 | print "</article>\n"; | ||
| 900 | } | ||
| 901 | |||
| 643 | sub output_section_xml(%) { | 902 | sub output_section_xml(%) { |
| 644 | my %args = %{$_[0]}; | 903 | my %args = %{$_[0]}; |
| 645 | my $section; | 904 | my $section; |
diff --git a/scripts/tags.sh b/scripts/tags.sh index cff8faad73d1..79fdafb0d263 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh | |||
| @@ -154,7 +154,9 @@ exuberant() | |||
| 154 | --regex-c++='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \ | 154 | --regex-c++='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \ |
| 155 | --regex-c++='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \ | 155 | --regex-c++='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \ |
| 156 | --regex-c++='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' \ | 156 | --regex-c++='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' \ |
| 157 | --regex-c++='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/' | 157 | --regex-c++='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/' \ |
| 158 | --regex-c='/PCI_OP_READ\(([a-z]*[a-z]).*[1-4]\)/pci_bus_read_config_\1/' \ | ||
| 159 | --regex-c='/PCI_OP_WRITE\(([a-z]*[a-z]).*[1-4]\)/pci_bus_write_config_\1/' | ||
| 158 | 160 | ||
| 159 | all_kconfigs | xargs $1 -a \ | 161 | all_kconfigs | xargs $1 -a \ |
| 160 | --langdef=kconfig --language-force=kconfig \ | 162 | --langdef=kconfig --language-force=kconfig \ |
| @@ -197,7 +199,9 @@ emacs() | |||
| 197 | --regex='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \ | 199 | --regex='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \ |
| 198 | --regex='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \ | 200 | --regex='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \ |
| 199 | --regex='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' \ | 201 | --regex='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' \ |
| 200 | --regex='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/' | 202 | --regex='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/' \ |
| 203 | --regex='/PCI_OP_READ\(([a-z]*[a-z]).*[1-4]\)/pci_bus_read_config_\1/' \ | ||
| 204 | --regex='/PCI_OP_WRITE\(([a-z]*[a-z]).*[1-4]\)/pci_bus_write_config_\1/' | ||
| 201 | 205 | ||
| 202 | all_kconfigs | xargs $1 -a \ | 206 | all_kconfigs | xargs $1 -a \ |
| 203 | --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/' | 207 | --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/' |
