This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/59856] Support sparse-style context checking, used to validate locking correctness


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59856

--- Comment #11 from Josh Triplett <josh at joshtriplett dot org> ---
(In reply to Tom Tromey from comment #10)
> (In reply to Josh Triplett from comment #9)
> 
> > > It might help to see exactly where __context__ is used in real code.
> > 
> > A few patterns:
> 
> Sorry, I wasn't very clear.
> It seems to me that __context__ must be used as a kind of annotation
> alongside some effect-ful statement.  I'm curious what those statements
> are; and whether we could somehow annotate them directly.
> (I presume not since sparse didn't go that route, but I figured I'd ask.)

Such statements could potentially consist of inline assembly implementing a
lock.  __context__ potentially helps when implementing things as a macro.

That said, if absolutely necessary, I could imagine using exclusively the
context attribute and appropriate static inlines with that attribute.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]