compilerplugins/clang/toolslong.cxx | 6 ++++++ 1 file changed, 6 insertions(+)
New commits: commit 760835877c6d64da239cc4791bdbf786f88c8bb1 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Fri Nov 27 11:22:15 2020 +0100 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Sun Nov 29 17:44:19 2020 +0100 Avoid loplugin:toolslong in system header macros ...as experienced with clang-cl: > C:/lo-clang/core/sal/osl/w32/socket.cxx(968,44): error: CStyleCastExpr, suspicious cast from 'unsigned long long' to 'long' [loplugin:toolslong] > ioctlsocket(pSocket->m_Socket, FIONBIO, &Param); > ^~~~~~~ > C:/PROGRA~2/WI3CF2~1/10/Include/10.0.18362.0/um\winsock2.h(220,21): note: expanded from macro 'FIONBIO' > #define FIONBIO _IOW('f', 126, u_long) /* set/clear non-blocking i/o */ > ^~~~~~~~~~~~~~~~~~~~~~ > C:/PROGRA~2/WI3CF2~1/10/Include/10.0.18362.0/um\winsock2.h(217,35): note: expanded from macro '_IOW' > #define _IOW(x,y,t) (IOC_IN|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y)) > ^~~~~~~~~~~~~~~ Change-Id: Ie2ccc816a214cf39a77bd0ffeddd9f1636f19cd4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106756 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/compilerplugins/clang/toolslong.cxx b/compilerplugins/clang/toolslong.cxx index 26105a2697d8..5a3932e90dbd 100644 --- a/compilerplugins/clang/toolslong.cxx +++ b/compilerplugins/clang/toolslong.cxx @@ -420,6 +420,12 @@ bool ToolsLong::VisitCStyleCastExpr(CStyleCastExpr* expr) SourceLocation loc{ compat::getBeginLoc(expr) }; while (compiler.getSourceManager().isMacroArgExpansion(loc)) loc = compiler.getSourceManager().getImmediateMacroCallerLoc(loc); + if (compiler.getSourceManager().isMacroBodyExpansion(loc) + && compiler.getSourceManager().isInSystemHeader( + compiler.getSourceManager().getSpellingLoc(loc))) + { + return true; + } report(DiagnosticsEngine::Warning, "CStyleCastExpr, suspicious cast from %0 to %1", compat::getBeginLoc(expr)) << expr->getSubExpr()->IgnoreParenImpCasts()->getType() << expr->getType() _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits