Skip to content

Commit ee2aa75

Browse files
mchehabJonathan Corbet
authored andcommitted
scripts: kernel-doc: accept negation like !@var
On a few places, it sometimes need to indicate a negation of a parameter, like: !@fshared This pattern happens, for example, at: kernel/futex.c and it is perfectly valid. However, kernel-doc currently transforms it into: !**fshared** This won't do what it would be expected. Fortunately, fixing the script is a simple matter of storing the "!" before "@" and adding it after the bold markup, like: **!fshared** Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/0314b47f8c3e1f9db00d5375a73dc3cddd8a21f2.1586881715.git.mchehab+huawei@kernel.org Signed-off-by: Jonathan Corbet <corbet@lwn.net>
1 parent 346282d commit ee2aa75

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎scripts/kernel-doc‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ my $type_constant = '\b``([^\`]+)``\b';
213213
my $type_constant2 = '\%([-_\w]+)';
214214
my $type_func = '(\w+)\(\)';
215215
my $type_param = '\@(\w*((\.\w+)|(->\w+))*(\.\.\.)?)';
216+
my $type_param_ref = '([\!]?)\@(\w*((\.\w+)|(->\w+))*(\.\.\.)?)';
216217
my $type_fp_param = '\@(\w+)\(\)'; # Special RST handling for func ptr params
217218
my $type_fp_param2 = '\@(\w+->\S+)\(\)'; # Special RST handling for structs with func ptr params
218219
my $type_env = '(\$\w+)';
@@ -237,6 +238,7 @@ my @highlights_man = (
237238
[$type_typedef, "\\\\fI\$1\\\\fP"],
238239
[$type_union, "\\\\fI\$1\\\\fP"],
239240
[$type_param, "\\\\fI\$1\\\\fP"],
241+
[$type_param_ref, "\\\\fI\$1\$2\\\\fP"],
240242
[$type_member, "\\\\fI\$1\$2\$3\\\\fP"],
241243
[$type_fallback, "\\\\fI\$1\\\\fP"]
242244
);
@@ -258,7 +260,7 @@ my @highlights_rst = (
258260
[$type_union, "\\:c\\:type\\:`\$1 <\$2>`"],
259261
# in rst this can refer to any type
260262
[$type_fallback, "\\:c\\:type\\:`\$1`"],
261-
[$type_param, "**\$1**"]
263+
[$type_param_ref, "**\$1\$2**"]
262264
);
263265
my $blankline_rst = "\n";
264266

0 commit comments

Comments
 (0)