From beb5a3a298a1bb2687b421cb960d36a5e9b3ad43 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Thu, 20 May 2021 11:28:36 -0400 Subject: [PATCH] Correct some thread safety analysis diagnostics; NFC. The diagnostics were not following the usual style rules. --- clang/include/clang/Basic/DiagnosticSemaKinds.td | 8 ++++---- .../test/SemaCXX/warn-thread-safety-verbose.cpp | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 9dd9b1b5118b..fff6b62f3b7f 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -3634,13 +3634,13 @@ def warn_fun_requires_lock_precise : def note_found_mutex_near_match : Note<"found near match '%0'">; // Verbose thread safety warnings -def warn_thread_safety_verbose : Warning<"Thread safety verbose warning.">, +def warn_thread_safety_verbose : Warning<"thread safety verbose warning">, InGroup, DefaultIgnore; -def note_thread_warning_in_fun : Note<"Thread warning in function %0">; -def note_guarded_by_declared_here : Note<"Guarded_by declared here.">; +def note_thread_warning_in_fun : Note<"thread warning in function %0">; +def note_guarded_by_declared_here : Note<"guarded_by declared here">; // Dummy warning that will trigger "beta" warnings from the analysis if enabled. -def warn_thread_safety_beta : Warning<"Thread safety beta warning.">, +def warn_thread_safety_beta : Warning<"thread safety beta warning">, InGroup, DefaultIgnore; // Consumed warnings diff --git a/clang/test/SemaCXX/warn-thread-safety-verbose.cpp b/clang/test/SemaCXX/warn-thread-safety-verbose.cpp index 2f892cd1e175..e8b229f3373b 100644 --- a/clang/test/SemaCXX/warn-thread-safety-verbose.cpp +++ b/clang/test/SemaCXX/warn-thread-safety-verbose.cpp @@ -21,41 +21,41 @@ class LOCKABLE Mutex { class Test { Mutex mu; - int a GUARDED_BY(mu); // expected-note3 {{Guarded_by declared here.}} + int a GUARDED_BY(mu); // expected-note3 {{guarded_by declared here}} void foo1() EXCLUSIVE_LOCKS_REQUIRED(mu); void foo2() SHARED_LOCKS_REQUIRED(mu); void foo3() LOCKS_EXCLUDED(mu); - void test1() { // expected-note {{Thread warning in function 'test1'}} + void test1() { // expected-note {{thread warning in function 'test1'}} a = 0; // expected-warning {{writing variable 'a' requires holding mutex 'mu' exclusively}} } - void test2() { // expected-note {{Thread warning in function 'test2'}} + void test2() { // expected-note {{thread warning in function 'test2'}} int b = a; // expected-warning {{reading variable 'a' requires holding mutex 'mu'}} } - void test3() { // expected-note {{Thread warning in function 'test3'}} + void test3() { // expected-note {{thread warning in function 'test3'}} foo1(); // expected-warning {{calling function 'foo1' requires holding mutex 'mu' exclusively}} } - void test4() { // expected-note {{Thread warning in function 'test4'}} + void test4() { // expected-note {{thread warning in function 'test4'}} foo2(); // expected-warning {{calling function 'foo2' requires holding mutex 'mu'}} } - void test5() { // expected-note {{Thread warning in function 'test5'}} + void test5() { // expected-note {{thread warning in function 'test5'}} mu.ReaderLock(); foo1(); // expected-warning {{calling function 'foo1' requires holding mutex 'mu' exclusively}} mu.Unlock(); } - void test6() { // expected-note {{Thread warning in function 'test6'}} + void test6() { // expected-note {{thread warning in function 'test6'}} mu.ReaderLock(); a = 0; // expected-warning {{writing variable 'a' requires holding mutex 'mu' exclusively}} mu.Unlock(); } - void test7() { // expected-note {{Thread warning in function 'test7'}} + void test7() { // expected-note {{thread warning in function 'test7'}} mu.Lock(); foo3(); // expected-warning {{cannot call function 'foo3' while mutex 'mu' is held}} mu.Unlock();