Skip to content

Commit

Permalink
Don't warn for variables with [[maybe_unused]]
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github committed Mar 5, 2024
1 parent 743b29a commit f613521
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions lib/checkother.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1401,6 +1401,8 @@ void CheckOther::checkConstVariable()
continue;
if (var->isVolatile())
continue;
if (var->isMaybeUnused())
continue;
if (var->nameToken()->isExpandedMacro())
continue;
if (isStructuredBindingVariable(var)) // TODO: check all bound variables
Expand Down Expand Up @@ -1633,6 +1635,8 @@ void CheckOther::checkConstPointer()
if (p->isArgument()) {
if (!p->scope() || !p->scope()->function || p->scope()->function->isImplicitlyVirtual(true) || p->scope()->function->hasVirtualSpecifier())
continue;
if (p->isMaybeUnused())
continue;
}
if (std::find(nonConstPointers.cbegin(), nonConstPointers.cend(), p) == nonConstPointers.cend()) {
const Token *start = getVariableChangedStart(p);
Expand Down
6 changes: 3 additions & 3 deletions test/cfg/wxwidgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,10 +352,10 @@ void deprecatedFunctions_wxDataViewCustomRenderer(wxDataViewCustomRenderer &data
dataViewCustomRenderer.LeftClick(cursor, cell, model, item, col);
}

void deprecatedFunctions(wxApp &a,
void deprecatedFunctions(wxApp &a [[maybe_unused]],
const wxString &s,
wxArtProvider *artProvider,
const wxCalendarCtrl &calenderCtrl,
wxArtProvider *artProvider [[maybe_unused]],
wxCalendarCtrl &calenderCtrl [[maybe_unused]],
wxComboCtrl &comboCtrl,
wxChar * path)
{
Expand Down

0 comments on commit f613521

Please sign in to comment.