summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-03-27 09:02:15 +0100
committerStephan Bergmann <sbergman@redhat.com>2019-03-27 11:30:37 +0100
commitb07a990e51f9bef637cfdcb31b904c223d7ce738 (patch)
tree8d326b1ad8ae85349e3b55fed5daa00a14abaaf1 /compilerplugins
parent89a95f5fa5a2e10d2c67d33270fa31404df33fd5 (diff)
loplugin:typedefparam (clang-cl)
Change-Id: I07604028845c49cc084927e21db7f21c5d053bab Reviewed-on: https://gerrit.libreoffice.org/69796 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/typedefparam.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/compilerplugins/clang/typedefparam.cxx b/compilerplugins/clang/typedefparam.cxx
index d5b3a76103c9..28e0a2d09469 100644
--- a/compilerplugins/clang/typedefparam.cxx
+++ b/compilerplugins/clang/typedefparam.cxx
@@ -12,6 +12,8 @@
#include <iostream>
#include <fstream>
#include <set>
+
+#include "check.hxx"
#include "plugin.hxx"
/**
@@ -53,6 +55,18 @@ bool TypedefParam::VisitFunctionDecl(FunctionDecl const* functionDecl)
ParmVarDecl const* canonicalParam = canonicalDecl->getParamDecl(i);
if (!areTypesEqual(thisParam->getType(), canonicalParam->getType()))
{
+#if defined _WIN32
+ // SAL_IMPLEMENT_MAIN (include/sal/main.h) declares the third parameter of WinMain to be
+ // of type 'char *' rather than 'LPSTR', but using that typedef there would require
+ // including windows.h, which would require including include/prewin.h and
+ // include/postwin.h (to undo macros like Yield defined in windows.h) but which (unlike
+ // include/sal/main.h) are not part of the stable URE interface; so just ignore that
+ // here:
+ if (loplugin::DeclCheck(functionDecl).Function("WinMain").GlobalNamespace())
+ {
+ continue;
+ }
+#endif
report(DiagnosticsEngine::Warning,
"function param %0 at definition site does not match function param at "
"declaration site, %1 vs %2",