[clang-tidy] bzero(3) is not bugprone nor unsafe
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
```
lmax.c:40:2: error: function 'bzero' is deprecated; 'memset' should be used instead [bugprone-unsafe-functions,cert-msc24-c,cert-msc33-c,-warnings-as-errors]
40 | bzero(arr_out, sizeof(arr_out[0][0]) * rows * cols);
| ^~~~~
```
It is true that bzero(3) is deprecated.
However, I can't agree with this being part of `bugprone-unsafe-functions`. It's ironic, because memset(3) is the bugprone and unsafe function. bzero(3) is a much safer thing than memset(3).
Should this diagnostic be called something else? Diagnosing deprecated stuff is significantly different from diagnosing bugprone/unsafe stuff.
Contributor guide
Research direction
The report concerns clang-tidy's bugprone-unsafe-functions check and its diagnostic for bzero(3); start by locating that check and its test coverage. Compare the check's intended scope with the request to separate deprecation from unsafe-function diagnostics, then verify the final diagnostic category and behavior with the check's tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, cpp
- Domain
- compilers, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100