On Mon, Sep 30, 2013 at 03:44:34PM +0200, Peter Zijlstra wrote: > On Wed, Sep 25, 2013 at 02:47:20PM -0700, Josh Triplett wrote: > > That's expressible in Sparse; look at how spin_trylock and _cond_lock, > > and write a _cond_unlock. > > Yeah, I know about __cond_lock() its an abomination that should die. Can't argue with that. > I > did take a stab at teach sparse something saner but got stuck.. was > years ago, can't remember more. I only see two obvious ways to extend Sparse to remove the need for __cond_lock, and only one makes sense. First, you could add an attribute for conditional context changes, which takes an expression; however, that would require an expression evaluator, which internally would construct code a lot like __cond_lock, and it would require some syntax to reference the return value. That seems excessively painful, and not significantly better than __cond_lock. Second, the real solution: teach Sparse to do whole-program analysis, similar to GCC LTO. Alternatively, someone could write a GCC plugin that understands the context attribute and __context__ statement, and then does whole-program context analysis using GCC; that seems easiest, relatively speaking. - Josh Triplett -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html