drm: atmel-hlcdc: Uninitialized return in atmel_hlcdc_create_outputs()
[linux-2.6/btrfs-unstable.git] / Documentation / doc-guide / parse-headers.rst
blob96a0423d5dba9d486647dcc4e453a9ac79606e64
1 ===========================
2 Including uAPI header files
3 ===========================
5 Sometimes, it is useful to include header files and C example codes in
6 order to describe the userspace API and to generate cross-references
7 between the code and the documentation. Adding cross-references for
8 userspace API files has an additional vantage: Sphinx will generate warnings
9 if a symbol is not found at the documentation. That helps to keep the
10 uAPI documentation in sync with the Kernel changes.
11 The :ref:`parse_headers.pl <parse_headers>` provide a way to generate such
12 cross-references. It has to be called via Makefile, while building the
13 documentation. Please see ``Documentation/media/Makefile`` for an example
14 about how to use it inside the Kernel tree.
16 .. _parse_headers:
18 parse_headers.pl
19 ^^^^^^^^^^^^^^^^
21 NAME
22 ****
25 parse_headers.pl - parse a C file, in order to identify functions, structs,
26 enums and defines and create cross-references to a Sphinx book.
29 SYNOPSIS
30 ********
33 \ **parse_headers.pl**\  [<options>] <C_FILE> <OUT_FILE> [<EXCEPTIONS_FILE>]
35 Where <options> can be: --debug, --help or --man.
38 OPTIONS
39 *******
43 \ **--debug**\
45  Put the script in verbose mode, useful for debugging.
49 \ **--usage**\
51  Prints a brief help message and exits.
55 \ **--help**\
57  Prints a more detailed help message and exits.
60 DESCRIPTION
61 ***********
64 Convert a C header or source file (C_FILE), into a ReStructured Text
65 included via ..parsed-literal block with cross-references for the
66 documentation files that describe the API. It accepts an optional
67 EXCEPTIONS_FILE with describes what elements will be either ignored or
68 be pointed to a non-default reference.
70 The output is written at the (OUT_FILE).
72 It is capable of identifying defines, functions, structs, typedefs,
73 enums and enum symbols and create cross-references for all of them.
74 It is also capable of distinguish #define used for specifying a Linux
75 ioctl.
77 The EXCEPTIONS_FILE contain two types of statements: \ **ignore**\  or \ **replace**\ .
79 The syntax for the ignore tag is:
82 ignore \ **type**\  \ **name**\
84 The \ **ignore**\  means that it won't generate cross references for a
85 \ **name**\  symbol of type \ **type**\ .
87 The syntax for the replace tag is:
90 replace \ **type**\  \ **name**\  \ **new_value**\
92 The \ **replace**\  means that it will generate cross references for a
93 \ **name**\  symbol of type \ **type**\ , but, instead of using the default
94 replacement rule, it will use \ **new_value**\ .
96 For both statements, \ **type**\  can be either one of the following:
99 \ **ioctl**\
101  The ignore or replace statement will apply to ioctl definitions like:
103  #define        VIDIOC_DBG_S_REGISTER    _IOW('V', 79, struct v4l2_dbg_register)
107 \ **define**\
109  The ignore or replace statement will apply to any other #define found
110  at C_FILE.
114 \ **typedef**\
116  The ignore or replace statement will apply to typedef statements at C_FILE.
120 \ **struct**\
122  The ignore or replace statement will apply to the name of struct statements
123  at C_FILE.
127 \ **enum**\
129  The ignore or replace statement will apply to the name of enum statements
130  at C_FILE.
134 \ **symbol**\
136  The ignore or replace statement will apply to the name of enum statements
137  at C_FILE.
139  For replace statements, \ **new_value**\  will automatically use :c:type:
140  references for \ **typedef**\ , \ **enum**\  and \ **struct**\  types. It will use :ref:
141  for \ **ioctl**\ , \ **define**\  and \ **symbol**\  types. The type of reference can
142  also be explicitly defined at the replace statement.
146 EXAMPLES
147 ********
150 ignore define _VIDEODEV2_H
153 Ignore a #define _VIDEODEV2_H at the C_FILE.
155 ignore symbol PRIVATE
158 On a struct like:
160 enum foo { BAR1, BAR2, PRIVATE };
162 It won't generate cross-references for \ **PRIVATE**\ .
164 replace symbol BAR1 :c:type:\`foo\`
165 replace symbol BAR2 :c:type:\`foo\`
168 On a struct like:
170 enum foo { BAR1, BAR2, PRIVATE };
172 It will make the BAR1 and BAR2 enum symbols to cross reference the foo
173 symbol at the C domain.
176 BUGS
177 ****
180 Report bugs to Mauro Carvalho Chehab <mchehab@s-opensource.com>
183 COPYRIGHT
184 *********
187 Copyright (c) 2016 by Mauro Carvalho Chehab <mchehab@s-opensource.com>.
189 License GPLv2: GNU GPL version 2 <http://gnu.org/licenses/gpl.html>.
191 This is free software: you are free to change and redistribute it.
192 There is NO WARRANTY, to the extent permitted by law.