From 64b111e81d0d699825734e282e2ee71fb2a0ce19 Mon Sep 17 00:00:00 2001 From: DeLesley Hutchins Date: Mon, 23 Apr 2012 20:41:57 +0000 Subject: [PATCH] Thread safety analysis: refactor test cases so that the style is consistent. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155388 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/SemaCXX/warn-thread-safety-parsing.cpp | 746 ++++++++++---------- 1 file changed, 373 insertions(+), 373 deletions(-) diff --git a/test/SemaCXX/warn-thread-safety-parsing.cpp b/test/SemaCXX/warn-thread-safety-parsing.cpp index af02be1430..40837eab2e 100644 --- a/test/SemaCXX/warn-thread-safety-parsing.cpp +++ b/test/SemaCXX/warn-thread-safety-parsing.cpp @@ -22,7 +22,7 @@ #define NO_THREAD_SAFETY_ANALYSIS __attribute__ ((no_thread_safety_analysis)) -class __attribute__((lockable)) Mu { +class LOCKABLE Mutex { public: void Lock(); }; @@ -32,11 +32,11 @@ class UnlockableMu{ class MuWrapper { public: - Mu mu; - Mu getMu() { + Mutex mu; + Mutex getMu() { return mu; } - Mu * getMuPointer() { + Mutex * getMuPointer() { return μ } }; @@ -50,32 +50,32 @@ class MuDoubleWrapper { } }; -Mu mu1; +Mutex mu1; UnlockableMu umu; -Mu mu2; +Mutex mu2; MuWrapper muWrapper; MuDoubleWrapper muDoubleWrapper; -Mu* muPointer; -Mu ** muDoublePointer = & muPointer; -Mu& muRef = mu1; +Mutex* muPointer; +Mutex** muDoublePointer = & muPointer; +Mutex& muRef = mu1; //---------------------------------------// // Scoping tests //--------------------------------------// class Foo { - Mu foomu; - void needLock() __attribute__((exclusive_lock_function(foomu))); + Mutex foomu; + void needLock() EXCLUSIVE_LOCK_FUNCTION(foomu); }; class Foo2 { - void needLock() __attribute__((exclusive_lock_function(foomu))); - Mu foomu; + void needLock() EXCLUSIVE_LOCK_FUNCTION(foomu); + Mutex foomu; }; class Bar { - Mu barmu; - Mu barmu2 __attribute__((acquired_after(barmu))); + Mutex barmu; + Mutex barmu2 ACQUIRED_AFTER(barmu); }; @@ -90,34 +90,34 @@ class Bar { #error "Should support no_thread_safety_analysis attribute" #endif -void noanal_fun() __attribute__((no_thread_safety_analysis)); +void noanal_fun() NO_THREAD_SAFETY_ANALYSIS; void noanal_fun_args() __attribute__((no_thread_safety_analysis(1))); // \ // expected-error {{attribute takes no arguments}} -int noanal_testfn(int y) __attribute__((no_thread_safety_analysis)); +int noanal_testfn(int y) NO_THREAD_SAFETY_ANALYSIS; int noanal_testfn(int y) { - int x __attribute__((no_thread_safety_analysis)) = y; // \ + int x NO_THREAD_SAFETY_ANALYSIS = y; // \ // expected-warning {{'no_thread_safety_analysis' attribute only applies to functions and methods}} return x; }; -int noanal_test_var __attribute__((no_thread_safety_analysis)); // \ +int noanal_test_var NO_THREAD_SAFETY_ANALYSIS; // \ // expected-warning {{'no_thread_safety_analysis' attribute only applies to functions and methods}} class NoanalFoo { private: - int test_field __attribute__((no_thread_safety_analysis)); // \ + int test_field NO_THREAD_SAFETY_ANALYSIS; // \ // expected-warning {{'no_thread_safety_analysis' attribute only applies to functions and methods}} - void test_method() __attribute__((no_thread_safety_analysis)); + void test_method() NO_THREAD_SAFETY_ANALYSIS; }; -class __attribute__((no_thread_safety_analysis)) NoanalTestClass { // \ +class NO_THREAD_SAFETY_ANALYSIS NoanalTestClass { // \ // expected-warning {{'no_thread_safety_analysis' attribute only applies to functions and methods}} }; -void noanal_fun_params(int lvar __attribute__((no_thread_safety_analysis))); // \ +void noanal_fun_params(int lvar NO_THREAD_SAFETY_ANALYSIS); // \ // expected-warning {{'no_thread_safety_analysis' attribute only applies to functions and methods}} @@ -129,30 +129,30 @@ void noanal_fun_params(int lvar __attribute__((no_thread_safety_analysis))); // #error "Should support guarded_var attribute" #endif -int gv_var_noargs __attribute__((guarded_var)); +int gv_var_noargs GUARDED_VAR; int gv_var_args __attribute__((guarded_var(1))); // \ // expected-error {{attribute takes no arguments}} class GVFoo { private: - int gv_field_noargs __attribute__((guarded_var)); + int gv_field_noargs GUARDED_VAR; int gv_field_args __attribute__((guarded_var(1))); // \ // expected-error {{attribute takes no arguments}} }; -class __attribute__((guarded_var)) GV { // \ +class GUARDED_VAR GV { // \ // expected-warning {{'guarded_var' attribute only applies to fields and global variables}} }; -void gv_function() __attribute__((guarded_var)); // \ +void gv_function() GUARDED_VAR; // \ // expected-warning {{'guarded_var' attribute only applies to fields and global variables}} -void gv_function_params(int gv_lvar __attribute__((guarded_var))); // \ +void gv_function_params(int gv_lvar GUARDED_VAR); // \ // expected-warning {{'guarded_var' attribute only applies to fields and global variables}} int gv_testfn(int y){ - int x __attribute__((guarded_var)) = y; // \ + int x GUARDED_VAR = y; // \ // expected-warning {{'guarded_var' attribute only applies to fields and global variables}} return x; } @@ -167,21 +167,21 @@ int gv_testfn(int y){ #error "Should support pt_guarded_var attribute" #endif -int *pgv_pt_var_noargs __attribute__((pt_guarded_var)); +int *pgv_pt_var_noargs PT_GUARDED_VAR; -int pgv_var_noargs __attribute__((pt_guarded_var)); // \ +int pgv_var_noargs PT_GUARDED_VAR; // \ // expected-warning {{'pt_guarded_var' only applies to pointer types; type here is 'int'}} class PGVFoo { private: - int *pt_field_noargs __attribute__((pt_guarded_var)); - int field_noargs __attribute__((pt_guarded_var)); // \ + int *pt_field_noargs PT_GUARDED_VAR; + int field_noargs PT_GUARDED_VAR; // \ // expected-warning {{'pt_guarded_var' only applies to pointer types; type here is 'int'}} int *gv_field_args __attribute__((pt_guarded_var(1))); // \ // expected-error {{attribute takes no arguments}} }; -class __attribute__((pt_guarded_var)) PGV { // \ +class PT_GUARDED_VAR PGV { // \ // expected-warning {{'pt_guarded_var' attribute only applies to fields and global variables}} }; @@ -189,14 +189,14 @@ int *pgv_var_args __attribute__((pt_guarded_var(1))); // \ // expected-error {{attribute takes no arguments}} -void pgv_function() __attribute__((pt_guarded_var)); // \ +void pgv_function() PT_GUARDED_VAR; // \ // expected-warning {{'pt_guarded_var' attribute only applies to fields and global variables}} -void pgv_function_params(int *gv_lvar __attribute__((pt_guarded_var))); // \ +void pgv_function_params(int *gv_lvar PT_GUARDED_VAR); // \ // expected-warning {{'pt_guarded_var' attribute only applies to fields and global variables}} void pgv_testfn(int y){ - int *x __attribute__((pt_guarded_var)) = new int(0); // \ + int *x PT_GUARDED_VAR = new int(0); // \ // expected-warning {{'pt_guarded_var' attribute only applies to fields and global variables}} delete x; } @@ -211,35 +211,35 @@ void pgv_testfn(int y){ #error "Should support lockable attribute" #endif -class __attribute__((lockable)) LTestClass { +class LOCKABLE LTestClass { }; class __attribute__((lockable (1))) LTestClass_args { // \ // expected-error {{attribute takes no arguments}} }; -void l_test_function() __attribute__((lockable)); // \ +void l_test_function() LOCKABLE; // \ // expected-warning {{'lockable' attribute only applies to classes}} int l_testfn(int y) { - int x __attribute__((lockable)) = y; // \ + int x LOCKABLE = y; // \ // expected-warning {{'lockable' attribute only applies to classes}} return x; } -int l_test_var __attribute__((lockable)); // \ +int l_test_var LOCKABLE; // \ // expected-warning {{'lockable' attribute only applies to classes}} class LFoo { private: - int test_field __attribute__((lockable)); // \ + int test_field LOCKABLE; // \ // expected-warning {{'lockable' attribute only applies to classes}} - void test_method() __attribute__((lockable)); // \ + void test_method() LOCKABLE; // \ // expected-warning {{'lockable' attribute only applies to classes}} }; -void l_function_params(int lvar __attribute__((lockable))); // \ +void l_function_params(int lvar LOCKABLE); // \ // expected-warning {{'lockable' attribute only applies to classes}} @@ -251,35 +251,35 @@ void l_function_params(int lvar __attribute__((lockable))); // \ #error "Should support scoped_lockable attribute" #endif -class __attribute__((scoped_lockable)) SLTestClass { +class SCOPED_LOCKABLE SLTestClass { }; class __attribute__((scoped_lockable (1))) SLTestClass_args { // \ // expected-error {{attribute takes no arguments}} }; -void sl_test_function() __attribute__((scoped_lockable)); // \ +void sl_test_function() SCOPED_LOCKABLE; // \ // expected-warning {{'scoped_lockable' attribute only applies to classes}} int sl_testfn(int y) { - int x __attribute__((scoped_lockable)) = y; // \ + int x SCOPED_LOCKABLE = y; // \ // expected-warning {{'scoped_lockable' attribute only applies to classes}} return x; } -int sl_test_var __attribute__((scoped_lockable)); // \ +int sl_test_var SCOPED_LOCKABLE; // \ // expected-warning {{'scoped_lockable' attribute only applies to classes}} class SLFoo { private: - int test_field __attribute__((scoped_lockable)); // \ + int test_field SCOPED_LOCKABLE; // \ // expected-warning {{'scoped_lockable' attribute only applies to classes}} - void test_method() __attribute__((scoped_lockable)); // \ + void test_method() SCOPED_LOCKABLE; // \ // expected-warning {{'scoped_lockable' attribute only applies to classes}} }; -void sl_function_params(int lvar __attribute__((scoped_lockable))); // \ +void sl_function_params(int lvar SCOPED_LOCKABLE); // \ // expected-warning {{'scoped_lockable' attribute only applies to classes}} @@ -295,7 +295,7 @@ void sl_function_params(int lvar __attribute__((scoped_lockable))); // \ //1. Check applied to the right types & argument number -int gb_var_arg __attribute__((guarded_by(mu1))); +int gb_var_arg GUARDED_BY(mu1); int gb_var_args __attribute__((guarded_by(mu1, mu2))); // \ // expected-error {{attribute takes one argument}} @@ -307,21 +307,21 @@ class GBFoo { private: int gb_field_noargs __attribute__((guarded_by)); // \ // expected-error {{attribute takes one argument}} - int gb_field_args __attribute__((guarded_by(mu1))); + int gb_field_args GUARDED_BY(mu1); }; -class __attribute__((guarded_by(mu1))) GB { // \ +class GUARDED_BY(mu1) GB { // \ // expected-warning {{'guarded_by' attribute only applies to fields and global variables}} }; -void gb_function() __attribute__((guarded_by(mu1))); // \ +void gb_function() GUARDED_BY(mu1); // \ // expected-warning {{'guarded_by' attribute only applies to fields and global variables}} -void gb_function_params(int gv_lvar __attribute__((guarded_by(mu1)))); // \ +void gb_function_params(int gv_lvar GUARDED_BY(mu1)); // \ // expected-warning {{'guarded_by' attribute only applies to fields and global variables}} int gb_testfn(int y){ - int x __attribute__((guarded_by(mu1))) = y; // \ + int x GUARDED_BY(mu1) = y; // \ // expected-warning {{'guarded_by' attribute only applies to fields and global variables}} return x; } @@ -329,24 +329,24 @@ int gb_testfn(int y){ //2. Check argument parsing. // legal attribute arguments -int gb_var_arg_1 __attribute__((guarded_by(muWrapper.mu))); -int gb_var_arg_2 __attribute__((guarded_by(muDoubleWrapper.muWrapper->mu))); -int gb_var_arg_3 __attribute__((guarded_by(muWrapper.getMu()))); -int gb_var_arg_4 __attribute__((guarded_by(*muWrapper.getMuPointer()))); -int gb_var_arg_5 __attribute__((guarded_by(&mu1))); -int gb_var_arg_6 __attribute__((guarded_by(muRef))); -int gb_var_arg_7 __attribute__((guarded_by(muDoubleWrapper.getWrapper()->getMu()))); -int gb_var_arg_8 __attribute__((guarded_by(muPointer))); +int gb_var_arg_1 GUARDED_BY(muWrapper.mu); +int gb_var_arg_2 GUARDED_BY(muDoubleWrapper.muWrapper->mu); +int gb_var_arg_3 GUARDED_BY(muWrapper.getMu()); +int gb_var_arg_4 GUARDED_BY(*muWrapper.getMuPointer()); +int gb_var_arg_5 GUARDED_BY(&mu1); +int gb_var_arg_6 GUARDED_BY(muRef); +int gb_var_arg_7 GUARDED_BY(muDoubleWrapper.getWrapper()->getMu()); +int gb_var_arg_8 GUARDED_BY(muPointer); // illegal attribute arguments -int gb_var_arg_bad_1 __attribute__((guarded_by(1))); // \ +int gb_var_arg_bad_1 GUARDED_BY(1); // \ // expected-warning {{'guarded_by' attribute requires arguments that are class type or point to class type; type here is 'int'}} -int gb_var_arg_bad_2 __attribute__((guarded_by("mu"))); // \ +int gb_var_arg_bad_2 GUARDED_BY("mu"); // \ // expected-warning {{ignoring 'guarded_by' attribute because its argument is invalid}} -int gb_var_arg_bad_3 __attribute__((guarded_by(muDoublePointer))); // \ - // expected-warning {{'guarded_by' attribute requires arguments that are class type or point to class type; type here is 'class Mu **'}} -int gb_var_arg_bad_4 __attribute__((guarded_by(umu))); // \ +int gb_var_arg_bad_3 GUARDED_BY(muDoublePointer); // \ + // expected-warning {{'guarded_by' attribute requires arguments that are class type or point to class type; type here is 'class Mutex **'}} +int gb_var_arg_bad_4 GUARDED_BY(umu); // \ // expected-warning {{'guarded_by' attribute requires arguments whose type is annotated with 'lockable' attribute; type here is 'class UnlockableMu'}} //3. @@ -366,33 +366,33 @@ int gb_var_arg_bad_4 __attribute__((guarded_by(umu))); // \ int *pgb_var_noargs __attribute__((pt_guarded_by)); // \ // expected-error {{attribute takes one argument}} -int *pgb_ptr_var_arg __attribute__((pt_guarded_by(mu1))); +int *pgb_ptr_var_arg PT_GUARDED_BY(mu1); -int *pgb_ptr_var_args __attribute__((guarded_by(mu1, mu2))); // \ +int *pgb_ptr_var_args __attribute__((pt_guarded_by(mu1, mu2))); // \ // expected-error {{attribute takes one argument}} -int pgb_var_args __attribute__((pt_guarded_by(mu1))); // \ +int pgb_var_args PT_GUARDED_BY(mu1); // \ // expected-warning {{'pt_guarded_by' only applies to pointer types; type here is 'int'}} class PGBFoo { private: int *pgb_field_noargs __attribute__((pt_guarded_by)); // \ // expected-error {{attribute takes one argument}} - int *pgb_field_args __attribute__((pt_guarded_by(mu1))); + int *pgb_field_args PT_GUARDED_BY(mu1); }; -class __attribute__((pt_guarded_by(mu1))) PGB { // \ +class PT_GUARDED_BY(mu1) PGB { // \ // expected-warning {{'pt_guarded_by' attribute only applies to fields and global variables}} }; -void pgb_function() __attribute__((pt_guarded_by(mu1))); // \ +void pgb_function() PT_GUARDED_BY(mu1); // \ // expected-warning {{'pt_guarded_by' attribute only applies to fields and global variables}} -void pgb_function_params(int gv_lvar __attribute__((pt_guarded_by(mu1)))); // \ +void pgb_function_params(int gv_lvar PT_GUARDED_BY(mu1)); // \ // expected-warning {{'pt_guarded_by' attribute only applies to fields and global variables}} void pgb_testfn(int y){ - int *x __attribute__((pt_guarded_by(mu1))) = new int(0); // \ + int *x PT_GUARDED_BY(mu1) = new int(0); // \ // expected-warning {{'pt_guarded_by' attribute only applies to fields and global variables}} delete x; } @@ -400,24 +400,24 @@ void pgb_testfn(int y){ //2. Check argument parsing. // legal attribute arguments -int * pgb_var_arg_1 __attribute__((pt_guarded_by(muWrapper.mu))); -int * pgb_var_arg_2 __attribute__((pt_guarded_by(muDoubleWrapper.muWrapper->mu))); -int * pgb_var_arg_3 __attribute__((pt_guarded_by(muWrapper.getMu()))); -int * pgb_var_arg_4 __attribute__((pt_guarded_by(*muWrapper.getMuPointer()))); -int * pgb_var_arg_5 __attribute__((pt_guarded_by(&mu1))); -int * pgb_var_arg_6 __attribute__((pt_guarded_by(muRef))); -int * pgb_var_arg_7 __attribute__((pt_guarded_by(muDoubleWrapper.getWrapper()->getMu()))); -int * pgb_var_arg_8 __attribute__((pt_guarded_by(muPointer))); +int * pgb_var_arg_1 PT_GUARDED_BY(muWrapper.mu); +int * pgb_var_arg_2 PT_GUARDED_BY(muDoubleWrapper.muWrapper->mu); +int * pgb_var_arg_3 PT_GUARDED_BY(muWrapper.getMu()); +int * pgb_var_arg_4 PT_GUARDED_BY(*muWrapper.getMuPointer()); +int * pgb_var_arg_5 PT_GUARDED_BY(&mu1); +int * pgb_var_arg_6 PT_GUARDED_BY(muRef); +int * pgb_var_arg_7 PT_GUARDED_BY(muDoubleWrapper.getWrapper()->getMu()); +int * pgb_var_arg_8 PT_GUARDED_BY(muPointer); // illegal attribute arguments -int * pgb_var_arg_bad_1 __attribute__((pt_guarded_by(1))); // \ +int * pgb_var_arg_bad_1 PT_GUARDED_BY(1); // \ // expected-warning {{'pt_guarded_by' attribute requires arguments that are class type or point to class type}} -int * pgb_var_arg_bad_2 __attribute__((pt_guarded_by("mu"))); // \ +int * pgb_var_arg_bad_2 PT_GUARDED_BY("mu"); // \ // expected-warning {{ignoring 'pt_guarded_by' attribute because its argument is invalid}} -int * pgb_var_arg_bad_3 __attribute__((pt_guarded_by(muDoublePointer))); // \ +int * pgb_var_arg_bad_3 PT_GUARDED_BY(muDoublePointer); // \ // expected-warning {{'pt_guarded_by' attribute requires arguments that are class type or point to class type}} -int * pgb_var_arg_bad_4 __attribute__((pt_guarded_by(umu))); // \ +int * pgb_var_arg_bad_4 PT_GUARDED_BY(umu); // \ // expected-warning {{'pt_guarded_by' attribute requires arguments whose type is annotated with 'lockable' attribute}} @@ -431,56 +431,56 @@ int * pgb_var_arg_bad_4 __attribute__((pt_guarded_by(umu))); // \ #error "Should support acquired_after attribute" #endif -Mu mu_aa __attribute__((acquired_after(mu1))); +Mutex mu_aa ACQUIRED_AFTER(mu1); -Mu aa_var_noargs __attribute__((acquired_after)); // \ +Mutex aa_var_noargs __attribute__((acquired_after)); // \ // expected-error {{attribute takes at least 1 argument}} class AAFoo { private: - Mu aa_field_noargs __attribute__((acquired_after)); // \ + Mutex aa_field_noargs __attribute__((acquired_after)); // \ // expected-error {{attribute takes at least 1 argument}} - Mu aa_field_args __attribute__((acquired_after(mu1))); + Mutex aa_field_args ACQUIRED_AFTER(mu1); }; -class __attribute__((acquired_after(mu1))) AA { // \ +class ACQUIRED_AFTER(mu1) AA { // \ // expected-warning {{'acquired_after' attribute only applies to fields and global variables}} }; -void aa_function() __attribute__((acquired_after(mu1))); // \ +void aa_function() ACQUIRED_AFTER(mu1); // \ // expected-warning {{'acquired_after' attribute only applies to fields and global variables}} -void aa_function_params(int gv_lvar __attribute__((acquired_after(mu1)))); // \ +void aa_function_params(int gv_lvar ACQUIRED_AFTER(mu1)); // \ // expected-warning {{'acquired_after' attribute only applies to fields and global variables}} void aa_testfn(int y){ - Mu x __attribute__((acquired_after(mu1))) = Mu(); // \ + Mutex x ACQUIRED_AFTER(mu1) = Mutex(); // \ // expected-warning {{'acquired_after' attribute only applies to fields and global variables}} } //Check argument parsing. // legal attribute arguments -Mu aa_var_arg_1 __attribute__((acquired_after(muWrapper.mu))); -Mu aa_var_arg_2 __attribute__((acquired_after(muDoubleWrapper.muWrapper->mu))); -Mu aa_var_arg_3 __attribute__((acquired_after(muWrapper.getMu()))); -Mu aa_var_arg_4 __attribute__((acquired_after(*muWrapper.getMuPointer()))); -Mu aa_var_arg_5 __attribute__((acquired_after(&mu1))); -Mu aa_var_arg_6 __attribute__((acquired_after(muRef))); -Mu aa_var_arg_7 __attribute__((acquired_after(muDoubleWrapper.getWrapper()->getMu()))); -Mu aa_var_arg_8 __attribute__((acquired_after(muPointer))); +Mutex aa_var_arg_1 ACQUIRED_AFTER(muWrapper.mu); +Mutex aa_var_arg_2 ACQUIRED_AFTER(muDoubleWrapper.muWrapper->mu); +Mutex aa_var_arg_3 ACQUIRED_AFTER(muWrapper.getMu()); +Mutex aa_var_arg_4 ACQUIRED_AFTER(*muWrapper.getMuPointer()); +Mutex aa_var_arg_5 ACQUIRED_AFTER(&mu1); +Mutex aa_var_arg_6 ACQUIRED_AFTER(muRef); +Mutex aa_var_arg_7 ACQUIRED_AFTER(muDoubleWrapper.getWrapper()->getMu()); +Mutex aa_var_arg_8 ACQUIRED_AFTER(muPointer); // illegal attribute arguments -Mu aa_var_arg_bad_1 __attribute__((acquired_after(1))); // \ +Mutex aa_var_arg_bad_1 ACQUIRED_AFTER(1); // \ // expected-warning {{'acquired_after' attribute requires arguments that are class type or point to class type}} -Mu aa_var_arg_bad_2 __attribute__((acquired_after("mu"))); // \ +Mutex aa_var_arg_bad_2 ACQUIRED_AFTER("mu"); // \ // expected-warning {{ignoring 'acquired_after' attribute because its argument is invalid}} -Mu aa_var_arg_bad_3 __attribute__((acquired_after(muDoublePointer))); // \ +Mutex aa_var_arg_bad_3 ACQUIRED_AFTER(muDoublePointer); // \ // expected-warning {{'acquired_after' attribute requires arguments that are class type or point to class type}} -Mu aa_var_arg_bad_4 __attribute__((acquired_after(umu))); // \ +Mutex aa_var_arg_bad_4 ACQUIRED_AFTER(umu); // \ // expected-warning {{'acquired_after' attribute requires arguments whose type is annotated with 'lockable' attribute}} -UnlockableMu aa_var_arg_bad_5 __attribute__((acquired_after(mu_aa))); // \ +UnlockableMu aa_var_arg_bad_5 ACQUIRED_AFTER(mu_aa); // \ // expected-warning {{'acquired_after' attribute can only be applied in a context annotated with 'lockable' attribute}} //-----------------------------------------// @@ -491,59 +491,59 @@ UnlockableMu aa_var_arg_bad_5 __attribute__((acquired_after(mu_aa))); // \ #error "Should support acquired_before attribute" #endif -Mu mu_ab __attribute__((acquired_before(mu1))); +Mutex mu_ab ACQUIRED_BEFORE(mu1); -Mu ab_var_noargs __attribute__((acquired_before)); // \ +Mutex ab_var_noargs __attribute__((acquired_before)); // \ // expected-error {{attribute takes at least 1 argument}} class ABFoo { private: - Mu ab_field_noargs __attribute__((acquired_before)); // \ + Mutex ab_field_noargs __attribute__((acquired_before)); // \ // expected-error {{attribute takes at least 1 argument}} - Mu ab_field_args __attribute__((acquired_before(mu1))); + Mutex ab_field_args ACQUIRED_BEFORE(mu1); }; -class __attribute__((acquired_before(mu1))) AB { // \ +class ACQUIRED_BEFORE(mu1) AB { // \ // expected-warning {{'acquired_before' attribute only applies to fields and global variables}} }; -void ab_function() __attribute__((acquired_before(mu1))); // \ +void ab_function() ACQUIRED_BEFORE(mu1); // \ // expected-warning {{'acquired_before' attribute only applies to fields and global variables}} -void ab_function_params(int gv_lvar __attribute__((acquired_before(mu1)))); // \ +void ab_function_params(int gv_lvar ACQUIRED_BEFORE(mu1)); // \ // expected-warning {{'acquired_before' attribute only applies to fields and global variables}} void ab_testfn(int y){ - Mu x __attribute__((acquired_before(mu1))) = Mu(); // \ + Mutex x ACQUIRED_BEFORE(mu1) = Mutex(); // \ // expected-warning {{'acquired_before' attribute only applies to fields and global variables}} } -// Note: illegal int ab_int __attribute__((acquired_before(mu1))) will +// Note: illegal int ab_int ACQUIRED_BEFORE(mu1) will // be taken care of by warnings that ab__int is not lockable. //Check argument parsing. // legal attribute arguments -Mu ab_var_arg_1 __attribute__((acquired_before(muWrapper.mu))); -Mu ab_var_arg_2 __attribute__((acquired_before(muDoubleWrapper.muWrapper->mu))); -Mu ab_var_arg_3 __attribute__((acquired_before(muWrapper.getMu()))); -Mu ab_var_arg_4 __attribute__((acquired_before(*muWrapper.getMuPointer()))); -Mu ab_var_arg_5 __attribute__((acquired_before(&mu1))); -Mu ab_var_arg_6 __attribute__((acquired_before(muRef))); -Mu ab_var_arg_7 __attribute__((acquired_before(muDoubleWrapper.getWrapper()->getMu()))); -Mu ab_var_arg_8 __attribute__((acquired_before(muPointer))); +Mutex ab_var_arg_1 ACQUIRED_BEFORE(muWrapper.mu); +Mutex ab_var_arg_2 ACQUIRED_BEFORE(muDoubleWrapper.muWrapper->mu); +Mutex ab_var_arg_3 ACQUIRED_BEFORE(muWrapper.getMu()); +Mutex ab_var_arg_4 ACQUIRED_BEFORE(*muWrapper.getMuPointer()); +Mutex ab_var_arg_5 ACQUIRED_BEFORE(&mu1); +Mutex ab_var_arg_6 ACQUIRED_BEFORE(muRef); +Mutex ab_var_arg_7 ACQUIRED_BEFORE(muDoubleWrapper.getWrapper()->getMu()); +Mutex ab_var_arg_8 ACQUIRED_BEFORE(muPointer); // illegal attribute arguments -Mu ab_var_arg_bad_1 __attribute__((acquired_before(1))); // \ +Mutex ab_var_arg_bad_1 ACQUIRED_BEFORE(1); // \ // expected-warning {{'acquired_before' attribute requires arguments that are class type or point to class type}} -Mu ab_var_arg_bad_2 __attribute__((acquired_before("mu"))); // \ +Mutex ab_var_arg_bad_2 ACQUIRED_BEFORE("mu"); // \ // expected-warning {{ignoring 'acquired_before' attribute because its argument is invalid}} -Mu ab_var_arg_bad_3 __attribute__((acquired_before(muDoublePointer))); // \ +Mutex ab_var_arg_bad_3 ACQUIRED_BEFORE(muDoublePointer); // \ // expected-warning {{'acquired_before' attribute requires arguments that are class type or point to class type}} -Mu ab_var_arg_bad_4 __attribute__((acquired_before(umu))); // \ +Mutex ab_var_arg_bad_4 ACQUIRED_BEFORE(umu); // \ // expected-warning {{'acquired_before' attribute requires arguments whose type is annotated with 'lockable' attribute}} -UnlockableMu ab_var_arg_bad_5 __attribute__((acquired_before(mu_ab))); // \ +UnlockableMu ab_var_arg_bad_5 ACQUIRED_BEFORE(mu_ab); // \ // expected-warning {{'acquired_before' attribute can only be applied in a context annotated with 'lockable' attribute}} @@ -557,65 +557,65 @@ UnlockableMu ab_var_arg_bad_5 __attribute__((acquired_before(mu_ab))); // \ // takes zero or more arguments, all locks (vars/fields) -void elf_function() __attribute__((exclusive_lock_function)); +void elf_function() EXCLUSIVE_LOCK_FUNCTION(); -void elf_function_args() __attribute__((exclusive_lock_function(mu1, mu2))); +void elf_function_args() EXCLUSIVE_LOCK_FUNCTION(mu1, mu2); -int elf_testfn(int y) __attribute__((exclusive_lock_function)); +int elf_testfn(int y) EXCLUSIVE_LOCK_FUNCTION(); int elf_testfn(int y) { - int x __attribute__((exclusive_lock_function)) = y; // \ + int x EXCLUSIVE_LOCK_FUNCTION() = y; // \ // expected-warning {{'exclusive_lock_function' attribute only applies to functions and methods}} return x; }; -int elf_test_var __attribute__((exclusive_lock_function)); // \ +int elf_test_var EXCLUSIVE_LOCK_FUNCTION(); // \ // expected-warning {{'exclusive_lock_function' attribute only applies to functions and methods}} class ElfFoo { private: - int test_field __attribute__((exclusive_lock_function)); // \ + int test_field EXCLUSIVE_LOCK_FUNCTION(); // \ // expected-warning {{'exclusive_lock_function' attribute only applies to functions and methods}} - void test_method() __attribute__((exclusive_lock_function)); + void test_method() EXCLUSIVE_LOCK_FUNCTION(); }; -class __attribute__((exclusive_lock_function)) ElfTestClass { // \ +class EXCLUSIVE_LOCK_FUNCTION() ElfTestClass { // \ // expected-warning {{'exclusive_lock_function' attribute only applies to functions and methods}} }; -void elf_fun_params(int lvar __attribute__((exclusive_lock_function))); // \ +void elf_fun_params(int lvar EXCLUSIVE_LOCK_FUNCTION()); // \ // expected-warning {{'exclusive_lock_function' attribute only applies to functions and methods}} // Check argument parsing. // legal attribute arguments -int elf_function_1() __attribute__((exclusive_lock_function(muWrapper.mu))); -int elf_function_2() __attribute__((exclusive_lock_function(muDoubleWrapper.muWrapper->mu))); -int elf_function_3() __attribute__((exclusive_lock_function(muWrapper.getMu()))); -int elf_function_4() __attribute__((exclusive_lock_function(*muWrapper.getMuPointer()))); -int elf_function_5() __attribute__((exclusive_lock_function(&mu1))); -int elf_function_6() __attribute__((exclusive_lock_function(muRef))); -int elf_function_7() __attribute__((exclusive_lock_function(muDoubleWrapper.getWrapper()->getMu()))); -int elf_function_8() __attribute__((exclusive_lock_function(muPointer))); -int elf_function_9(Mu x) __attribute__((exclusive_lock_function(1))); -int elf_function_9(Mu x, Mu y) __attribute__((exclusive_lock_function(1,2))); +int elf_function_1() EXCLUSIVE_LOCK_FUNCTION(muWrapper.mu); +int elf_function_2() EXCLUSIVE_LOCK_FUNCTION(muDoubleWrapper.muWrapper->mu); +int elf_function_3() EXCLUSIVE_LOCK_FUNCTION(muWrapper.getMu()); +int elf_function_4() EXCLUSIVE_LOCK_FUNCTION(*muWrapper.getMuPointer()); +int elf_function_5() EXCLUSIVE_LOCK_FUNCTION(&mu1); +int elf_function_6() EXCLUSIVE_LOCK_FUNCTION(muRef); +int elf_function_7() EXCLUSIVE_LOCK_FUNCTION(muDoubleWrapper.getWrapper()->getMu()); +int elf_function_8() EXCLUSIVE_LOCK_FUNCTION(muPointer); +int elf_function_9(Mutex x) EXCLUSIVE_LOCK_FUNCTION(1); +int elf_function_9(Mutex x, Mutex y) EXCLUSIVE_LOCK_FUNCTION(1,2); // illegal attribute arguments -int elf_function_bad_2() __attribute__((exclusive_lock_function("mu"))); // \ +int elf_function_bad_2() EXCLUSIVE_LOCK_FUNCTION("mu"); // \ // expected-warning {{ignoring 'exclusive_lock_function' attribute because its argument is invalid}} -int elf_function_bad_3() __attribute__((exclusive_lock_function(muDoublePointer))); // \ +int elf_function_bad_3() EXCLUSIVE_LOCK_FUNCTION(muDoublePointer); // \ // expected-warning {{'exclusive_lock_function' attribute requires arguments that are class type or point to class type}} -int elf_function_bad_4() __attribute__((exclusive_lock_function(umu))); // \ +int elf_function_bad_4() EXCLUSIVE_LOCK_FUNCTION(umu); // \ // expected-warning {{'exclusive_lock_function' attribute requires arguments whose type is annotated with 'lockable' attribute}} -int elf_function_bad_1() __attribute__((exclusive_lock_function(1))); // \ +int elf_function_bad_1() EXCLUSIVE_LOCK_FUNCTION(1); // \ // expected-error {{'exclusive_lock_function' attribute parameter 1 is out of bounds: no parameters to index into}} -int elf_function_bad_5(Mu x) __attribute__((exclusive_lock_function(0))); // \ +int elf_function_bad_5(Mutex x) EXCLUSIVE_LOCK_FUNCTION(0); // \ // expected-error {{'exclusive_lock_function' attribute parameter 1 is out of bounds: can only be 1, since there is one parameter}} -int elf_function_bad_6(Mu x, Mu y) __attribute__((exclusive_lock_function(0))); // \ +int elf_function_bad_6(Mutex x, Mutex y) EXCLUSIVE_LOCK_FUNCTION(0); // \ // expected-error {{'exclusive_lock_function' attribute parameter 1 is out of bounds: must be between 1 and 2}} -int elf_function_bad_7() __attribute__((exclusive_lock_function(0))); // \ +int elf_function_bad_7() EXCLUSIVE_LOCK_FUNCTION(0); // \ // expected-error {{'exclusive_lock_function' attribute parameter 1 is out of bounds: no parameters to index into}} @@ -629,65 +629,65 @@ int elf_function_bad_7() __attribute__((exclusive_lock_function(0))); // \ // takes zero or more arguments, all locks (vars/fields) -void slf_function() __attribute__((shared_lock_function)); +void slf_function() SHARED_LOCK_FUNCTION(); -void slf_function_args() __attribute__((shared_lock_function(mu1, mu2))); +void slf_function_args() SHARED_LOCK_FUNCTION(mu1, mu2); -int slf_testfn(int y) __attribute__((shared_lock_function)); +int slf_testfn(int y) SHARED_LOCK_FUNCTION(); int slf_testfn(int y) { - int x __attribute__((shared_lock_function)) = y; // \ + int x SHARED_LOCK_FUNCTION() = y; // \ // expected-warning {{'shared_lock_function' attribute only applies to functions and methods}} return x; }; -int slf_test_var __attribute__((shared_lock_function)); // \ +int slf_test_var SHARED_LOCK_FUNCTION(); // \ // expected-warning {{'shared_lock_function' attribute only applies to functions and methods}} -void slf_fun_params(int lvar __attribute__((shared_lock_function))); // \ +void slf_fun_params(int lvar SHARED_LOCK_FUNCTION()); // \ // expected-warning {{'shared_lock_function' attribute only applies to functions and methods}} class SlfFoo { private: - int test_field __attribute__((shared_lock_function)); // \ + int test_field SHARED_LOCK_FUNCTION(); // \ // expected-warning {{'shared_lock_function' attribute only applies to functions and methods}} - void test_method() __attribute__((shared_lock_function)); + void test_method() SHARED_LOCK_FUNCTION(); }; -class __attribute__((shared_lock_function)) SlfTestClass { // \ +class SHARED_LOCK_FUNCTION() SlfTestClass { // \ // expected-warning {{'shared_lock_function' attribute only applies to functions and methods}} }; // Check argument parsing. // legal attribute arguments -int slf_function_1() __attribute__((shared_lock_function(muWrapper.mu))); -int slf_function_2() __attribute__((shared_lock_function(muDoubleWrapper.muWrapper->mu))); -int slf_function_3() __attribute__((shared_lock_function(muWrapper.getMu()))); -int slf_function_4() __attribute__((shared_lock_function(*muWrapper.getMuPointer()))); -int slf_function_5() __attribute__((shared_lock_function(&mu1))); -int slf_function_6() __attribute__((shared_lock_function(muRef))); -int slf_function_7() __attribute__((shared_lock_function(muDoubleWrapper.getWrapper()->getMu()))); -int slf_function_8() __attribute__((shared_lock_function(muPointer))); -int slf_function_9(Mu x) __attribute__((shared_lock_function(1))); -int slf_function_9(Mu x, Mu y) __attribute__((shared_lock_function(1,2))); +int slf_function_1() SHARED_LOCK_FUNCTION(muWrapper.mu); +int slf_function_2() SHARED_LOCK_FUNCTION(muDoubleWrapper.muWrapper->mu); +int slf_function_3() SHARED_LOCK_FUNCTION(muWrapper.getMu()); +int slf_function_4() SHARED_LOCK_FUNCTION(*muWrapper.getMuPointer()); +int slf_function_5() SHARED_LOCK_FUNCTION(&mu1); +int slf_function_6() SHARED_LOCK_FUNCTION(muRef); +int slf_function_7() SHARED_LOCK_FUNCTION(muDoubleWrapper.getWrapper()->getMu()); +int slf_function_8() SHARED_LOCK_FUNCTION(muPointer); +int slf_function_9(Mutex x) SHARED_LOCK_FUNCTION(1); +int slf_function_9(Mutex x, Mutex y) SHARED_LOCK_FUNCTION(1,2); // illegal attribute arguments -int slf_function_bad_2() __attribute__((shared_lock_function("mu"))); // \ +int slf_function_bad_2() SHARED_LOCK_FUNCTION("mu"); // \ // expected-warning {{ignoring 'shared_lock_function' attribute because its argument is invalid}} -int slf_function_bad_3() __attribute__((shared_lock_function(muDoublePointer))); // \ +int slf_function_bad_3() SHARED_LOCK_FUNCTION(muDoublePointer); // \ // expected-warning {{'shared_lock_function' attribute requires arguments that are class type or point to class type}} -int slf_function_bad_4() __attribute__((shared_lock_function(umu))); // \ +int slf_function_bad_4() SHARED_LOCK_FUNCTION(umu); // \ // expected-warning {{'shared_lock_function' attribute requires arguments whose type is annotated with 'lockable' attribute}} -int slf_function_bad_1() __attribute__((shared_lock_function(1))); // \ +int slf_function_bad_1() SHARED_LOCK_FUNCTION(1); // \ // expected-error {{'shared_lock_function' attribute parameter 1 is out of bounds: no parameters to index into}} -int slf_function_bad_5(Mu x) __attribute__((shared_lock_function(0))); // \ +int slf_function_bad_5(Mutex x) SHARED_LOCK_FUNCTION(0); // \ // expected-error {{'shared_lock_function' attribute parameter 1 is out of bounds: can only be 1, since there is one parameter}} -int slf_function_bad_6(Mu x, Mu y) __attribute__((shared_lock_function(0))); // \ +int slf_function_bad_6(Mutex x, Mutex y) SHARED_LOCK_FUNCTION(0); // \ // expected-error {{'shared_lock_function' attribute parameter 1 is out of bounds: must be between 1 and 2}} -int slf_function_bad_7() __attribute__((shared_lock_function(0))); // \ +int slf_function_bad_7() SHARED_LOCK_FUNCTION(0); // \ // expected-error {{'shared_lock_function' attribute parameter 1 is out of bounds: no parameters to index into}} @@ -705,62 +705,62 @@ int slf_function_bad_7() __attribute__((shared_lock_function(0))); // \ void etf_function() __attribute__((exclusive_trylock_function)); // \ // expected-error {{attribute takes at least 1 argument}} -void etf_function_args() __attribute__((exclusive_trylock_function(1, mu2))); +void etf_function_args() EXCLUSIVE_TRYLOCK_FUNCTION(1, mu2); -void etf_function_arg() __attribute__((exclusive_trylock_function(1))); +void etf_function_arg() EXCLUSIVE_TRYLOCK_FUNCTION(1); -int etf_testfn(int y) __attribute__((exclusive_trylock_function(1))); +int etf_testfn(int y) EXCLUSIVE_TRYLOCK_FUNCTION(1); int etf_testfn(int y) { - int x __attribute__((exclusive_trylock_function(1))) = y; // \ + int x EXCLUSIVE_TRYLOCK_FUNCTION(1) = y; // \ // expected-warning {{'exclusive_trylock_function' attribute only applies to functions and methods}} return x; }; -int etf_test_var __attribute__((exclusive_trylock_function(1))); // \ +int etf_test_var EXCLUSIVE_TRYLOCK_FUNCTION(1); // \ // expected-warning {{'exclusive_trylock_function' attribute only applies to functions and methods}} class EtfFoo { private: - int test_field __attribute__((exclusive_trylock_function(1))); // \ + int test_field EXCLUSIVE_TRYLOCK_FUNCTION(1); // \ // expected-warning {{'exclusive_trylock_function' attribute only applies to functions and methods}} - void test_method() __attribute__((exclusive_trylock_function(1))); + void test_method() EXCLUSIVE_TRYLOCK_FUNCTION(1); }; -class __attribute__((exclusive_trylock_function(1))) EtfTestClass { // \ +class EXCLUSIVE_TRYLOCK_FUNCTION(1) EtfTestClass { // \ // expected-warning {{'exclusive_trylock_function' attribute only applies to functions and methods}} }; -void etf_fun_params(int lvar __attribute__((exclusive_trylock_function(1)))); // \ +void etf_fun_params(int lvar EXCLUSIVE_TRYLOCK_FUNCTION(1)); // \ // expected-warning {{'exclusive_trylock_function' attribute only applies to functions and methods}} // Check argument parsing. // legal attribute arguments -int etf_function_1() __attribute__((exclusive_trylock_function(1, muWrapper.mu))); -int etf_function_2() __attribute__((exclusive_trylock_function(1, muDoubleWrapper.muWrapper->mu))); -int etf_function_3() __attribute__((exclusive_trylock_function(1, muWrapper.getMu()))); -int etf_function_4() __attribute__((exclusive_trylock_function(1, *muWrapper.getMuPointer()))); -int etf_function_5() __attribute__((exclusive_trylock_function(1, &mu1))); -int etf_function_6() __attribute__((exclusive_trylock_function(1, muRef))); -int etf_function_7() __attribute__((exclusive_trylock_function(1, muDoubleWrapper.getWrapper()->getMu()))); -int etf_functetfn_8() __attribute__((exclusive_trylock_function(1, muPointer))); -int etf_function_9() __attribute__((exclusive_trylock_function(true))); +int etf_function_1() EXCLUSIVE_TRYLOCK_FUNCTION(1, muWrapper.mu); +int etf_function_2() EXCLUSIVE_TRYLOCK_FUNCTION(1, muDoubleWrapper.muWrapper->mu); +int etf_function_3() EXCLUSIVE_TRYLOCK_FUNCTION(1, muWrapper.getMu()); +int etf_function_4() EXCLUSIVE_TRYLOCK_FUNCTION(1, *muWrapper.getMuPointer()); +int etf_function_5() EXCLUSIVE_TRYLOCK_FUNCTION(1, &mu1); +int etf_function_6() EXCLUSIVE_TRYLOCK_FUNCTION(1, muRef); +int etf_function_7() EXCLUSIVE_TRYLOCK_FUNCTION(1, muDoubleWrapper.getWrapper()->getMu()); +int etf_functetfn_8() EXCLUSIVE_TRYLOCK_FUNCTION(1, muPointer); +int etf_function_9() EXCLUSIVE_TRYLOCK_FUNCTION(true); // illegal attribute arguments -int etf_function_bad_1() __attribute__((exclusive_trylock_function(mu1))); // \ +int etf_function_bad_1() EXCLUSIVE_TRYLOCK_FUNCTION(mu1); // \ // expected-error {{'exclusive_trylock_function' attribute first argument must be of int or bool type}} -int etf_function_bad_2() __attribute__((exclusive_trylock_function("mu"))); // \ +int etf_function_bad_2() EXCLUSIVE_TRYLOCK_FUNCTION("mu"); // \ // expected-error {{'exclusive_trylock_function' attribute first argument must be of int or bool type}} -int etf_function_bad_3() __attribute__((exclusive_trylock_function(muDoublePointer))); // \ +int etf_function_bad_3() EXCLUSIVE_TRYLOCK_FUNCTION(muDoublePointer); // \ // expected-error {{'exclusive_trylock_function' attribute first argument must be of int or bool type}} -int etf_function_bad_4() __attribute__((exclusive_trylock_function(1, "mu"))); // \ +int etf_function_bad_4() EXCLUSIVE_TRYLOCK_FUNCTION(1, "mu"); // \ // expected-warning {{ignoring 'exclusive_trylock_function' attribute because its argument is invalid}} -int etf_function_bad_5() __attribute__((exclusive_trylock_function(1, muDoublePointer))); // \ +int etf_function_bad_5() EXCLUSIVE_TRYLOCK_FUNCTION(1, muDoublePointer); // \ // expected-warning {{'exclusive_trylock_function' attribute requires arguments that are class type or point to class type}} -int etf_function_bad_6() __attribute__((exclusive_trylock_function(1, umu))); // \ +int etf_function_bad_6() EXCLUSIVE_TRYLOCK_FUNCTION(1, umu); // \ // expected-warning {{'exclusive_trylock_function' attribute requires arguments whose type is annotated with 'lockable' attribute}} @@ -778,63 +778,63 @@ int etf_function_bad_6() __attribute__((exclusive_trylock_function(1, umu))); // void stf_function() __attribute__((shared_trylock_function)); // \ // expected-error {{attribute takes at least 1 argument}} -void stf_function_args() __attribute__((shared_trylock_function(1, mu2))); +void stf_function_args() SHARED_TRYLOCK_FUNCTION(1, mu2); -void stf_function_arg() __attribute__((shared_trylock_function(1))); +void stf_function_arg() SHARED_TRYLOCK_FUNCTION(1); -int stf_testfn(int y) __attribute__((shared_trylock_function(1))); +int stf_testfn(int y) SHARED_TRYLOCK_FUNCTION(1); int stf_testfn(int y) { - int x __attribute__((shared_trylock_function(1))) = y; // \ + int x SHARED_TRYLOCK_FUNCTION(1) = y; // \ // expected-warning {{'shared_trylock_function' attribute only applies to functions and methods}} return x; }; -int stf_test_var __attribute__((shared_trylock_function(1))); // \ +int stf_test_var SHARED_TRYLOCK_FUNCTION(1); // \ // expected-warning {{'shared_trylock_function' attribute only applies to functions and methods}} -void stf_fun_params(int lvar __attribute__((shared_trylock_function(1)))); // \ +void stf_fun_params(int lvar SHARED_TRYLOCK_FUNCTION(1)); // \ // expected-warning {{'shared_trylock_function' attribute only applies to functions and methods}} class StfFoo { private: - int test_field __attribute__((shared_trylock_function(1))); // \ + int test_field SHARED_TRYLOCK_FUNCTION(1); // \ // expected-warning {{'shared_trylock_function' attribute only applies to functions and methods}} - void test_method() __attribute__((shared_trylock_function(1))); + void test_method() SHARED_TRYLOCK_FUNCTION(1); }; -class __attribute__((shared_trylock_function(1))) StfTestClass { // \ +class SHARED_TRYLOCK_FUNCTION(1) StfTestClass { // \ // expected-warning {{'shared_trylock_function' attribute only applies to functions and methods}} }; // Check argument parsing. // legal attribute arguments -int stf_function_1() __attribute__((shared_trylock_function(1, muWrapper.mu))); -int stf_function_2() __attribute__((shared_trylock_function(1, muDoubleWrapper.muWrapper->mu))); -int stf_function_3() __attribute__((shared_trylock_function(1, muWrapper.getMu()))); -int stf_function_4() __attribute__((shared_trylock_function(1, *muWrapper.getMuPointer()))); -int stf_function_5() __attribute__((shared_trylock_function(1, &mu1))); -int stf_function_6() __attribute__((shared_trylock_function(1, muRef))); -int stf_function_7() __attribute__((shared_trylock_function(1, muDoubleWrapper.getWrapper()->getMu()))); -int stf_function_8() __attribute__((shared_trylock_function(1, muPointer))); -int stf_function_9() __attribute__((shared_trylock_function(true))); +int stf_function_1() SHARED_TRYLOCK_FUNCTION(1, muWrapper.mu); +int stf_function_2() SHARED_TRYLOCK_FUNCTION(1, muDoubleWrapper.muWrapper->mu); +int stf_function_3() SHARED_TRYLOCK_FUNCTION(1, muWrapper.getMu()); +int stf_function_4() SHARED_TRYLOCK_FUNCTION(1, *muWrapper.getMuPointer()); +int stf_function_5() SHARED_TRYLOCK_FUNCTION(1, &mu1); +int stf_function_6() SHARED_TRYLOCK_FUNCTION(1, muRef); +int stf_function_7() SHARED_TRYLOCK_FUNCTION(1, muDoubleWrapper.getWrapper()->getMu()); +int stf_function_8() SHARED_TRYLOCK_FUNCTION(1, muPointer); +int stf_function_9() SHARED_TRYLOCK_FUNCTION(true); // illegal attribute arguments -int stf_function_bad_1() __attribute__((shared_trylock_function(mu1))); // \ +int stf_function_bad_1() SHARED_TRYLOCK_FUNCTION(mu1); // \ // expected-error {{'shared_trylock_function' attribute first argument must be of int or bool type}} -int stf_function_bad_2() __attribute__((shared_trylock_function("mu"))); // \ +int stf_function_bad_2() SHARED_TRYLOCK_FUNCTION("mu"); // \ // expected-error {{'shared_trylock_function' attribute first argument must be of int or bool type}} -int stf_function_bad_3() __attribute__((shared_trylock_function(muDoublePointer))); // \ +int stf_function_bad_3() SHARED_TRYLOCK_FUNCTION(muDoublePointer); // \ // expected-error {{'shared_trylock_function' attribute first argument must be of int or bool type}} -int stf_function_bad_4() __attribute__((shared_trylock_function(1, "mu"))); // \ +int stf_function_bad_4() SHARED_TRYLOCK_FUNCTION(1, "mu"); // \ // expected-warning {{ignoring 'shared_trylock_function' attribute because its argument is invalid}} -int stf_function_bad_5() __attribute__((shared_trylock_function(1, muDoublePointer))); // \ +int stf_function_bad_5() SHARED_TRYLOCK_FUNCTION(1, muDoublePointer); // \ // expected-warning {{'shared_trylock_function' attribute requires arguments that are class type or point to class type}} -int stf_function_bad_6() __attribute__((shared_trylock_function(1, umu))); // \ +int stf_function_bad_6() SHARED_TRYLOCK_FUNCTION(1, umu); // \ // expected-warning {{'shared_trylock_function' attribute requires arguments whose type is annotated with 'lockable' attribute}} @@ -848,65 +848,65 @@ int stf_function_bad_6() __attribute__((shared_trylock_function(1, umu))); // \ // takes zero or more arguments, all locks (vars/fields) -void uf_function() __attribute__((unlock_function)); +void uf_function() UNLOCK_FUNCTION(); -void uf_function_args() __attribute__((unlock_function(mu1, mu2))); +void uf_function_args() UNLOCK_FUNCTION(mu1, mu2); -int uf_testfn(int y) __attribute__((unlock_function)); +int uf_testfn(int y) UNLOCK_FUNCTION(); int uf_testfn(int y) { - int x __attribute__((unlock_function)) = y; // \ + int x UNLOCK_FUNCTION() = y; // \ // expected-warning {{'unlock_function' attribute only applies to functions and methods}} return x; }; -int uf_test_var __attribute__((unlock_function)); // \ +int uf_test_var UNLOCK_FUNCTION(); // \ // expected-warning {{'unlock_function' attribute only applies to functions and methods}} class UfFoo { private: - int test_field __attribute__((unlock_function)); // \ + int test_field UNLOCK_FUNCTION(); // \ // expected-warning {{'unlock_function' attribute only applies to functions and methods}} - void test_method() __attribute__((unlock_function)); + void test_method() UNLOCK_FUNCTION(); }; -class __attribute__((no_thread_safety_analysis)) UfTestClass { // \ +class NO_THREAD_SAFETY_ANALYSIS UfTestClass { // \ // expected-warning {{'no_thread_safety_analysis' attribute only applies to functions and methods}} }; -void uf_fun_params(int lvar __attribute__((unlock_function))); // \ +void uf_fun_params(int lvar UNLOCK_FUNCTION()); // \ // expected-warning {{'unlock_function' attribute only applies to functions and methods}} // Check argument parsing. // legal attribute arguments -int uf_function_1() __attribute__((unlock_function(muWrapper.mu))); -int uf_function_2() __attribute__((unlock_function(muDoubleWrapper.muWrapper->mu))); -int uf_function_3() __attribute__((unlock_function(muWrapper.getMu()))); -int uf_function_4() __attribute__((unlock_function(*muWrapper.getMuPointer()))); -int uf_function_5() __attribute__((unlock_function(&mu1))); -int uf_function_6() __attribute__((unlock_function(muRef))); -int uf_function_7() __attribute__((unlock_function(muDoubleWrapper.getWrapper()->getMu()))); -int uf_function_8() __attribute__((unlock_function(muPointer))); -int uf_function_9(Mu x) __attribute__((unlock_function(1))); -int uf_function_9(Mu x, Mu y) __attribute__((unlock_function(1,2))); +int uf_function_1() UNLOCK_FUNCTION(muWrapper.mu); +int uf_function_2() UNLOCK_FUNCTION(muDoubleWrapper.muWrapper->mu); +int uf_function_3() UNLOCK_FUNCTION(muWrapper.getMu()); +int uf_function_4() UNLOCK_FUNCTION(*muWrapper.getMuPointer()); +int uf_function_5() UNLOCK_FUNCTION(&mu1); +int uf_function_6() UNLOCK_FUNCTION(muRef); +int uf_function_7() UNLOCK_FUNCTION(muDoubleWrapper.getWrapper()->getMu()); +int uf_function_8() UNLOCK_FUNCTION(muPointer); +int uf_function_9(Mutex x) UNLOCK_FUNCTION(1); +int uf_function_9(Mutex x, Mutex y) UNLOCK_FUNCTION(1,2); // illegal attribute arguments -int uf_function_bad_2() __attribute__((unlock_function("mu"))); // \ +int uf_function_bad_2() UNLOCK_FUNCTION("mu"); // \ // expected-warning {{ignoring 'unlock_function' attribute because its argument is invalid}} -int uf_function_bad_3() __attribute__((unlock_function(muDoublePointer))); // \ +int uf_function_bad_3() UNLOCK_FUNCTION(muDoublePointer); // \ // expected-warning {{'unlock_function' attribute requires arguments that are class type or point to class type}} -int uf_function_bad_4() __attribute__((unlock_function(umu))); // \ +int uf_function_bad_4() UNLOCK_FUNCTION(umu); // \ // expected-warning {{'unlock_function' attribute requires arguments whose type is annotated with 'lockable' attribute}} -int uf_function_bad_1() __attribute__((unlock_function(1))); // \ +int uf_function_bad_1() UNLOCK_FUNCTION(1); // \ // expected-error {{'unlock_function' attribute parameter 1 is out of bounds: no parameters to index into}} -int uf_function_bad_5(Mu x) __attribute__((unlock_function(0))); // \ +int uf_function_bad_5(Mutex x) UNLOCK_FUNCTION(0); // \ // expected-error {{'unlock_function' attribute parameter 1 is out of bounds: can only be 1, since there is one parameter}} -int uf_function_bad_6(Mu x, Mu y) __attribute__((unlock_function(0))); // \ +int uf_function_bad_6(Mutex x, Mutex y) UNLOCK_FUNCTION(0); // \ // expected-error {{'unlock_function' attribute parameter 1 is out of bounds: must be between 1 and 2}} -int uf_function_bad_7() __attribute__((unlock_function(0))); // \ +int uf_function_bad_7() UNLOCK_FUNCTION(0); // \ // expected-error {{'unlock_function' attribute parameter 1 is out of bounds: no parameters to index into}} @@ -923,57 +923,57 @@ int uf_function_bad_7() __attribute__((unlock_function(0))); // \ void lr_function() __attribute__((lock_returned)); // \ // expected-error {{attribute takes one argument}} -void lr_function_arg() __attribute__((lock_returned(mu1))); +void lr_function_arg() LOCK_RETURNED(mu1); void lr_function_args() __attribute__((lock_returned(mu1, mu2))); // \ // expected-error {{attribute takes one argument}} -int lr_testfn(int y) __attribute__((lock_returned(mu1))); +int lr_testfn(int y) LOCK_RETURNED(mu1); int lr_testfn(int y) { - int x __attribute__((lock_returned(mu1))) = y; // \ + int x LOCK_RETURNED(mu1) = y; // \ // expected-warning {{'lock_returned' attribute only applies to functions and methods}} return x; }; -int lr_test_var __attribute__((lock_returned(mu1))); // \ +int lr_test_var LOCK_RETURNED(mu1); // \ // expected-warning {{'lock_returned' attribute only applies to functions and methods}} -void lr_fun_params(int lvar __attribute__((lock_returned(mu1)))); // \ +void lr_fun_params(int lvar LOCK_RETURNED(mu1)); // \ // expected-warning {{'lock_returned' attribute only applies to functions and methods}} class LrFoo { private: - int test_field __attribute__((lock_returned(mu1))); // \ + int test_field LOCK_RETURNED(mu1); // \ // expected-warning {{'lock_returned' attribute only applies to functions and methods}} - void test_method() __attribute__((lock_returned(mu1))); + void test_method() LOCK_RETURNED(mu1); }; -class __attribute__((lock_returned(mu1))) LrTestClass { // \ +class LOCK_RETURNED(mu1) LrTestClass { // \ // expected-warning {{'lock_returned' attribute only applies to functions and methods}} }; // Check argument parsing. // legal attribute arguments -int lr_function_1() __attribute__((lock_returned(muWrapper.mu))); -int lr_function_2() __attribute__((lock_returned(muDoubleWrapper.muWrapper->mu))); -int lr_function_3() __attribute__((lock_returned(muWrapper.getMu()))); -int lr_function_4() __attribute__((lock_returned(*muWrapper.getMuPointer()))); -int lr_function_5() __attribute__((lock_returned(&mu1))); -int lr_function_6() __attribute__((lock_returned(muRef))); -int lr_function_7() __attribute__((lock_returned(muDoubleWrapper.getWrapper()->getMu()))); -int lr_function_8() __attribute__((lock_returned(muPointer))); +int lr_function_1() LOCK_RETURNED(muWrapper.mu); +int lr_function_2() LOCK_RETURNED(muDoubleWrapper.muWrapper->mu); +int lr_function_3() LOCK_RETURNED(muWrapper.getMu()); +int lr_function_4() LOCK_RETURNED(*muWrapper.getMuPointer()); +int lr_function_5() LOCK_RETURNED(&mu1); +int lr_function_6() LOCK_RETURNED(muRef); +int lr_function_7() LOCK_RETURNED(muDoubleWrapper.getWrapper()->getMu()); +int lr_function_8() LOCK_RETURNED(muPointer); // illegal attribute arguments -int lr_function_bad_1() __attribute__((lock_returned(1))); // \ +int lr_function_bad_1() LOCK_RETURNED(1); // \ // expected-warning {{'lock_returned' attribute requires arguments that are class type or point to class type}} -int lr_function_bad_2() __attribute__((lock_returned("mu"))); // \ +int lr_function_bad_2() LOCK_RETURNED("mu"); // \ // expected-warning {{'lock_returned' attribute requires arguments that are class type or point to class type}} -int lr_function_bad_3() __attribute__((lock_returned(muDoublePointer))); // \ +int lr_function_bad_3() LOCK_RETURNED(muDoublePointer); // \ // expected-warning {{'lock_returned' attribute requires arguments that are class type or point to class type}} -int lr_function_bad_4() __attribute__((lock_returned(umu))); // \ +int lr_function_bad_4() LOCK_RETURNED(umu); // \ // expected-warning {{'lock_returned' attribute requires arguments whose type is annotated with 'lockable' attribute}} @@ -991,56 +991,56 @@ int lr_function_bad_4() __attribute__((lock_returned(umu))); // \ void le_function() __attribute__((locks_excluded)); // \ // expected-error {{attribute takes at least 1 argument}} -void le_function_arg() __attribute__((locks_excluded(mu1))); +void le_function_arg() LOCKS_EXCLUDED(mu1); -void le_function_args() __attribute__((locks_excluded(mu1, mu2))); +void le_function_args() LOCKS_EXCLUDED(mu1, mu2); -int le_testfn(int y) __attribute__((locks_excluded(mu1))); +int le_testfn(int y) LOCKS_EXCLUDED(mu1); int le_testfn(int y) { - int x __attribute__((locks_excluded(mu1))) = y; // \ + int x LOCKS_EXCLUDED(mu1) = y; // \ // expected-warning {{'locks_excluded' attribute only applies to functions and methods}} return x; }; -int le_test_var __attribute__((locks_excluded(mu1))); // \ +int le_test_var LOCKS_EXCLUDED(mu1); // \ // expected-warning {{'locks_excluded' attribute only applies to functions and methods}} -void le_fun_params(int lvar __attribute__((locks_excluded(mu1)))); // \ +void le_fun_params(int lvar LOCKS_EXCLUDED(mu1)); // \ // expected-warning {{'locks_excluded' attribute only applies to functions and methods}} class LeFoo { private: - int test_field __attribute__((locks_excluded(mu1))); // \ + int test_field LOCKS_EXCLUDED(mu1); // \ // expected-warning {{'locks_excluded' attribute only applies to functions and methods}} - void test_method() __attribute__((locks_excluded(mu1))); + void test_method() LOCKS_EXCLUDED(mu1); }; -class __attribute__((locks_excluded(mu1))) LeTestClass { // \ +class LOCKS_EXCLUDED(mu1) LeTestClass { // \ // expected-warning {{'locks_excluded' attribute only applies to functions and methods}} }; // Check argument parsing. // legal attribute arguments -int le_function_1() __attribute__((locks_excluded(muWrapper.mu))); -int le_function_2() __attribute__((locks_excluded(muDoubleWrapper.muWrapper->mu))); -int le_function_3() __attribute__((locks_excluded(muWrapper.getMu()))); -int le_function_4() __attribute__((locks_excluded(*muWrapper.getMuPointer()))); -int le_function_5() __attribute__((locks_excluded(&mu1))); -int le_function_6() __attribute__((locks_excluded(muRef))); -int le_function_7() __attribute__((locks_excluded(muDoubleWrapper.getWrapper()->getMu()))); -int le_function_8() __attribute__((locks_excluded(muPointer))); +int le_function_1() LOCKS_EXCLUDED(muWrapper.mu); +int le_function_2() LOCKS_EXCLUDED(muDoubleWrapper.muWrapper->mu); +int le_function_3() LOCKS_EXCLUDED(muWrapper.getMu()); +int le_function_4() LOCKS_EXCLUDED(*muWrapper.getMuPointer()); +int le_function_5() LOCKS_EXCLUDED(&mu1); +int le_function_6() LOCKS_EXCLUDED(muRef); +int le_function_7() LOCKS_EXCLUDED(muDoubleWrapper.getWrapper()->getMu()); +int le_function_8() LOCKS_EXCLUDED(muPointer); // illegal attribute arguments -int le_function_bad_1() __attribute__((locks_excluded(1))); // \ +int le_function_bad_1() LOCKS_EXCLUDED(1); // \ // expected-warning {{'locks_excluded' attribute requires arguments that are class type or point to class type}} -int le_function_bad_2() __attribute__((locks_excluded("mu"))); // \ +int le_function_bad_2() LOCKS_EXCLUDED("mu"); // \ // expected-warning {{ignoring 'locks_excluded' attribute because its argument is invalid}} -int le_function_bad_3() __attribute__((locks_excluded(muDoublePointer))); // \ +int le_function_bad_3() LOCKS_EXCLUDED(muDoublePointer); // \ // expected-warning {{'locks_excluded' attribute requires arguments that are class type or point to class type}} -int le_function_bad_4() __attribute__((locks_excluded(umu))); // \ +int le_function_bad_4() LOCKS_EXCLUDED(umu); // \ // expected-warning {{'locks_excluded' attribute requires arguments whose type is annotated with 'lockable' attribute}} @@ -1058,56 +1058,56 @@ int le_function_bad_4() __attribute__((locks_excluded(umu))); // \ void elr_function() __attribute__((exclusive_locks_required)); // \ // expected-error {{attribute takes at least 1 argument}} -void elr_function_arg() __attribute__((exclusive_locks_required(mu1))); +void elr_function_arg() EXCLUSIVE_LOCKS_REQUIRED(mu1); -void elr_function_args() __attribute__((exclusive_locks_required(mu1, mu2))); +void elr_function_args() EXCLUSIVE_LOCKS_REQUIRED(mu1, mu2); -int elr_testfn(int y) __attribute__((exclusive_locks_required(mu1))); +int elr_testfn(int y) EXCLUSIVE_LOCKS_REQUIRED(mu1); int elr_testfn(int y) { - int x __attribute__((exclusive_locks_required(mu1))) = y; // \ + int x EXCLUSIVE_LOCKS_REQUIRED(mu1) = y; // \ // expected-warning {{'exclusive_locks_required' attribute only applies to functions and methods}} return x; }; -int elr_test_var __attribute__((exclusive_locks_required(mu1))); // \ +int elr_test_var EXCLUSIVE_LOCKS_REQUIRED(mu1); // \ // expected-warning {{'exclusive_locks_required' attribute only applies to functions and methods}} -void elr_fun_params(int lvar __attribute__((exclusive_locks_required(mu1)))); // \ +void elr_fun_params(int lvar EXCLUSIVE_LOCKS_REQUIRED(mu1)); // \ // expected-warning {{'exclusive_locks_required' attribute only applies to functions and methods}} class ElrFoo { private: - int test_field __attribute__((exclusive_locks_required(mu1))); // \ + int test_field EXCLUSIVE_LOCKS_REQUIRED(mu1); // \ // expected-warning {{'exclusive_locks_required' attribute only applies to functions and methods}} - void test_method() __attribute__((exclusive_locks_required(mu1))); + void test_method() EXCLUSIVE_LOCKS_REQUIRED(mu1); }; -class __attribute__((exclusive_locks_required(mu1))) ElrTestClass { // \ +class EXCLUSIVE_LOCKS_REQUIRED(mu1) ElrTestClass { // \ // expected-warning {{'exclusive_locks_required' attribute only applies to functions and methods}} }; // Check argument parsing. // legal attribute arguments -int elr_function_1() __attribute__((exclusive_locks_required(muWrapper.mu))); -int elr_function_2() __attribute__((exclusive_locks_required(muDoubleWrapper.muWrapper->mu))); -int elr_function_3() __attribute__((exclusive_locks_required(muWrapper.getMu()))); -int elr_function_4() __attribute__((exclusive_locks_required(*muWrapper.getMuPointer()))); -int elr_function_5() __attribute__((exclusive_locks_required(&mu1))); -int elr_function_6() __attribute__((exclusive_locks_required(muRef))); -int elr_function_7() __attribute__((exclusive_locks_required(muDoubleWrapper.getWrapper()->getMu()))); -int elr_function_8() __attribute__((exclusive_locks_required(muPointer))); +int elr_function_1() EXCLUSIVE_LOCKS_REQUIRED(muWrapper.mu); +int elr_function_2() EXCLUSIVE_LOCKS_REQUIRED(muDoubleWrapper.muWrapper->mu); +int elr_function_3() EXCLUSIVE_LOCKS_REQUIRED(muWrapper.getMu()); +int elr_function_4() EXCLUSIVE_LOCKS_REQUIRED(*muWrapper.getMuPointer()); +int elr_function_5() EXCLUSIVE_LOCKS_REQUIRED(&mu1); +int elr_function_6() EXCLUSIVE_LOCKS_REQUIRED(muRef); +int elr_function_7() EXCLUSIVE_LOCKS_REQUIRED(muDoubleWrapper.getWrapper()->getMu()); +int elr_function_8() EXCLUSIVE_LOCKS_REQUIRED(muPointer); // illegal attribute arguments -int elr_function_bad_1() __attribute__((exclusive_locks_required(1))); // \ +int elr_function_bad_1() EXCLUSIVE_LOCKS_REQUIRED(1); // \ // expected-warning {{'exclusive_locks_required' attribute requires arguments that are class type or point to class type}} -int elr_function_bad_2() __attribute__((exclusive_locks_required("mu"))); // \ +int elr_function_bad_2() EXCLUSIVE_LOCKS_REQUIRED("mu"); // \ // expected-warning {{ignoring 'exclusive_locks_required' attribute because its argument is invalid}} -int elr_function_bad_3() __attribute__((exclusive_locks_required(muDoublePointer))); // \ +int elr_function_bad_3() EXCLUSIVE_LOCKS_REQUIRED(muDoublePointer); // \ // expected-warning {{'exclusive_locks_required' attribute requires arguments that are class type or point to class type}} -int elr_function_bad_4() __attribute__((exclusive_locks_required(umu))); // \ +int elr_function_bad_4() EXCLUSIVE_LOCKS_REQUIRED(umu); // \ // expected-warning {{'exclusive_locks_required' attribute requires arguments whose type is annotated with 'lockable' attribute}} @@ -1126,56 +1126,56 @@ int elr_function_bad_4() __attribute__((exclusive_locks_required(umu))); // \ void slr_function() __attribute__((shared_locks_required)); // \ // expected-error {{attribute takes at least 1 argument}} -void slr_function_arg() __attribute__((shared_locks_required(mu1))); +void slr_function_arg() SHARED_LOCKS_REQUIRED(mu1); -void slr_function_args() __attribute__((shared_locks_required(mu1, mu2))); +void slr_function_args() SHARED_LOCKS_REQUIRED(mu1, mu2); -int slr_testfn(int y) __attribute__((shared_locks_required(mu1))); +int slr_testfn(int y) SHARED_LOCKS_REQUIRED(mu1); int slr_testfn(int y) { - int x __attribute__((shared_locks_required(mu1))) = y; // \ + int x SHARED_LOCKS_REQUIRED(mu1) = y; // \ // expected-warning {{'shared_locks_required' attribute only applies to functions and methods}} return x; }; -int slr_test_var __attribute__((shared_locks_required(mu1))); // \ +int slr_test_var SHARED_LOCKS_REQUIRED(mu1); // \ // expected-warning {{'shared_locks_required' attribute only applies to functions and methods}} -void slr_fun_params(int lvar __attribute__((shared_locks_required(mu1)))); // \ +void slr_fun_params(int lvar SHARED_LOCKS_REQUIRED(mu1)); // \ // expected-warning {{'shared_locks_required' attribute only applies to functions and methods}} class SlrFoo { private: - int test_field __attribute__((shared_locks_required(mu1))); // \ + int test_field SHARED_LOCKS_REQUIRED(mu1); // \ // expected-warning {{'shared_locks_required' attribute only applies to functions and methods}} - void test_method() __attribute__((shared_locks_required(mu1))); + void test_method() SHARED_LOCKS_REQUIRED(mu1); }; -class __attribute__((shared_locks_required(mu1))) SlrTestClass { // \ +class SHARED_LOCKS_REQUIRED(mu1) SlrTestClass { // \ // expected-warning {{'shared_locks_required' attribute only applies to functions and methods}} }; // Check argument parsing. // legal attribute arguments -int slr_function_1() __attribute__((shared_locks_required(muWrapper.mu))); -int slr_function_2() __attribute__((shared_locks_required(muDoubleWrapper.muWrapper->mu))); -int slr_function_3() __attribute__((shared_locks_required(muWrapper.getMu()))); -int slr_function_4() __attribute__((shared_locks_required(*muWrapper.getMuPointer()))); -int slr_function_5() __attribute__((shared_locks_required(&mu1))); -int slr_function_6() __attribute__((shared_locks_required(muRef))); -int slr_function_7() __attribute__((shared_locks_required(muDoubleWrapper.getWrapper()->getMu()))); -int slr_function_8() __attribute__((shared_locks_required(muPointer))); +int slr_function_1() SHARED_LOCKS_REQUIRED(muWrapper.mu); +int slr_function_2() SHARED_LOCKS_REQUIRED(muDoubleWrapper.muWrapper->mu); +int slr_function_3() SHARED_LOCKS_REQUIRED(muWrapper.getMu()); +int slr_function_4() SHARED_LOCKS_REQUIRED(*muWrapper.getMuPointer()); +int slr_function_5() SHARED_LOCKS_REQUIRED(&mu1); +int slr_function_6() SHARED_LOCKS_REQUIRED(muRef); +int slr_function_7() SHARED_LOCKS_REQUIRED(muDoubleWrapper.getWrapper()->getMu()); +int slr_function_8() SHARED_LOCKS_REQUIRED(muPointer); // illegal attribute arguments -int slr_function_bad_1() __attribute__((shared_locks_required(1))); // \ +int slr_function_bad_1() SHARED_LOCKS_REQUIRED(1); // \ // expected-warning {{'shared_locks_required' attribute requires arguments that are class type or point to class type}} -int slr_function_bad_2() __attribute__((shared_locks_required("mu"))); // \ +int slr_function_bad_2() SHARED_LOCKS_REQUIRED("mu"); // \ // expected-warning {{ignoring 'shared_locks_required' attribute because its argument is invalid}} -int slr_function_bad_3() __attribute__((shared_locks_required(muDoublePointer))); // \ +int slr_function_bad_3() SHARED_LOCKS_REQUIRED(muDoublePointer); // \ // expected-warning {{'shared_locks_required' attribute requires arguments that are class type or point to class type}} -int slr_function_bad_4() __attribute__((shared_locks_required(umu))); // \ +int slr_function_bad_4() SHARED_LOCKS_REQUIRED(umu); // \ // expected-warning {{'shared_locks_required' attribute requires arguments whose type is annotated with 'lockable' attribute}} @@ -1240,43 +1240,43 @@ struct Foomgoper { // Parsing of member variables and function parameters //------------------------------------------------------ -Mu gmu; +Mutex gmu; class StaticMu { - static Mu statmu; + static Mutex statmu; }; class FooLate { public: - void foo1() __attribute__((exclusive_locks_required(gmu))) { } - void foo2() __attribute__((exclusive_locks_required(mu))) { } - void foo3(Mu *m) __attribute__((exclusive_locks_required(m))) { } - void foo3(FooLate *f) __attribute__((exclusive_locks_required(f->mu))) { } - void foo4(FooLate *f) __attribute__((exclusive_locks_required(f->mu))); + void foo1() EXCLUSIVE_LOCKS_REQUIRED(gmu) { } + void foo2() EXCLUSIVE_LOCKS_REQUIRED(mu) { } + void foo3(Mutex *m) EXCLUSIVE_LOCKS_REQUIRED(m) { } + void foo3(FooLate *f) EXCLUSIVE_LOCKS_REQUIRED(f->mu) { } + void foo4(FooLate *f) EXCLUSIVE_LOCKS_REQUIRED(f->mu); - static void foo5() __attribute__((exclusive_locks_required(mu))); // \ + static void foo5() EXCLUSIVE_LOCKS_REQUIRED(mu); // \ // expected-error {{'this' cannot be implicitly used in a static member function declaration}} template - void foo6() __attribute__((exclusive_locks_required(T::statmu))) { } + void foo6() EXCLUSIVE_LOCKS_REQUIRED(T::statmu) { } template - void foo7(T* f) __attribute__((exclusive_locks_required(f->mu))) { } + void foo7(T* f) EXCLUSIVE_LOCKS_REQUIRED(f->mu) { } - int a __attribute__((guarded_by(gmu))); - int b __attribute__((guarded_by(mu))); - int c __attribute__((guarded_by(this->mu))); + int a GUARDED_BY(gmu); + int b GUARDED_BY(mu); + int c GUARDED_BY(this->mu); - Mu mu; + Mutex mu; }; //------------------------- // Empty argument lists //------------------------- -class __attribute__((lockable)) EmptyArgListsTest { - void lock() __attribute__((exclusive_lock_function())) { } - void unlock() __attribute__((unlock_function())) { } +class LOCKABLE EmptyArgListsTest { + void lock() EXCLUSIVE_LOCK_FUNCTION() { } + void unlock() UNLOCK_FUNCTION() { } }; @@ -1285,7 +1285,7 @@ namespace FunctionDefinitionParseTest { class Foo { public: - Mu mu_; + Mutex mu_; void foo1(); void foo2(Foo *f); }; @@ -1293,17 +1293,17 @@ public: template class Bar { public: - Mu mu_; + Mutex mu_; void bar(); }; -void Foo::foo1() __attribute__((exclusive_locks_required(mu_))) { } -void Foo::foo2(Foo *f) __attribute__((exclusive_locks_required(f->mu_))) { } +void Foo::foo1() EXCLUSIVE_LOCKS_REQUIRED(mu_) { } +void Foo::foo2(Foo *f) EXCLUSIVE_LOCKS_REQUIRED(f->mu_) { } template -void Bar::bar() __attribute__((exclusive_locks_required(mu_))) { } +void Bar::bar() EXCLUSIVE_LOCKS_REQUIRED(mu_) { } -void baz(Foo *f) __attribute__((exclusive_locks_required(f->mu_))) { } +void baz(Foo *f) EXCLUSIVE_LOCKS_REQUIRED(f->mu_) { } } // end namespace @@ -1312,11 +1312,11 @@ namespace TestMultiDecl { class Foo { public: - int __attribute__((guarded_by(mu_))) a; - int __attribute__((guarded_by(mu_))) b, c; + int GUARDED_BY(mu_) a; + int GUARDED_BY(mu_) b, c; private: - Mu mu_; + Mutex mu_; }; @@ -1331,12 +1331,12 @@ class Foo { void bar2(Bar* b) EXCLUSIVE_LOCKS_REQUIRED(b->mu) { b->a = 0; } void bar3(Foo* f) EXCLUSIVE_LOCKS_REQUIRED(f->fooMu) { f->a = 0; } - Mu mu; + Mutex mu; }; int a GUARDED_BY(fooMu); - Mu fooMu; - static Mu fooMuStatic; + Mutex fooMu; + static Mutex fooMuStatic; }; } @@ -1349,7 +1349,7 @@ void testEmptyAttributeFunction() EXCLUSIVE_LOCKS_REQUIRED(""); class Graph { public: - Mu mu_; + Mutex mu_; }; class Node { @@ -1378,7 +1378,7 @@ class smart_ptr { class MyClass { public: - Mu mu_; + Mutex mu_; smart_ptr a PT_GUARDED_BY(mu_); }; -- 2.40.0