dmcardle wrote:

Thanks, @AaronBallman!

I tried strictly enforcing a `bool` return type, but I ran into some 
interesting test failures.

* A handful of functions in the parsing tests return `void` and yet are 
annotated as trylock functions. I don't believe this is a valid use case. What 
does `EXCLUSIVE_TRYLOCK_FUNCTION` mean when it's impossible to return a value? 
I think the solution is to just change `void` to `bool` for trylock functions 
in tests.  
https://github.com/llvm/llvm-project/blob/06aa078d68380bc775f0a903204fe330d50f4f1f/clang/test/SemaCXX/warn-thread-safety-parsing.cpp#L725

* This next failure is tricker... I was really surprised to see a trylock 
method that returns a pointer! Confusingly, the "success" parameter to the 
attribute is `1`. I think the semantics work out so that returning a 
non-`nullptr` value indicates successful mutex acquisition.

  I'm not quite sure what to do here. Maybe we should be lenient and only 
enforce that the return type is boolean, integer, or pointer?

  
https://github.com/llvm/llvm-project/blob/06aa078d68380bc775f0a903204fe330d50f4f1f/clang/test/SemaCXX/warn-thread-safety-analysis.cpp#L3661




https://github.com/llvm/llvm-project/pull/95290
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to