Kaydet (Commit) f6dda4e1 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Make loplugin:redundantcast accept bool(FD_ISSET(...)) again

Change-Id: I4e96c55c246cf806f17df31844a00d0e8a5e4f56
üst db38e3f2
...@@ -483,6 +483,30 @@ bool RedundantCast::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr const * exp ...@@ -483,6 +483,30 @@ bool RedundantCast::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr const * exp
if (loplugin::hasPathnamePrefix(aFileName, SRCDIR "/svx/source/tbxctrls/fillctrl.cxx")) if (loplugin::hasPathnamePrefix(aFileName, SRCDIR "/svx/source/tbxctrls/fillctrl.cxx"))
return true; return true;
// See the commit message of d0e7d020fa405ab94f19916ec96fbd4611da0031
// "socket.c -> socket.cxx" for the reason to have
//
// bool(FD_ISSET(...))
//
// in sal/osl/unx/socket.cxx:
auto const sub = compat::getSubExprAsWritten(expr);
//TODO: Better check that sub is exactly an expansion of FD_ISSET:
if (sub->getLocEnd().isMacroID()) {
for (auto loc = sub->getLocStart();
loc.isMacroID()
&& (compiler.getSourceManager()
.isAtStartOfImmediateMacroExpansion(loc));
loc = compiler.getSourceManager().getImmediateMacroCallerLoc(loc))
{
if (Lexer::getImmediateMacroName(
loc, compiler.getSourceManager(), compiler.getLangOpts())
== "FD_ISSET")
{
return true;
}
}
}
auto const t1 = expr->getTypeAsWritten(); auto const t1 = expr->getTypeAsWritten();
auto const t2 = compat::getSubExprAsWritten(expr)->getType(); auto const t2 = compat::getSubExprAsWritten(expr)->getType();
if (t1 != t2) if (t1 != t2)
......
...@@ -2399,7 +2399,7 @@ sal_Bool SAL_CALL osl_isInSocketSet(oslSocketSet Set, oslSocket pSocket) ...@@ -2399,7 +2399,7 @@ sal_Bool SAL_CALL osl_isInSocketSet(oslSocketSet Set, oslSocket pSocket)
return false; return false;
} }
return FD_ISSET(pSocket->m_Socket, &Set->m_Set); return bool(FD_ISSET(pSocket->m_Socket, &Set->m_Set));
} }
sal_Int32 SAL_CALL osl_demultiplexSocketEvents(oslSocketSet IncomingSet, sal_Int32 SAL_CALL osl_demultiplexSocketEvents(oslSocketSet IncomingSet,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment