-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Clang Thread Safety Annotations (locks-only) #1036
Add Clang Thread Safety Annotations (locks-only) #1036
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1036 +/- ##
=======================================
- Coverage 77.7% 77.7% -0.1%
=======================================
Files 247 247
Lines 63991 64003 +12
Branches 5896 5896
=======================================
- Hits 49775 49755 -20
- Misses 11532 11548 +16
- Partials 2684 2700 +16
Flags with carried forward coverage won't be shown. Click here to find out more.
|
46254fd
to
298aaeb
Compare
298aaeb
to
3ef0074
Compare
3ef0074
to
6535ee6
Compare
6535ee6
to
b132cce
Compare
b132cce
to
8d7fec9
Compare
8d7fec9
to
115b4ef
Compare
3f8b95a
to
6f4cb90
Compare
728f07e
to
59e500e
Compare
I'm reasonably confident that this will be low-noise and will not be causing annoying problems. Judging from past history, the only way to get this in is probably to just push it to main and then see whether my confidence was justified, or it does cause some problems and needs to be reverted. I still have the previous full PR (which contains additional annotation for running on the core thread) in the queue |
This is a big enough change that I would at least like @kgiusti to sign off on it before this lands on main |
He said this about it (long time ago) #212 (review) I really think this will be low friction in practice. That was the whole point of the "reduced, locks-only" PR, after all. And if not, I'm ready with my finger on the revert button. Either way, I really want to conclude this "initiative" in some way. At least this way it will be shown if thread-safety-annotations are beneficial or painful. |
Uses https://clang.llvm.org/docs/ThreadSafetyAnalysis.html (with all the limitations that stem from it, namely, works only in clang or IDE based on clangd, and the GUARDED_BY annotation cannot be used in C structs, llvm/llvm-project#20777)
How it works in action
Example of a text-only compile failure message: https://github.com/jiridanek/skupper-router/actions/runs/4555107395/jobs/8033958647#step:25:282
Example of the clangd IDE integration:
Calling a
_LH
function without holding the lockUnlocking something that is not locked
Returning without unlocking