Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions addons/threadsafety.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@
'race:stdin',
'race:stdout',
'race:streams',
'race:strerror',
'race:strsignal',
'race:strtok',
'race:tmbuf',
Expand Down Expand Up @@ -261,7 +260,6 @@
'siginterrupt',
'sleep',
'srand48',
'strerror',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing strerror causes false negatives everywhere except glibc ≥ 2.32. POSIX still says strerror() doesn't have to be thread-safe. Older glibc (for example RHEL/CentOS 8 ships 2.28), some other libcs and some BSDs/macOS use a static buffer for unknown error numbers. Code analysed with this addon is often portable code, not only code for new glibc. Two options: keep the entry and note it in a comment, or make it depend on a platform/libc option. If the project accepts the false negatives, a short note in the release notes would help users who relied on this warning.

'strsignal',
'strtok',
'tmpnam',
Expand Down
6 changes: 3 additions & 3 deletions test/cli/other_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 +482,9 @@ def test_addon_threadsafety(tmpdir):
test_file = os.path.join(tmpdir, 'test.cpp')
with open(test_file, 'wt') as f:
f.write("""
extern const char* f()
extern void f()
{
return strerror(1);
elf_fill(1);
}
""")

Expand All @@ -496,7 +496,7 @@ def test_addon_threadsafety(tmpdir):
assert lines == [
'Checking {} ...'.format(test_file)
]
assert stderr == '{}:4:12: warning: strerror is MT-unsafe [threadsafety-unsafe-call]\n'.format(test_file)
assert stderr == '{}:4:5: warning: elf_fill is MT-unsafe [threadsafety-unsafe-call]\n'.format(test_file)


def test_addon_naming(tmpdir):
Expand Down
Loading