// RUN: %clang_cc1 -fsyntax-only -Wthread-safety -verify %s
typedef int ThreadRole;
;
;
// Put capability attributes on unions
;
typedef union MutexUnion2;
// Test a different capability name
;
int Test1 ; // expected-error {{'capability' attribute only applies to structs, unions, classes, and typedefs}}
int Test2 ; // expected-error {{'shared_capability' attribute only applies to structs, unions, classes, and typedefs}}
int Test3 ; // expected-warning {{'acquire_capability' attribute only applies to functions}}
int Test4 ; // expected-error {{'try_acquire_capability' attribute only applies to functions}}
int Test5 ; // expected-warning {{'release_capability' attribute only applies to functions}}
; // expected-error {{'capability' attribute requires a string}}
; // expected-error {{'shared_capability' attribute requires a string}}
; // expected-error {{'capability' attribute takes one argument}}
; // expected-error {{'shared_capability' attribute takes one argument}}
struct NotACapability BadCapability;
ThreadRole GUI, Worker;
void
void
void // expected-error {{'requires_capability' attribute takes at least 1 argument}}
void // expected-error {{'requires_shared_capability' attribute takes at least 1 argument}}
void // expected-warning {{'requires_capability' attribute requires arguments whose type is annotated with 'capability' attribute; type here is 'int'}}
void // expected-warning {{'requires_shared_capability' attribute requires arguments whose type is annotated with 'capability' attribute; type here is 'struct NotACapability'}}
void
void
void // expected-warning {{'assert_capability' attribute without capability arguments can only be applied to non-static methods of a class}}
void // expected-warning {{'assert_shared_capability' attribute without capability arguments can only be applied to non-static methods of a class}}
void
void
void // expected-warning {{'acquire_capability' attribute without capability arguments can only be applied to non-static methods of a class}}
void // expected-warning {{'acquire_shared_capability' attribute without capability arguments can only be applied to non-static methods of a class}}
void
void
void
void // expected-warning {{'release_capability' attribute without capability arguments can only be applied to non-static methods of a class}}
void // expected-warning {{'release_shared_capability' attribute without capability arguments can only be applied to non-static methods of a class}}
void // expected-warning {{'release_generic_capability' attribute without capability arguments can only be applied to non-static methods of a class}}
void // expected-warning {{'try_acquire_capability' attribute without capability arguments can only be applied to non-static methods of a class}}
void // expected-warning {{'try_acquire_shared_capability' attribute without capability arguments can only be applied to non-static methods of a class}}
void
void
void // expected-error {{'try_acquire_capability' attribute takes at least 1 argument}}
void // expected-error {{'try_acquire_shared_capability' attribute takes at least 1 argument}}
// Test that boolean logic works with capability attributes
void ;
void ;
void ;
void ;
int AlsoNotACapability;
void ; // expected-warning {{'requires_capability' attribute requires arguments whose type is annotated with 'capability' attribute; type here is 'int'}}