Skip to content

Commit c28bcf1

Browse files
A man page for regression testing tools/MT-Unsafe.py
Includes expected output.
1 parent 0d5c4a8 commit c28bcf1

3 files changed

Lines changed: 86 additions & 1 deletion

File tree

test/tools/MT-Unsafe.3

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
.TH MT-Unsafe 3 2026-06-21 "CppCheck" "CppCheck Developer Tools"
2+
.SH NAME
3+
MT-Unsafe.py
4+
5+
.SH DESCRIPTION
6+
This man page does
7+
.BI not
8+
document real functions
9+
(although some of the functions it names
10+
.I are
11+
real).
12+
13+
This man page is test data for the
14+
.BI tools/MT-Unsafe.py
15+
script, which is used to convert man pages into data for the
16+
.B cppcheck
17+
addon
18+
.I threadsafety.py\fR.
19+
The output should match
20+
.I test/tools/MT-Unsafe.3.expected\fR.
21+
E.g.:
22+
23+
.I tools/MT-Unsafe.py test/tools/MT-Unsafe.3 | diff - test/tools/MT-Unsafe.3.expected
24+
should produce no output.
25+
26+
.\ .SH SEE ALSO
27+
28+
.SH ATTRIBUTES
29+
For an explanation of the terms used in this section, see
30+
.BR attributes (7).
31+
32+
.TS
33+
allbox;
34+
lbx lb lb
35+
l l l.
36+
Interface Attribute Value
37+
T{
38+
.na
39+
.nh
40+
.BR elf_flagelf (),\~elf_flagehdr(),\~elf_flagphdr(),\~elf_flagscn(),\~elf_flagshdr(),\~elf_flagdata()
41+
T} Thread safety MT-Unsafe
42+
T{
43+
.na
44+
.nh
45+
.BR safe_function (),\~second_safe_function(),third_function()
46+
T} Thread safety MT-Safe
47+
T{
48+
.na
49+
.nh
50+
.BR race_function (),
51+
.BR second_race_function ()
52+
T} Thread safety MT-Unsafe race:argument
53+
.TE
54+
55+
56+
.\ .SH STANDARDS
57+
58+
.\ .SH HISTORY
59+
.\ Original version Andrew C. Aitchison 2026-06-21
60+
61+
.SH AUTHORS
62+
.PP
63+
\fBAndrew Aitchison\fR <\&github@aitchison\&.me\&.uk\&>
64+
.RS 4
65+
Wrote MT-Unsafe.py and this man page\&.
66+
.RE
67+
.SH COPYRIGHT
68+
Copyright (C) 2026 Cppcheck team.
69+
.\ .SH NOTES

test/tools/MT-Unsafe.3.expected

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
# Types marked MT-Unsafe
3+
'',
4+
'race:argument',
5+
# APIs marked MT-Unsafe
6+
'elf_flagdata',
7+
'elf_flagehdr',
8+
'elf_flagelf',
9+
'elf_flagphdr',
10+
'elf_flagscn',
11+
'elf_flagshdr',
12+
'race_function',
13+
'second_race_function',
14+
}
15+

tools/MT-Unsafe.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,15 @@ def man_search(manpage):
9797
dprint(1, 'function_names 1a:\n\t%s\n' % (function_names))
9898
function_names = function_names.replace(r'\n', '')
9999
dprint(1, 'function_names 2:\n\t%s\n' % (function_names))
100-
function_names = re.sub(r"[~() ']+", '', function_names)
100+
function_names = re.sub(r"[~() '\\\n]+", '', function_names)
101101
dprint(1, 'function_names 3:\n\t%s\n' % (function_names))
102102
function_names = re.split(',', function_names)
103103
dprint(1, 'function_names split:\n\t%s\n' % (function_names))
104104

105105
for fn in function_names:
106106
if fn:
107107
apis.add(fn)
108+
dprint(1, 'added function "%s"' % fn)
108109

109110
if 'MT-Unsafe' in lineread:
110111
resUnsafe = re.search("MT-Unsafe\\s+(.*)(\\n\'|$)", lineread)

0 commit comments

Comments
 (0)