vtjnash wrote:

Is there a good place to continue that discussion on applying the attributes to 
the function type itself (maybe discourse, discord, or some wg)? I had Claude 
prototype a complete demonstration of closing this typeof soundness hole. Of 
course it says it did an amazing job. That seems unlikely at the present stage, 
but I thought it still might be a useful way to ground further conversion on 
the future possibility here with a working prototype to test:
 
https://github.com/vtjnash/llvm-project/blob/jn/tsa-typedef-capability/clang/docs/ThreadSafetyTypeCapabilities-Design.md
 (please ignore the individual commit split as this would need significant 
cleanup). In particular, though it looks like many of the past objections to 
adding the cost of this feature have now already been added to clang in the 
form of `[[noreturn]]` and `cfi_salt`, so we get to just reuse that 
per-existing design and implementation work now. But there's still open 
questions.

As for breakage by adding new diagnosis, we could also have AI write a 
`clang-tidy --fix` type script which iteratively inserts the missing 
annotations until everything is clean, or until it runs into a conflict instead 
and has to apply a hack / document a bug.

There would be a genuine difficulty with enabling this new flag for the linux 
kernel: while it only causes 24 direct warnings (complete analysis at 
https://gist.github.com/vtjnash/94b171e84a8a072fdef01df65a3a1832), only a 
couple of those are real annotation bugs, while most would require having 
something more like `RETURN_CAPABILITY` which works like C++ member functions, 
which isn't easy to express in C to TSA today (a preexisting challenge with 
using TSA without C++ classes)--and currently fixing those few warnings for 
silently dropping capabilities would cause hundreds of new warnings where those 
fields get used unchecked today.

https://github.com/llvm/llvm-project/pull/191187
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to