Clang Thread Safety Annotations Current Status.

Hello,

I'm currently playing around with the clang thread safety annotations
in the hopes of using them in the Open vSwitch project. Looks like
the parsing of the annotations is implemented and merged into trunk,
but (as documented) they do nothing yet. Is there a public
development branch floating around which contains implementations for
these? If so how stable is it?

Thanks in advance for the help,
Ethan

Hello,

I’m currently playing around with the clang thread safety annotations
in the hopes of using them in the Open vSwitch project. Looks like
the parsing of the annotations is implemented and merged into trunk,
but (as documented) they do nothing yet. Is there a public
development branch floating around which contains implementations for
these? If so how stable is it?

No branch, its on tot as far as I know. Have you tried them? I’m pretty sure they’re working and the docs are just out of date.

Perhaps I'm missing something then. I compiled the following program:

static int x __attribute__((guarded_var));

int
main(int argc, char *argv[])
{
    x = 1;
    x = 0;
    return x;
}

With these options: clang -O0 -Wall -Werror

Using the clang-3.4 I got from here:

deb http://llvm.org/apt/precise/ llvm-toolchain-precise main
deb-src http://llvm.org/apt/precise/ llvm-toolchain-precise main

Which I was lead to believe is a nightly build.

I would expect this program to fail to compile because I don't take a
lock when accessing "x", but it seems to work fine. Perhaps there's
some command line magic I'm missing? Or perhaps I need to manually
build off trunk?

Ethan

You need to use -Wthread-safety.

Ah awesome it works now. I should have looked at the docs more
closely, I assumed that -Wall included the checks.

Thanks a lot for the help!
Ethan