From: Jani Nikula <jani.nikula@intel.com>
To: Jani Nikula <jani.nikula@intel.com>, Jonathan Corbet <corbet@lwn.net>
Cc: Markus Heiser <markus.heiser@darmarit.de>,
Daniel Vetter <daniel.vetter@ffwll.ch>,
Grant Likely <grant.likely@secretlab.ca>,
Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
Keith Packard <keithp@keithp.com>,
LKML <linux-kernel@vger.kernel.org>,
linux-doc@vger.kernel.org, Hans Verkuil <hverkuil@xs4all.nl>
Subject: [docs-next PATCH v2 05/11] kernel-doc: add support for specifying extra files for EXPORT_SYMBOLs
Date: Thu, 23 Jun 2016 15:28:05 +0300 [thread overview]
Message-ID: <88c2b57da4ce3c8b5f849dc5356bdea9e2ed1134.1466684436.git.jani.nikula@intel.com> (raw)
In-Reply-To: <cover.1466684436.git.jani.nikula@intel.com>
In-Reply-To: <cover.1466684436.git.jani.nikula@intel.com>
If the kernel-doc comments for functions are not in the same file as the
EXPORT_SYMBOL statements, the -export and -internal output selections do
not work as expected. This is typically the case when the kernel-doc
comments are in header files next to the function declarations and the
EXPORT_SYMBOL statements are next to the function definitions in the
source files.
Let the user specify additional source files in which to look for the
EXPORT_SYMBOLs using the new -export-file FILE option, which may be
given multiple times.
The pathological example for this is include/net/mac80211.h, which has
all the kernel-doc documentation for the exported functions defined in a
plethora of source files net/mac80211/*.c.
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
scripts/kernel-doc | 39 +++++++++++++++++++++++++++++++++++++--
1 file changed, 37 insertions(+), 2 deletions(-)
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 516d95fcefb7..9708a87c7069 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -61,10 +61,10 @@ Output format selection (mutually exclusive):
Output selection (mutually exclusive):
-export Only output documentation for symbols that have been
exported using EXPORT_SYMBOL() or EXPORT_SYMBOL_GPL()
- in the same FILE.
+ in the same FILE or any -export-file FILE.
-internal Only output documentation for symbols that have NOT been
exported using EXPORT_SYMBOL() or EXPORT_SYMBOL_GPL()
- in the same FILE.
+ in the same FILE or any -export-file FILE.
-function NAME Only output documentation for the given function(s)
or DOC: section title(s). All other functions and DOC:
sections are ignored. May be specified multiple times.
@@ -76,6 +76,9 @@ Output selection modifiers:
-no-doc-sections Do not output DOC: sections.
-enable-lineno Enable output of #define LINENO lines. Only works with
reStructuredText format.
+ -export-file FILE Specify an additional FILE in which to look for
+ EXPORT_SYMBOL() and EXPORT_SYMBOL_GPL(). To be used with
+ -export or -internal. May be specified multiple times.
Other parameters:
-v Verbose output, more warnings and other information.
@@ -336,6 +339,8 @@ use constant {
my $output_selection = OUTPUT_ALL;
my $show_not_found = 0;
+my @export_file_list;
+
my @build_time;
if (defined($ENV{'KBUILD_BUILD_TIMESTAMP'}) &&
(my $seconds = `date -d"${ENV{'KBUILD_BUILD_TIMESTAMP'}}" +%s`) ne '') {
@@ -488,6 +493,9 @@ while ($ARGV[0] =~ m/^-(.*)/) {
} elsif ($cmd eq "-internal") { # only non-exported symbols
$output_selection = OUTPUT_INTERNAL;
%function_table = ();
+ } elsif ($cmd eq "-export-file") {
+ my $file = shift @ARGV;
+ push(@export_file_list, $file);
} elsif ($cmd eq "-v") {
$verbose = 1;
} elsif (($cmd eq "-h") || ($cmd eq "--help")) {
@@ -2747,6 +2755,25 @@ sub map_filename($) {
return $file;
}
+sub process_export_file($) {
+ my ($orig_file) = @_;
+ my $file = map_filename($orig_file);
+
+ if (!open(IN,"<$file")) {
+ print STDERR "Error: Cannot open file $file\n";
+ ++$errors;
+ return;
+ }
+
+ while (<IN>) {
+ if (/$export_symbol/) {
+ $function_table{$2} = 1;
+ }
+ }
+
+ close(IN);
+}
+
sub process_file($) {
my $file;
my $identifier;
@@ -3081,6 +3108,14 @@ if (open(SOURCE_MAP, "<.tmp_filelist.txt")) {
close(SOURCE_MAP);
}
+if ($output_selection == OUTPUT_EXPORTED ||
+ $output_selection == OUTPUT_INTERNAL) {
+ foreach (@export_file_list) {
+ chomp;
+ process_export_file($_);
+ }
+}
+
foreach (@ARGV) {
chomp;
process_file($_);
--
2.1.4
next prev parent reply other threads:[~2016-06-23 12:30 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-23 12:28 [docs-next PATCH v2 00/11] Documentation/sphinx follow-up, again Jani Nikula
2016-06-23 12:28 ` [docs-next PATCH v2 01/11] kernel-doc: remove old debug cruft from dump_section() Jani Nikula
2016-06-23 12:28 ` [docs-next PATCH v2 02/11] kernel-doc: do not warn about duplicate default section names Jani Nikula
2016-06-23 12:28 ` [docs-next PATCH v2 03/11] kernel-doc: add missing semi-colons in option parsing Jani Nikula
2016-06-23 12:28 ` [docs-next PATCH v2 04/11] kernel-doc: abstract filename mapping Jani Nikula
2016-06-23 12:28 ` Jani Nikula [this message]
2016-06-23 12:28 ` [docs-next PATCH v2 06/11] kernel-doc: unify all EXPORT_SYMBOL scanning to one place Jani Nikula
2016-06-23 12:28 ` [docs-next PATCH v2 07/11] Documentation/sphinx: remove unnecessary temporary variable Jani Nikula
2016-06-23 12:28 ` [docs-next PATCH v2 08/11] Documentation/sphinx: use a more sensible string split in kernel-doc extension Jani Nikula
2016-06-23 12:28 ` [docs-next PATCH v2 09/11] Documentation/sphinx: add support for specifying extra export files Jani Nikula
2016-06-23 12:28 ` [docs-next PATCH v2 10/11] Documentation/sphinx: drop modindex, we don't have python modules Jani Nikula
2016-06-23 12:28 ` [docs-next PATCH v2 11/11] Documentation: add top level 'make help' output for Sphinx Jani Nikula
2016-06-23 13:47 ` [docs-next PATCH v2 00/11] Documentation/sphinx follow-up, again Jonathan Corbet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=88c2b57da4ce3c8b5f849dc5356bdea9e2ed1134.1466684436.git.jani.nikula@intel.com \
--to=jani.nikula@intel.com \
--cc=corbet@lwn.net \
--cc=daniel.vetter@ffwll.ch \
--cc=grant.likely@secretlab.ca \
--cc=hverkuil@xs4all.nl \
--cc=keithp@keithp.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=markus.heiser@darmarit.de \
--cc=mchehab@osg.samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®