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

loplugin:commaoperator: Ignore occurrence in FD_SET expansion on Windows

Change-Id: I66974c273918d6d887364e7d552e3caf63e16343
üst c052ec5a
......@@ -39,6 +39,21 @@ bool CommaOperator::VisitBinaryOperator(const BinaryOperator* binaryOp)
if (ignoreLocation(binaryOp)) {
return true;
}
// Ignore FD_SET expanding to "...} while(0, 0)" in some Microsoft
// winsock2.h (TODO: improve heuristic of determining that the whole
// binaryOp is part of a single macro body expansion):
if (compiler.getSourceManager().isMacroBodyExpansion(
binaryOp->getLocStart())
&& compiler.getSourceManager().isMacroBodyExpansion(
binaryOp->getOperatorLoc())
&& compiler.getSourceManager().isMacroBodyExpansion(
binaryOp->getLocEnd())
&& ignoreLocation(
compiler.getSourceManager().getSpellingLoc(
binaryOp->getOperatorLoc())))
{
return true;
}
if (binaryOp->getOpcode() != BO_Comma) {
return true;
}
......
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