Typo found in Summary of CWE: 758 (#4553)

This commit is contained in:
Razvan Ioan Alexe 2022-10-20 20:11:15 +03:00 committed by GitHub
parent 7b9c99003b
commit 1da37461e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 14 deletions

View File

@ -409,7 +409,7 @@ static const Token *checkMissingReturnScope(const Token *tok, const Library &lib
void CheckFunctions::missingReturnError(const Token* tok)
{
reportError(tok, Severity::error, "missingReturn",
"Found a exit path from function with non-void return type that has missing return statement", CWE758, Certainty::normal);
"Found an exit path from function with non-void return type that has missing return statement", CWE758, Certainty::normal);
}
//---------------------------------------------------------------------------
// Detect passing wrong values to <cmath> functions like atan(0, x);

View File

@ -1570,7 +1570,7 @@ private:
void checkMissingReturn() {
check("int f() {}");
ASSERT_EQUALS("[test.cpp:1]: (error) Found a exit path from function with non-void return type that has missing return statement\n", errout.str());
ASSERT_EQUALS("[test.cpp:1]: (error) Found an exit path from function with non-void return type that has missing return statement\n", errout.str());
{
const char code[] = "int main(void) {}";
@ -1578,7 +1578,7 @@ private:
s.standards.c = Standards::C89;
check(code, "test.c", &s); // c code (c89)
ASSERT_EQUALS("[test.c:1]: (error) Found a exit path from function with non-void return type that has missing return statement\n", errout.str());
ASSERT_EQUALS("[test.c:1]: (error) Found an exit path from function with non-void return type that has missing return statement\n", errout.str());
s.standards.c = Standards::C99;
check(code, "test.c", &s); // c code (c99)
@ -1621,7 +1621,7 @@ private:
" return 1;\n"
"out:\n"
"}");
ASSERT_EQUALS("[test.cpp:3]: (error) Found a exit path from function with non-void return type that has missing return statement\n", errout.str());
ASSERT_EQUALS("[test.cpp:3]: (error) Found an exit path from function with non-void return type that has missing return statement\n", errout.str());
// switch
check("int f() {\n"
@ -1630,7 +1630,7 @@ private:
" case 2: return 1;\n"
" }\n"
"}");
ASSERT_EQUALS("[test.cpp:3]: (error) Found a exit path from function with non-void return type that has missing return statement\n", errout.str());
ASSERT_EQUALS("[test.cpp:3]: (error) Found an exit path from function with non-void return type that has missing return statement\n", errout.str());
check("int f() {\n"
" switch (x) {\n"
@ -1660,7 +1660,7 @@ private:
" return 1;\n"
" }\n" // <- error (missing else)
"}");
ASSERT_EQUALS("[test.cpp:4]: (error) Found a exit path from function with non-void return type that has missing return statement\n", errout.str());
ASSERT_EQUALS("[test.cpp:4]: (error) Found an exit path from function with non-void return type that has missing return statement\n", errout.str());
check("int f(int x) {\n"
" if (x) {\n"
@ -1669,7 +1669,7 @@ private:
" return 1;\n"
" }\n"
"}");
ASSERT_EQUALS("[test.cpp:3]: (error) Found a exit path from function with non-void return type that has missing return statement\n", errout.str());
ASSERT_EQUALS("[test.cpp:3]: (error) Found an exit path from function with non-void return type that has missing return statement\n", errout.str());
check("int f() {\n"
" if (!0) {\n"
@ -1681,7 +1681,7 @@ private:
check("int f() {\n"
" if (!0) {}\n"
"}");
ASSERT_EQUALS("[test.cpp:2]: (error) Found a exit path from function with non-void return type that has missing return statement\n", errout.str());
ASSERT_EQUALS("[test.cpp:2]: (error) Found an exit path from function with non-void return type that has missing return statement\n", errout.str());
// loop
check("int f(int x) {\n"
@ -1725,8 +1725,8 @@ private:
" S3& operator=(const S3& t) { if (this != &t) { k = t.k; return *this; } }\n"
" int k;\n"
"};\n");
ASSERT_EQUALS("[test.cpp:2]: (error) Found a exit path from function with non-void return type that has missing return statement\n"
"[test.cpp:10]: (error) Found a exit path from function with non-void return type that has missing return statement\n",
ASSERT_EQUALS("[test.cpp:2]: (error) Found an exit path from function with non-void return type that has missing return statement\n"
"[test.cpp:10]: (error) Found an exit path from function with non-void return type that has missing return statement\n",
errout.str());
// #11171
@ -1735,12 +1735,12 @@ private:
check("std::enable_if_t<sizeof(uint64_t) == 8, int> f() {}");
ASSERT_EQUALS(
"[test.cpp:1]: (error) Found a exit path from function with non-void return type that has missing return statement\n",
"[test.cpp:1]: (error) Found an exit path from function with non-void return type that has missing return statement\n",
errout.str());
check("template<class T> std::enable_if_t<std::is_same<T, int>{}, int> f(T) {}");
ASSERT_EQUALS(
"[test.cpp:1]: (error) Found a exit path from function with non-void return type that has missing return statement\n",
"[test.cpp:1]: (error) Found an exit path from function with non-void return type that has missing return statement\n",
errout.str());
check("template<class T> std::enable_if_t<std::is_same<T, int>{}> f(T) {}");
@ -1751,12 +1751,12 @@ private:
check("typename std::enable_if<sizeof(uint64_t) == 8, int>::type f() {}");
ASSERT_EQUALS(
"[test.cpp:1]: (error) Found a exit path from function with non-void return type that has missing return statement\n",
"[test.cpp:1]: (error) Found an exit path from function with non-void return type that has missing return statement\n",
errout.str());
check("template<class T> typename std::enable_if<std::is_same<T, int>{}, int>::type f(T) {}");
ASSERT_EQUALS(
"[test.cpp:1]: (error) Found a exit path from function with non-void return type that has missing return statement\n",
"[test.cpp:1]: (error) Found an exit path from function with non-void return type that has missing return statement\n",
errout.str());
check("template<class T> typename std::enable_if<std::is_same<T, int>{}>::type f(T) {}");