Skip to content

Commit 3c10a9c

Browse files
committed
Update message
1 parent f7029e6 commit 3c10a9c

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

lib/checkstl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2417,7 +2417,7 @@ void CheckStl::globalLockGuardError(const Token* tok)
24172417
{
24182418
reportError(tok, Severity::warning,
24192419
"globalLockGuard",
2420-
"The lock guard won't unlock until the end of the program which could lead to a deadlock.", CWE833, false);
2420+
"Lock guard is defined globally. Lock guards are intended to be local. A global lock guard could lead to a deadlock since it won't unlock until the end of the program.", CWE833, false);
24212421
}
24222422

24232423
void CheckStl::localMutexError(const Token* tok)

test/teststl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4420,7 +4420,7 @@ class TestStl : public TestFixture {
44204420
" static std::lock_guard<std::mutex> g(m);\n"
44214421
"}\n",
44224422
true);
4423-
ASSERT_EQUALS("[test.cpp:3]: (warning) The lock guard won't unlock until the end of the program which could lead to a deadlock.\n", errout.str());
4423+
ASSERT_EQUALS("[test.cpp:3]: (warning) Lock guard is defined globally. Lock guards are intended to be local. A global lock guard could lead to a deadlock since it won't unlock until the end of the program.\n", errout.str());
44244424

44254425
check("void f() {\n"
44264426
" static std::mutex m;\n"
@@ -4484,7 +4484,7 @@ class TestStl : public TestFixture {
44844484
" }\n"
44854485
"};\n",
44864486
true);
4487-
ASSERT_EQUALS("[test.cpp:4]: (warning) The lock guard won't unlock until the end of the program which could lead to a deadlock.\n", errout.str());
4487+
ASSERT_EQUALS("[test.cpp:4]: (warning) Lock guard is defined globally. Lock guards are intended to be local. A global lock guard could lead to a deadlock since it won't unlock until the end of the program.\n", errout.str());
44884488

44894489
check("std::mutex& h();\n"
44904490
"void f() {\n"

0 commit comments

Comments
 (0)