cppcheck threadsafety addon
cppcheck is a program which looks for problems with C and C++ code (it does what is known as a static analysis). One of its addons looks for routines that are unsafe when used in multi-thread programs (which do two or more things at once).
This threadsafety addon has a list of such routines, but of course different systems have different unsafe routines, and as systems are updated a routine may be made "MT-safe"; eg man strerror
says Before glibc 2.32, strerror() is not MT-Safe.
Therefore cppcheck source includes a tool which can rebuild the list by reading the man pages of the system.
Some systems are obsoleted every six months, while others are designed to be supported for a decade or longer. Ideally programs should be written to run safely on both sorts of systems.
I am coming to the conclusion that the cppcheck threadsafety addon should be released in two variants: one that only warns about problems on current systems and one that warns about problems on systems with long-term support.
Comments ? Either here or at https://sourceforge.net/p/cppcheck/discussion/general/thread/209919289c/
Output from older but still supported operating systems would be interesting. Script at:
https://raw.githubusercontent.com/danmar/cppcheck/main/tools/MT-Unsafe.py
A typical run would be something like:
python MT-Unsafe.py /usr/share/man/man3
The output will depend slightly upon which man pages are installed on your machine.
The script should run on a Mac, (/usr/share/man/man3 will probably need changing) but I am curious to know whether it can find the information in the Mac man pages, or it is in a different format.
While Windows will have many of the same routines, I know nothing about how Microsoft documents them.