Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

re-worded some (verbose) error messages #7220

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/checkclass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2655,7 +2655,7 @@ void CheckClass::checkConstError2(const Token *tok1, const Token *tok2, const st
}
else {
const std::string msg = foundAllBaseClasses ?
"Technically the member function '$symbol' can be static (but you may consider moving to unnamed namespace).\nThe member function '$symbol' can be made a static " :
"Technically the member function '$symbol' can be static (but you may consider moving to anonymous namespace).\nThe member function '$symbol' can be made a static " :
"Either there is a missing 'override', or the member function '$symbol' can be static.\nUnless it overrides a base class member, the member function '$symbol' can be made a static ";
reportError(toks, Severity::performance, "functionStatic",
"$symbol:" + classname + "::" + funcname +"\n"
Expand All @@ -2664,7 +2664,7 @@ void CheckClass::checkConstError2(const Token *tok1, const Token *tok2, const st
"passed to the function. This change should not cause compiler errors but it does not "
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks more like rambling than a verbose message.

"necessarily make sense conceptually. Think about your design and the task of the function first - "
"is it a function that must not access members of class instances? And maybe it is more appropriate "
"to move this function to an unnamed namespace.", CWE398, Certainty::inconclusive);
"to move this function to an anonymous namespace.", CWE398, Certainty::inconclusive);
}
}

Expand Down
5 changes: 2 additions & 3 deletions lib/checkexceptionsafety.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,8 @@ void CheckExceptionSafety::rethrowNoCurrentException()
void CheckExceptionSafety::rethrowNoCurrentExceptionError(const Token *tok)
{
reportError(tok, Severity::error, "rethrowNoCurrentException",
"Rethrowing current exception with 'throw;', it seems there is no current exception to rethrow."
" If there is no current exception this calls std::terminate()."
" More: https://isocpp.org/wiki/faq/exceptions#throw-without-an-object",
"No current exception to rethrow. Will result in std::terminate() call.\n"
"More: https://isocpp.org/wiki/faq/exceptions#throw-without-an-object",
CWE480, Certainty::normal);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/checkfunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -719,8 +719,8 @@ void CheckFunctions::copyElisionError(const Token *tok)
reportError(tok,
Severity::performance,
"returnStdMoveLocal",
"Using std::move for returning object by-value from function will affect copy elision optimization."
" More: https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rf-return-move-local");
"Using std::move for returning object by-value from function will affect copy elision optimization.\n"
"More: https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rf-return-move-local");
}

void CheckFunctions::useStandardLibrary()
Expand Down